Parsers
We provide parsers for different programming languages. Each parser is extremely simple and it stops as soon as it encounters an error. All parsers follow the same algorithm. As the rest of this project, they are all in the public domain or under the Unlicense license depending on your juridiction.
The parsers are available for the following languages:
- C++;
- Haxe;
- JavaScript;
- Python 3;
- Rust.
Usage
The parsers were developed and tested on Linux.
We suppose you can use the make command and you are using a POSIX shell (Bash, ZSH, Fish...).
All parser repositories contain the source code necessary to use the parser as a library in your projects, and the source code for generating the grm-definition-to-json and grm-to-json binaries used for the tests and for external tools.
All parser repositories follow the same file hierarchy.
- A
Makefileis present in the root of the directory. - The
srcdirectory contains the source code of the parser.- Depending on the language, or the source code for the library is contained in a
src/grmdirectory (Haxe, C++); or all the source code for the library is dumped directly in the root ofsrc(Rust) - A
src/bindirectory is present and contains the source code for thegrm-definition-to-jsonandgrm-to-jsonbinaries. - Depending on the language, a
src/testsdirectory is present and contains the source code for the unit tests.
- Depending on the language, or the source code for the library is contained in a
- When the binaries are built, they are in the
builddirectory. Depending on the target, they can be in thebuild/debugorbuild/releasedirectories.
All parser repositories have the following make commands.
- The command
makealone does nothing. - Use
make debugto build the binaries in Debug mode. - Use
make releaseto build the binaries in Release mode. - Use
make testto launch the unit tests if any. - Use
make docto generate the documentation. - Use
make fmtto format the source code if possible. - Use
make cleanto remove all extra files and directories created when using the previous commands.
On improvement and contribution
It is important to note that we give you the parsers as-is. They are gifts. We do not necessarily maintain them. We do not necessarily accept any external contributions. We do not necessarily improve them.