aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/LuaSL/src/LuaSL_LSL_tree.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--LuaSL/src/LuaSL_LSL_tree.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/LuaSL/src/LuaSL_LSL_tree.h b/LuaSL/src/LuaSL_LSL_tree.h
new file mode 100644
index 0000000..6d89672
--- /dev/null
+++ b/LuaSL/src/LuaSL_LSL_tree.h
@@ -0,0 +1,55 @@
1/*
2 * Definition of the structure used to build the abstract syntax tree.
3 */
4#ifndef __EXPRESSION_H__
5#define __EXPRESSION_H__
6
7/**
8 * @brief The operation type
9 */
10typedef enum tagEOperationType
11{
12 eVALUE,
13 eMULTIPLY,
14 ePLUS
15}EOperationType;
16
17/**
18 * @brief The expression structure
19 */
20typedef struct tagSExpression
21{
22 EOperationType type;///< type of operation
23
24 int value;///< valid only when type is eVALUE
25 struct tagSExpression* left; ///< left side of the tree
26 struct tagSExpression* right;///< right side of the tree
27}SExpression;
28
29/**
30 * @brief It creates an identifier
31 * @param value The number value
32 * @return The expression or NULL in case of no memory
33 */
34SExpression* createNumber(int value);
35
36/**
37 * @brief It creates an operation
38 * @param type The operation type
39 * @param left The left operand
40 * @param right The right operand
41 * @return The expression or NULL in case of no memory
42 */
43SExpression* createOperation(
44 EOperationType type,
45 SExpression *left,
46 SExpression *right);
47
48/**
49 * @brief Deletes a expression
50 * @param b The expression
51 */
52void deleteExpression(SExpression *b);
53
54#endif // __EXPRESSION_H__
55