A Simple Python Compiler that is capable of printing strings and printing basic arithmetic operations.
A mini compiler demonstrating the use of data types utilizing Flex and Bison. In the case of Python, the print statement is able to take in multiple data types such as integers and string. The developer in Python would simply call print(<value>)
, however inside the compiler it requires complex design to determine the value type then it can print to the console.
Installing and configuring Flex and Bison using Docker.
Have Docker pre-installed into your operating system.
- Using CLI Command for Ubuntu
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Below is an example of how you download this project and start using Docker.
- Clone the repo
git clone <repo_url>
- Go into the Project Repository
cd /path/to/repository
- Build Image
sudo docker build -t compiler-image .
- Run Container
sudo docker run -it compiler-image
- Run Test inside Container
$ make $ ./compiler <source_file>
Using the pre-defined Python file to test arithmetic operations and printing of strings.
$ make
$ ./compiler __test__/arithmetic.py
Remove all generated files.
make clean
Distributed under the MIT License. See LICENSE.txt
for more information.