A very simple C-like language.
I recommend using python venv
:
$ python -m venv venv && source ./venv/bin/activate
The dependencies are defined in requirements.txt
. They are:
llvmlite
, for code generation and some compilation;ply
, for lexing and parsing hte language;flake8
, for linting;coverage
, for code test coverage (not used much).
(venv) $ pip install -r requirements.txt
Place the code inside example.ce
and execute:
(venv) $ make compile
It will generate an a.out
with gcc
. Or, if you prefer, you can execute:
(venv) $ python main.py -f example.ce > out.ir
(venv) $ lli out.ir
It will output the intermediary code into the file and run it with the llvm
interpreter.