NatA Lang is a domain-specific programming language and educational compiler developed as part of the CST8152 - Compilers course at Algonquin College (Fall 2023). Created by Marcos Antonio Astudillo Carrasco and David Burchat, this language project is structured to explore the stages of compiler construction:
- ๐งพ Reader (Buffer) โ Handles file input and buffering
- ๐งช Scanner (Lexical Analyzer) โ Tokenizes source code into meaningful elements
- ๐ Parser (Syntax Analyzer) โ Validates structure using BNF-defined grammar
Inspired by Go and C-style languages, NatA emphasizes simplicity and educational clarity. Supported constructs include:
- ๐ฆ Variable declarations with types (
int,float64,string,byte) - ๐ Control structures:
if,else,for,while - ๐งฎ Arithmetic and logical operations
- ๐ค Output and ๐ฅ input commands
- ๐งฉ Functions with parameter and return type support
NatA_Lang/
โ
โโโ input/ # Sample .nat files for testing
โโโ Compilers.c/h # Shared definitions
โโโ Reader.c/h # Reader logic
โโโ MainReader.c # Reader test main
โโโ Scanner.c/h # Scanner logic (lexical analyzer)
โโโ MainScanner.c # Scanner test main
โโโ Parser.c/h # Parser logic (syntax analyzer)
โโโ MainParser.c # Parser test main
โโโ Runner.bat # Batch script for compilation/execution
โโโ CMakeLists.txt # CMake configuration
โโโ CMakePresets.json # CMake environment presets
- ๐ฅ๏ธ C Compiler (GCC or MSVC)
- ๐ ๏ธ CMake โฅ 3.20
- ๐ช Windows (preferred) or any POSIX-compliant OS
cd /path/to/NatA_Lang
cmake -S . -B build
cmake --build build- Place
.natfiles inbuild/directory - Run
Runner.bator manually run the compiled executable - Check output
.outand error.errfiles in the same directory
Available in input/:
INPUT0_Empty.natโ Verifies compiler response to an empty fileINPUT1_Hello.natโ Simple "Hello, World!" outputINPUT2_Volume.natโ Calculates sphere volume using expressionsINPUT3_Factorial.natโ Demonstrates recursion and loopsINPUT4_Datatypes.natโ Validates variable declarationsINPUT5_Big.natโ Comprehensive stress test of compiler capabilities
a11-language-proposal โ ๐
Sep 23, 2023
Initial language specification, keywords, syntax rules, datatypes, and test cases.
a12-reader-buffer โ ๐
Oct 8, 2023
Dynamic memory reader system built to handle secure and efficient file reading.
a21-language-model โ ๐
Oct 22, 2023
Defined REs, token classes, automata diagrams, and transition tables.
a22-scanner โ ๐
Nov 12, 2023
Tokenizer for source code, generating token streams and error outputs.
a31-bnf-grammar โ ๐
Nov 26, 2023
Created BNF rules for the language to support recursive-descent parsing.
a32-parser โ ๐
Dec 10, 2023
Parser validates syntax and handles structural errors.
- Marcos Antonio Astudillo Carrasco โ Lead Developer
- David Burchat โ Co-Developer
This project is for academic and educational use. No open-source license applies.
Email: m.astudillo1986@gmail.com