zambonin / lukasiewicz

Toy compiler for a language based on Polish notation.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Łukasiewicz is a procedural, strongly and statically typed language, with
lexical scope and reserved words, where the operations are output in prefix
notation.

This compiler generates the syntax tree for given Łukasiewicz code. It
currently supports operations with integers, floats, booleans and characters,
that optionally can be stored in variables, arrays and (de)referenced through
pointers. Conditional branches, for loops and functions (including
anonymous and functors) are supported.

Its hard dependencies are `clang++` or `g++`, `flex` and `bison`, and it can
be compiled by typing `make` or `make debug`, if one wants debugging symbols.
Tests to ascertain the intermediate representation output and lack of memory
leaks can be run with `make test`.

To run the compiler, use one of the following:

    $ ./lukacompiler < $FILE
    # EOF-terminated `stdin` or redirection

    $ ./lukacompiler -d < $FILE
    # verbose debug tracer for the parser

    $ ./lukacompiler -p < $FILE
    # primitive Python transpiler

Both flags can be used together.

Full specifications are available under the `docs/` folder, in pt_BR.

Known issues:
  * a program must not end with a syntax error inside a scoped block
  * transpiled Python code may not follow PEP8 specifications, and as
    such, will fail automated linters

Original assignments:
  * ea7787f1c8e84e042766751e2110abd0c79b722a (first part of the language)
  * 79f153d023fff582b2a3cee0cb010c6cef60c904 (language extension)

About

Toy compiler for a language based on Polish notation.

License:GNU General Public License v3.0


Languages

Language:C++ 62.6%Language:Yacc 18.3%Language:Python 10.6%Language:Lex 6.2%Language:Makefile 2.3%