Skip to content

compilerpraktikum/compiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

adac679 · Feb 9, 2022
Feb 3, 2022
Jan 18, 2022
Feb 6, 2022
Dec 14, 2021
Nov 11, 2021
Feb 9, 2022
Feb 9, 2022
Nov 2, 2021
Nov 2, 2021
Dec 12, 2021
Oct 29, 2021
Dec 17, 2021
Oct 29, 2021
Jan 11, 2022
Dec 7, 2021
Feb 7, 2022
Feb 7, 2022
Feb 7, 2022
Oct 23, 2021
Oct 20, 2021
Jan 7, 2022
Dec 7, 2021
Oct 20, 2021

Repository files navigation

Compiler

This repository is part of a Uni-Project to write a complete Compiler for a subset of Java.

Features

  • error recovery using context sensitive anchor sets
  • source annotated error messages

Documentation

Building

$ ./build
# Or just:
$ ./gradlew shadowJar
# To build the `LexerDEA.svg` file:
$ dot LexerDEA.dot -T svg > LexerDEA.svg

Testing

Our tests consist of unit tests written directly in kotlin and *MjTestSuitetests, that run tests using all MjTest-tests directly in kotlin. This makes it easier so use the mjtests in the IDE.

# make sure the `test-cases` submodule is cloned
$ git submodule update --recursive
$ ./gradlew test

Running

$ ./run <arguments>
# Or just
$ java -jar out/libs/compiler-all.jar <arguments>

Use --help for information on CLI arguments.

Structure

The repository is organized into packages:

  • ast: abstract syntax tree
  • backend: assembly generation from FIRM graph
  • error: error handling and output
  • lexer: lexer for input tokenization
  • optimization: program optimization on FIRM graph
  • parser: parser for AST construction
  • semantic: semantic analysis (types, names, lvalue, etc.)
  • source: input handling + source file annotations
  • transform: AST to FIRM graph conversion