mkdir build
cd build
cmake ..
cmake --build.
cd ..
make clean
make SRC_FILE=<testcases/test.tig> OUTPUT=<test>
./test.tigex
- while, for, to, break, let, in, end, function, var, type, array, if, then, else, do, of, nil
- , : ; + - * / ( ) [ ] { } = < > & | .
- =, <>, <, <=, >, >=, &, |, :=
- Name Type
- Record Type
- Example:
let type student = {name: string, age: int} in var lannds: student := student{name = "LANNDS Z", age = 21} end
- Example:
- Array Type
- Example:
let type intArray = array of int in var arr: intArray := intArray [10] of 0 end
- Example:
- Simple Variable (
A_SimpleVar
) - Field Variable (
A_FieldVar
) : Function argument, - Subscript Variable (
A_SubscriptVar
): An element within an array
- Function (
A_functionDec
)- Example:
function initMatrix(mat : matrix, row : int, col : int) = for i := 0 to row-1 do mat[i] := vector[col] of 0
- Example:
- Addition:
+
- Subtraction:
-
- Multiplication:
*
- Division:
/
- Equal to:
=
- Not equal to:
<>
- Less than:
<
- Less than or equal to:
<=
- Greater than:
>
- Greater than or equal to:
>=
- Variable Expression (
A_varExp
)::=
- Nil Expression (
A_nilExp
):
type person = {name: string, age: int}
var unknownPerson: person := nil
- Integer Literal (
A_intExp
):10
,-1
,0
, ... - String Literal (
A_stringExp
):
let
var hello: string := "Hello, World!"
in
...
end
- Function Call (
A_callExp
)