]> git.bts.cx Git - sun.git/blob - runtime/src/sun/tree/node.h
do not evaluate variables until they are used
[sun.git] / runtime / src / sun / tree / node.h
1 #ifndef SUN_TREE_NODE_H
2 #define SUN_TREE_NODE_H
3
4 #include <sun/tree/operator_type.h>
5 #include <stdbool.h>
6
7 #ifdef __cplusplus
8 extern "C" {
9 #endif
10
11 typedef struct SLTNode SLTNode;
12
13 extern const char *sltNodeToString(SLTNode *node);
14
15 extern SLTNode *sltNodeMakeIdentifier(const char *name);
16
17 extern SLTNode *sltNodeMakeBoolean(bool value);
18 extern SLTNode *sltNodeMakeInteger(int value);
19 extern SLTNode *sltNodeMakeRawInteger(int value);
20 extern SLTNode *sltNodeMakeFloat(float value);
21 extern SLTNode *sltNodeMakeString(const char *value);
22 extern SLTNode *sltNodeMakeKey(const char *value);
23
24 extern SLTNode *sltNodeMakeCompound(SLTNode *expression);
25
26 extern SLTNode *sltNodeMakeArgument(SLTNode *expression);
27
28 extern SLTNode *sltNodeMakeArrayAccess(SLTNode *array, SLTNode *access);
29 extern SLTNode *sltNodeMakeTypeAccess(SLTNode *type, SLTNode *access);
30
31 extern SLTNode *sltNodeMakeFunctionCall(SLTNode *function, SLTNode *arguments);
32
33 extern SLTNode *sltNodeMakeUnaryOperation(SLTNode *op, SLTNode *operand);
34 extern SLTNode *sltNodeMakeBinaryOperation(SLTNode *op, SLTNode *lhs, SLTNode *rhs);
35
36 extern SLTNode *sltNodeMakeOperator(SLTOperatorType type);
37
38 extern SLTNode *sltNodeMakeAssignment(SLTNode *target, SLTNode *source);
39
40 extern SLTNode *sltNodeMakeReturn(SLTNode *expression);
41 extern SLTNode *sltNodeMakeSleep(void);
42 extern SLTNode *sltNodeMakeBreak(void);
43
44 extern SLTNode *sltNodeMakeForIteration(SLTNode *initialExpression, SLTNode *preValidExpression, SLTNode *loopExpression, SLTNode *statement);
45 extern SLTNode *sltNodeMakeDoIteration(SLTNode *postValidExpression, SLTNode *statement);
46 extern SLTNode *sltNodeMakeWhileIteration(SLTNode *preValidExpression, SLTNode *statement);
47
48 extern SLTNode *sltNodeMakeSelection(SLTNode *validExpression, SLTNode *validStatement, SLTNode *invalidStatement);
49
50 extern SLTNode *sltNodeMakeStatementBlock(SLTNode *contents);
51
52 extern SLTNode *sltNodeMakeVariableDefinition(SLTNode *type, SLTNode *identifier, SLTNode *defaultExpression);
53
54 extern SLTNode *sltNodeMakeTypeDefinition(SLTNode *identifier, SLTNode *members);
55 extern SLTNode *sltNodeMakeTypeMemberDefinition(SLTNode *type, SLTNode *identifier);
56
57 extern SLTNode *sltNodeMakeFunctionDefinition(SLTNode *type, SLTNode *identifier, SLTNode *parameters, SLTNode *body);
58 extern SLTNode *sltNodeMakeFunctionParameterDefinition(SLTNode *type, SLTNode *identifier);
59
60 extern SLTNode *sltNodeMakeModule(SLTNode *statementsAndDefinitions);
61
62 extern SLTNode *sltNodeMakeSequence(SLTNode *head, SLTNode *item);
63
64 #ifdef __cplusplus
65 }
66 #endif
67
68 #endif