Description
Description
The Funk's AST is composed of several logic nodes. Those nodes provide the boilerplate functions for the language to execute logic:
sequence: a list of following instructionsdefine: initialize a variable with a given typeassign: change a defined variable's valuereturn: instruction for a scope to return a given expressionif: conditional statement, can optionnaly have an else blockwhile: iterative statement, looping over a scope given a conditionbreak: instruction for a loop to get outcontinue: instruction for a loop to go to the next iteration
But it is also composes of node expressing values. As a function call, arithmetic or boolean operations and even array indexing:
call: a call to a defined functionindexing: dereference a pointer to an array with a given offsetint: a valid integer numberfloat: a valid floating numberarray: an array of a given size and typebinop: a binary operator, logic or arithmeticunop: a unary operatoridentifier: the name of a variable
Using theses nodes the Funk's AST is able to sequence the logic of a funk program giving it iterative logic with the use of while loops, conditional logic using if and functional logic using call and lambda.
Representation
Here is the representation of the generated AST for a recursive factorial function: