This project provides an easy-to-use and extensible framework for creating/prototyping languages and grammars.
It also provides support for atypical languages, e.g., sample languages typically used in education.
Example sample grammar in BNF:
S’ –> S
S –> AA
A –> aA
A –> b
May produce the sentence: aaaaaabb
This project aims to provide a foundation for fast prototyping of languages/grammar, reference/an education tool for students.
Compilation speed is not a main concern, although, components should be produced in a way so that they can be replaced for applications that require it.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
Simply clone this project to get started.
git clone https://github.com/warburec/Generalised-Compilation.git
String input = """
x = 1 + 2;
y = x + 3;
x = y + 0;
""";
Compiler compiler = new CompilerBuilder()
.setComponents(
new ExampleLexicalAnalyserFactory(),
new ExampleParserFactory(),
new ExampleCodeGenFactory(),
new ExampleGrammarBundle()
)
.createCompiler();
String output = compiler.compile(input);
Run the tests with Gradle using the gradle wrapper:
./gradlew test
This project uses JUnit. Tests can be found in the test folder.
If you're using VSCode, it is recommended to use the VSCode Test Runner for Java extension.
Make a pull request. Make an issue for large changes. Ensure unit tests are provided for your code.
Ewan WarburtonThis project is licensed under GNU GPLv3 - see the LICENSE.md file for details