/C--Compiler

A toy C++ Compiler written in C++. Mainly used for educational purposes. Was part of a final year dissertation.

Primary LanguageC++

C--Compiler

C--Compiler is an attempt to make, by hand, a very basic compiler to translate C++ into assembly for educational purposes. The aim to begin with, is for the compiler to be able to process a relatively small subset of C++, hence the name C--. This project has nothing to do with the C-- proramming language despite what the name of this project might suggest.
This project was part of a final year dissertation. the final_year_proj_june2020 branch reflects the project as it stood on submission

## Getting Started

Prerequisites

  • Dear ImGui Intermediate Mode GUI.

  • SFML as the rendering backend.

  • SFML-Bindings Dear ImGui SFML bindings - Can optionally use any other rendering backend Note sfml bindings do not support imgui docking.

  • ImGuiColorTextEdit Dear ImGui Text Editor Extension/Widget.

  • ImGuiFileDialog Dear ImGui Extension/Widget for file dialogs.

  • spdlog for formating and sinking to window (and potentially files).

  • magic_enum for stringifying enums.

  • treant-js can optionally be used to visualize the Abstract Syntax Tree produced by the parser using a web browser (required for the dissertation branch).

  • C++17

Current Features

  • Lexical Analysis (Mostly complete but some tokens, while they will be tokenized, they wont be recongized leading the parser to throw an error)
  • Parsing (declaration, declaration-assignment, assignment, if-elseif-else, while-dowhile, arithmetic-logical expressions, return statements)
  • Semantic Analysis (Checks for variable being declared or redefined in the current scope, nested scopes, symbols, symbol tables)
  • Partial integration in this branch | Intermediate code generation (TAC) for the language constructs mentioned above.
  • Partial integration in this branch | Some, possibly incorrect 'assembly'.

In Progress

Authors

  • Dimitrios Kazakos - Initial work - Gast91

License

This project is licensed under the MIT License - see the LICENSE.md file for details