| include | |
| ast | |
| Ast.h | Defined the AST Node classes (ProgramAST, StructDefAST, FuncDefAST) and a visitor interface for traversing the AST |
| AstBase.h | Defines the AST Abstract class for printing out AST Nodes |
| AstDecl.h | Holds declaration for all the AST Nodes |
| ASTProperties.h | |
| AstWalkers.h | |
| codegen | |
| CodegenUtils.h | |
| CodegenVisitor.h | Defined CgVisitor, which lowers ASTs to LLVM IR |
| LLVMRes.h | Defined LLVMRes, which encapsulates the state of LLVM (Context, Modules, IRBuilder, PassManagers, JIT) context base information. This resource will be shared across multiple instances within the Compiler |
| MLIRGen.h | |
| MLIRGenImpl.h | |
| MLIRLowering.h | |
| SammineJIT.h | JIT Compiler based on Kaleidoscope |
| TypeConverter.h | Defines the TypeConverter, which holds the characistics of converting our AST types into LLVM IR types |
| compiler | |
| Compiler.h | Define the Compiler staging |
| lex | |
| Lexer.h | Houses the lexer and the declaration of its method |
| Token.h | Defines the token structure (TokenType, TokStream, TokenMap) |
| parser | |
| Parser.h | Defines Parser, which consumes tokens and constructs the AST |
| semantics | |
| GeneralSemanticsVisitor.h | Defines GeneralSemanticsVisitor, an ASTVisitor that enforces general semantic rules for scoped definitions, detecting duplicates, and ensuring correct return usage in blocks |
| ScopeGeneratorVisitor.h | Declares ScopeGeneratorVisitor, an ASTVisitor that builds and manages lexical scope by registration and reporting if there's been redefinitions |
| typecheck | |
| BiTypeChecker.h | Defines the BiTypeCheckerVisitor, consist of the flow for Bi-Directional Type checking, which allows for synthesizing types, validating consistency, and register types |
| LinearTypeChecker.h | Linear type checker — tracks heap-allocated pointers and enforces they are consumed (freed or moved) exactly once before scope exit |
| Monomorphizer.h | |
| Types.h | Defines the core Type system for Sammine |
| util | |
| FileRAII.h | A RAII-wrapper around C++ file type to use in the project for lexer and parser |
| LexicalContext.h | A simple scoping class, doesn't differentiate between different names, like variable name, func name and all that |
| Logging.h | LLVM-style debug logging infrastructure |
| MonomorphizedName.h | |
| QualifiedName.h | |
| Utilities.h | Holds classes and functionalities for dealing with Error handling, source locations caching & indexing |
| src | |
| ast | |
| Ast.cpp | Implemention of AST Visitor, used for traversing the AST |
| AstPrinterVisitor.cpp | Implementation for Ast Printer, using a Visitor pattern in order to traverse the AST for better debugging |
| codegen | |
| CodegenVisitor.cpp | Implementation for CodegenVisitor, it converts the AST Representation into LLVM IR and it also uses a visitor pattern in order to traverse through the parsed AST to emit LLVM IR |
| SammineJIT.cpp | The Implementation for SammineJIT |
| TypeConverter.cpp | Implementation for TypeConverter, converting AST Node types into LLVM IR Types |
| lex | |
| Lexer.cpp | Implementation for scanning and streaming Tokens |
| semantics | |
| GeneralSemanticsVisitor.cpp | Implementation for GeneralSemanticsVisitor |
| ScopeGeneratorVisitor.cpp | Implements ScopeGeneratorVisitor, an ASTVisitor that traverses the AST to populate a lexical symbol table |
| typecheck | |
| BiTypeChecker.cpp | Implementation of BiTypeCheckerVisitor: visit() methods, registration, and helpers. Synthesize methods are in BiTypeCheckerSynthesize.cpp |
| BiTypeCheckerSynthesize.cpp | All synthesize() methods, call-dispatch helpers, and generic unification/substitution for BiTypeCheckerVisitor |
| LinearTypeChecker.cpp | Implements linear type checking — enforces that heap-allocated ('ptr<T>) pointers are consumed exactly once before scope exit |
| Types.cpp | Implements the core Type system for Sammine |
| Parser.cpp | Implementation for Parser class, it takes in the token stream and converts it into Parsing things suchs as programs, top-level (struct, functions, global variables) |
| sammine.cpp | The main file to produce an executable that is the sammine compiler |
| unit-tests | |
| test_lexer.cpp | The unit-test file for all things related to a lexer |
| test_parser.cpp | The unit-test file for all things related to a parser |