This repository contains a compiler front-end prototype for a custom programming language called 'MPL', developed using ANTLR v4. This project is designed to practice custom language design, low-level programming concepts, and syntax parsing.
- Program Structure: Code blocks start with
beginand end withend. - Statements: Each command line must be terminated with a semicolon (
;). - Data Types: The system supports
int,float, andchardata types. - Variable Declaration: Variables are declared at the beginning of the program in the format
type: var1, var2;. Naming must start with a letter. - Operators and Expressions: Arithmetic (
+,-,*,/) and logical (&,|,>) operators are supported. Operator precedence is maintained in mathematical operations. - Control Flow: Supports conditional branching and nested checks using Fortran-style
IF,ELSE IF, andEND IFstructures.
- Environment: IntelliJ IDEA
- Parsing Tool: ANTLR v4
MPL.g4: The core ANTLR grammar file defining the lexer and parser rules of the language.Valid_Invalid_Programs.txt: A test suite validating the system's accuracy. It includes valid mathematical operations, nested conditional structures, and intentionally broken invalid scenarios (syntax errors, missing semicolons, undefined operators).