The MINI-L language provides the following program constructs.
Here are some additional details of the MINI-L language.
Functions in MINI-L take some constant number of scalar arguments, and return a single scalar result. All arguments are passed by value (there are no reference arguments). A syntactically and semantically valid MINI-L program must contain a function named main, which takes no arguments and returns no result (the main function is unique in this regard).
The detailed syntax for the MINI-L language is described here. Since you will be designing your own custom programming language, your syntax will be different than the one provide in the syntax diagram. However, you may borrow ideas from this syntax diagram. The following table lists the precedence and associativity of all the operators in the MINI-L languages. Operators are listed top to bottom, in descending precedence.
Precedence | Operator | Description | Associativity |
---|---|---|---|
0 | () |
Function calls | Left-to-right |
1 | [] |
Array subscripting | Left-to-right |
2 | - |
Unary minus | Right-to-left |
3 | * |
Multiplication | Left-to-right |
/ |
Division | ||
% |
Remainder | ||
4 | + |
Addition | |
- |
Subtraction | ||
5 | < |
For relational operators < | |
<= |
For relational operators <= | ||
> |
For relational operators > | ||
>= |
For relational operators >= | ||
== |
For relational operator == | ||
<> |
For relational operator != | ||
6 | not |
Logical not | Right-to-left |
7 | := |
Assignment | Right-to-left |