Starxly is an interpreted mini programming language based on BASIC. It offers features to do arithmetic with integers and floats and has a simple grammar that defines the language.
- Simple syntax
- Supports floating point and integer numbers
- Additon:
1 + 2 = 3
- Subtraction:
1 - 2 = -1
- Multiplication:
1 * 2 = 2
- Division:
1 / 2 = 0.5
- Unary Operators:
-1 + 2 = 1
- Precedence Rules:
(9 * 8) - (-4 * 5) + 47 = 139
Starxly's grammar is composed of expressions. Expressions are composed of terms and factors. Terms are composed of factors. Factors are the most fundamental elements in Starxly's grammar. With expressions, terms and factors, we can define the starxly programming language in its entirety.
Concept | Pattern |
---|---|
expression | term ((PLUS|MINUS) term)* |
term | factor ((MUL|DIV) factor)* |
factor | INT|FLOAT (PLUS|MINUS) factor LPAREN expression RPAREN |