This Python project implements the 'Patito' language using PLY lex and yacc. The 'Patito' language is a custom programming language with defined rules and syntax.
The project consists of the following files:
Scanner_Parser_Patito.py
: Contains the lexer and parser definitions for the 'Patito' language.test_Lexer_Parser.py
: Runs tests on the lexer and parser using multiple test files, both correct and incorrect, to verify the acceptance or detection of errors.Virtual_Machine.py
: Implements a virtual machine class that executes the intermediate code quadruples generated by the parser. It creates a memory space, variables table, and constants table.run_VM.py
: Runs tests on the virtual machine to execute code written in the 'Patito' language.
To run the project and execute 'Patito' language code, follow these steps:
- Ensure that Python is installed on your system.
- Clone this repository to your local machine.
- Navigate to the project directory.
- Open the
run_VM.py
file and add the name of your own code file to thefiles
list. - Save the file and close it.
- Open a terminal and run the following command:
python run_VM.py
- The virtual machine will execute the code in your file, and the output will be displayed in the terminal.
Feel free to explore and modify the code to suit your needs. Enjoy using the 'Patito' language!
Contributions are welcome! If you have any suggestions, bug reports, or feature requests, please open an issue or submit a pull request.