Compilateur
ANTLR4 compiler for translating expressions into MVaP code, with advanced rational and Boolean operations.
ANTRLMVAP
Alexis
Features
Management of operations on rationals: addition, multiplication, division, subtraction, power.
Rational simplification and rounding management (e.g.: sim, [-], %).
Integer operations: lcm, gcd.
Variable declarations (integer, Boolean, rational).
Variable assignment and reassignment.
Rational expression display.
Condition and loop management.
Boolean expressions with lazy evaluation.
Source language
The language used in this project is a rationals language, with three types of expressions:
Integers: relative numbers that can be positive or negative.
Rationals: numbers in the form a/b, where a is the numerator and b the denominator.
Booleans: Boolean values for conditions and loops.
Syntax
Operations on rationals: addition (+), subtraction (-), multiplication (*), division (:), power (**), simplification (sim), rounding ([-]), percentage (%).
Instructions :
Assignments (=),
Display regular expressions with afficher(exprR),
Conditional instructions (? :),
Loops (repeat ... until).
Project structure
The main file is Rationnel.g4, written in ANTLR4. This file contains :
Rational language grammar.
Java methods required for compiler operation.