How robo-monk/krama works
Project Type Analysis
This is a programming language implementation project that includes both a compiler and interpreter. The project is written in C and appears to be a toy programming language named Krama with its own syntax and features.
Main Components
A. Frontend Layer:
• Tokenizer (src/frontend/tokeniser.c)
• Parser (src/frontend/parser.c)
• Keyword and Operator handling (src/frontend/KeywordToken.c, Op.c)
B. Middle Layer:
• Abstract Syntax Tree (src/ast/AbstractSyntaxTree.c)
• AST Evaluator (src/ast/AbstractSyntaxTreeEvaluator.c)
• Type Inference System (src/compiler/inference.c)
C. Backend Layer:
• C Compiler (src/compiler/CCompiler.c)
• Interpreter (src/interpreter/Interpreter.c)
D. Support Systems:
• HashMap Implementation (src/hashmap/hashmap.c)
• Utilities (src/utils.c)
[Input Krama Code]
• ↓
• Frontend |
• Tokenizer | |
• ↓ |
• Parser | |
• ↓
• Middle Layer |
• AST | |
• ↓ |
• Inference | |
• ↓
• Backend |
• C Compiler| |
• ↓ |
• Interpreter | |
• ↓
[Output (C Code/Execution)]
Important Details
a. Data Flow Paths:
• How source code flows from tokenization through parsing
• How AST is generated and transformed
• Bifurcation between compilation and interpretation paths
b. Key Processes:
• Type inference system interaction
• AST evaluation steps
• Compilation to C code process
• Interpretation process
c. Component Interactions:
• How the hashmap is used across components
• Where type checking occurs
• Error handling flow