Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cameronclay/compiler
Two pass compiler wtih a language similar to that of a hybrid of C and Java.
https://github.com/cameronclay/compiler
boost-program-options boost-test cmake compiler cpp20 stl vcpkg
Last synced: 4 days ago
JSON representation
Two pass compiler wtih a language similar to that of a hybrid of C and Java.
- Host: GitHub
- URL: https://github.com/cameronclay/compiler
- Owner: CameronClay
- Created: 2024-03-16T22:21:19.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-06-11T02:15:53.000Z (5 months ago)
- Last Synced: 2024-06-12T05:07:22.027Z (5 months ago)
- Topics: boost-program-options, boost-test, cmake, compiler, cpp20, stl, vcpkg
- Homepage:
- Size: 25.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Compiler
Two pass compiler for a language similar to a hybrid between C and Java. Two pass compiler means the code is analyzed twice and information from the first pass is used to do semantic checking and code generation during the second pass.## About
During the first pass of compilation, the code is parsed against the grammar, checked for syntax errors and a symbol table is constructed which serves to enable semantic error checking in the second pass of compilation.
The goal of the second pass is to perform semantic error checking, to generate icode, and to produce target code.## Features
- Inheritance: Single inheritance.
- Super syntax: super(class_name).
- Abstract syntax: [public|private] abstract identifier()
- Each class stores $vpointer which points to vtable for currently stored class
- VTables are stored in directives and initialized afterwards
- Supports switch statements.
- Supports cstring output.
- Supports conversion between integers and strings.## How to run
```
Allowed options:
-h [ --help ] Produce help message
-f [ --input-file ] arg Specifies the source file to be compiled into
assembly.
-i [ --icode ] Outputs the intermediate code.
-s [ --sym ] Outputs the symbol table.
-l [ --lex ] Outputs all the tokens
```### Unit Testing and Integration Testing
- Unit testing and integration testing is done using Boost.Test.### Tooling
- C++ 20
- CMake
- Boost.Test
- Boost.Program_options
- vcpkg
- g++ compiler### Note
The code for this project is private but I am more than happy to show and expain the code.