yshrdbrn / ogle

A compiler written in Python from scratch

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Status

ogle

Ogle is a compiler written in python from scratch. It compiles a language similar to C++ to the MOON processor's assembly.

Running The Compiler

Note: The compiler is tested using Python 3.7

First, install all the required packages in your venv:

$ pip install -r requirements.txt

Then, run ogle/runner.py:

$ python3 ogle/runner.py <input_file_name>

The output .m file will be generated in the same directory as the input file (if there are not compilation errors).

To run the assembly code, you need to compile MOON processor simulator and give the .m file to the executable:

$ cd moon/
$ gcc moon.c -o moon.out
$ ./moon.out <path_to_dot_m_file> util.m util_2.m

Running The Tests

Tests are run using the pytest library. To run the tests, run pytest in the root directory:

$ pytest

About

A compiler written in Python from scratch

License:MIT License


Languages

Language:Python 65.4%Language:C 24.4%Language:MATLAB 10.2%