Skip to content

alynakbl/MPL-Syntax-Analyzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

MPL - Lexical & Syntax Analyzer

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.

Language Features & Rules

  • Program Structure: Code blocks start with begin and end with end.
  • Statements: Each command line must be terminated with a semicolon (;).
  • Data Types: The system supports int, float, and char data 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, and END IF structures.

Development Stack

  • Environment: IntelliJ IDEA
  • Parsing Tool: ANTLR v4

Project Contents

  • 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).

About

A compiler front-end prototype and syntax analyzer for a custom programming language (MPL), built with ANTLR v4.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages