TinyCompiler is a simple compiler implementation written in C. It includes a lexer, parser, and interpreter for a basic programming language.
- Lexical analysis
- Parsing
- Abstract Syntax Tree (AST) generation
- Basic interpretation
- GCC or any C compiler
- Make (optional, for building using the provided Makefile)
-
Clone the repository:
git clone https://github.com/mustafa-khann/tiny-compiler.git cd tinycompiler
-
Compile the project:
make
Or manually:
gcc -o tinycompiler main.c lexer.c parser.c interpreter.c -I.
Run the compiler on a source file:
./tinycompiler script.tc
token.h
: Defines token types and structurelexer.h
/lexer.c
: Lexical analyzer implementationparser.h
/parser.c
: Parser implementationinterpreter.h
/interpreter.c
: Interpreter implementationmain.c
: Main program