- Keep this as a learning-first compiler repo: prioritize clarity of the Pascal -> token -> parse -> MEPA flow.
- Preserve runtime behavior unless a behavior change is explicitly approved.
- Single solution and project:
Compiler.sln->Compiler/Compiler.csproj(.NET Framework 4.6.1, non-SDK style). - Entrypoint:
Compiler/Program.cs. - Compiler stages live in
Compiler/FrontEnd/with subfolders:Lexer/,Parser/, andSemantics/. - Pascal keyword table is embedded from
Compiler/Resource/keywords.txtand loaded byCompiler/Tools/TypePascal.cs.
- Build from repo root:
xbuild Compiler.sln /p:Configuration=Debug
- Run default fixture from
Compiler/Tests:- Windows:
..\bin\Debug\Compiler.exe - Linux/Mono:
mono ../bin/Debug/Compiler.exe
- Windows:
- Optional custom input path:
- Linux/Mono:
mono Compiler/bin/Debug/Compiler.exe Compiler/Tests/for.pas
- Linux/Mono:
Program.csuses CLI argargs[0]when provided; otherwise it falls back towhile.pasin the current working directory.ParserwritesMepa.txtto the current working directory (File.Open("Mepa.txt", FileMode.Create)).- Parser startup strictly expects
program <id> ( <id> [, <id>]* );before declarations andbeginblock. - Resource name coupling matters: embedded
keywords.txtmust remain resolvable asCompiler.Resource.keywords.txt.
- Build solution in Debug.
- Run executable from
Compiler/Tests(default mode) or pass explicit file path. - Confirm token stream prints to stdout and ends with
TK_EOF. - Confirm
Mepa.txtis generated/updated in the run directory.
- Prefer
Compiler/Tests/*.pasas parser fixtures; manyexamples/*.pasfiles use headers that do not match current parser expectation. - Comment support is incomplete; unknown characters can throw scanner exception (
Unhandled element scanned). Compiler/FrontEnd/Parser/ParserAux.csis legacy/commented-out content and not part of active compiler flow.