🧠 An experimental compiler built in C++17 implementing the full analysis chain: lexical, syntactic, and semantic, inspired by the C# language. This project showcases compiler construction knowledge with modern software engineering practices.
- ✅ Tokenization for
.cssource files - ✅ Recursive descent parser with modular AST
- ✅ Semantic analysis via Visitor Pattern
- ✅ Modular architecture with lexer, parser, and analyzer separation
- ✅ JFLAP integration for DFA visualization
using System;
class Program{
// exemplo de comentário
static void Main(string[] args){
Console.WriteLine("Hello, World!");
}
}| Tool | Minimum Version |
|---|---|
g++ |
7.0+ with C++17 support |
make |
Any |
java |
8+ (for JFLAP only) |
makeBinary: bin/cs++
make runRuns samples/hello.cs.
make clean.
├── docs/ # Documentation and grammar specs
├── include/ # C++ headers (lexer, parser, analyzer)
├── src/ # C++ implementations
├── samples/ # `.cs` test files
├── tools/jflap/ # JFLAP DFA visual tool
├── jflap/ # DFA diagrams (.jff, .png)
├── makefile
└── readme.md
make jflap
# or manually:
java -jar tools/jflap/jflap.jarAvailable in docs/:
cspp.pptx,cspp.docxgrammar/with BNF, regex, C# Microsoft grammar, and syntactic grammar
- Implements DFA manually (
src/lexer.cpp) - Token definitions in
token.h - Verified with JFLAP
- Recursive descent parser (
src/parser.cpp) - AST modules:
node,expression,statement
- Visitor pattern-based semantic analysis (
src/analyzer.cpp) - Validates types, scopes, and declarations
Developed for educational purposes for the Compilers course.
Kélsio Mateus
Purpose-led software engineer passionate about compilers
"A compiler is the engineer of the bridge between logic and machine." — ✨