Skip to content
This repository was archived by the owner on Sep 18, 2025. It is now read-only.

moise7000/Mini-Python-Compiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pytator Compiler

Table of Contents

  1. Introduction
  2. Team
  3. Features
  4. Installation
  5. Usage
  6. Examples
  7. Testing
  8. Acknowledgements

Introduction

The Pytator Compiler is a Mini Python compiler designed to transform mini python's code to ASM. For now it only generates the AST of the code. (PCL1)

Team

  • DECIMA Ewan
  • LICHTNER Marc
  • SALQUEBERE Valentin
  • VANRULLEN Lancelot

Why use Pytator ?

  • Fast and efficient

Features

  • Cross-platform: Runs on any machine running java
  • Error Reporting: Detailed syntax and lexical error messages

Installation

Prerequisites

Jar

To run the jar file, you need to have Java installed on your machine. You can download it from the official website.

Docker

To run the web interface (that runs the jar), you juste need Docker/Docker compose installed on your machine. You can download it from the official website.

Usage

Basic Command

To compile a Mini Python source file:

$ java -jar pytator.jar -ast -f dot -i source.py

Command-line Options

  • -ast,--abstract-syntax-tree Generate the AST
  • -cst,--syntax-tree Generate the syntax tree
  • -f,--format Output format (e.g., dot)
  • -i,--input-file Input file path
  • -o,--output-file Output file
  • -x,--exclusive Only display the resulting tree

Docker

Anyone can run the AST builder on their machine using Docker. To do so, you can use one of the following :

Run by building from compose

cd utils/web_interface && docker compose up --build

Run by pulling from Docker Hub

docker run -p 5000:5000 lentslow/pcl-interface

Then access localhost:5000 in your browser.

Examples

Here are some sample programs you can compile using Pytator :

  1. Hello World:
java -jar pytator.jar -ast -f dot -i examples/hello_world.py
print("Hello, World!")

img.png

For more examples, refer to the examples/ directory.

Testing

To run tests, make sure you have JUnit in the classpath :

In IntelliJ, right click on tests > Run 'All Tests'.

Reporting Issues

If you encounter any issues or have feature requests, please open an issue on the Gitlab repository.

Acknowledgements

  • IntelliJ IDEA, Flask, Docker used in this project

About

Python Compiler made in Java

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •