How vishik-on-github/llvm-programming-lang works
Main Components
• Source Code Input: Represent the source language file (e.g., test.eva) as the starting input.
• Frontend / Parser Module:
• Grammar (EvaGrammar.bnf) and the parser logic (EvaParser.h).
• Semantic Analysis/Environment:
• Environment module (Environment.h) which likely handles scoping, variable type management, and symbol tables.
• LLVM Integration Module:
• Integration with LLVM through the EvaLLVM module (EvaLLVM.h and eva-llvm.cpp). This part is responsible for converting the parsed and semantically checked input into LLVM intermediate representation (IR).
• Logger:
• Logger module (Logger.h) as a cross-cutting concern for error reporting and debugging.
• Build/Run Pipeline:
• The compile-run.sh acts as the orchestrator of the build and run phases.
• Supporting Documentation/Notes:
• Although not directly part of the execution flow, the notes directory indicates additional design considerations, plans for code improvement, and technical thoughts that influenced the architecture.
Relationships and Data Flow
• The process begins with the source file being fed into the Parser.
• The Parser uses the BNF grammar definition to generate an Abstract Syntax Tree (AST) or similar structure.
• The AST is then passed to components that check semantics, maintain the Environment, and potentially log any issues.
• Once analysis is complete, the EvaLLVM module uses LLVM libraries to generate IR (and subsequently, machine code).
• Input Source (test.eva) → Parser (EvaParser, EvaGrammar.bnf)
• Parser → Semantic Environment (Environment.h)
• Semantic Environment → Code Generation (EvaLLVM)
• Each step augmented by Logger outputs (Logger.h)
Architectural Patterns and Technologies
• Modular separation: The system cleanly separates concerns (parsing, semantic analysis, code generation, logging).
• Integration with LLVM libraries, which is the backbone for IR generation and subsequent optimizations.
• Infrastructural scripts or automation tools (like compile-run.sh) that provide the execution flow.