SpiderScript - Restructured to be able to keep bytecode and AST in memory at one...
[tpg/acess2.git] / Usermode / Libraries / libspiderscript.so_src / bytecode.h
1 /*
2  * SpiderScript
3  * - Bytecode definitions
4  */
5 #ifndef _BYTECODE_H_
6 #define _BYTECODE_H_
7
8 #include "bytecode_ops.h"
9
10 typedef struct sBC_Op   tBC_Op;
11 typedef struct sBC_Function     tBC_Function;
12
13 struct sBC_Op
14 {
15         tBC_Op  *Next;
16          int    Operation;
17          int    bUseInteger;    // Used for serialisation
18         union {
19                 struct {
20                         const char *String;
21                          int    Integer;
22                 } StringInt;
23                 
24                 uint64_t        Integer;
25                 double  Real;
26         } Content;
27 };
28
29 struct sBC_Function
30 {
31          int    LabelCount;
32          int    LabelSpace;
33         tBC_Op  **Labels;
34         
35          int    MaxVariableCount;
36         // NOTE: These fields are invalid after compilation
37          int    VariableCount;
38          int    VariableSpace;
39         const char      **VariableNames;
40          int    CurContextDepth;        // Used to get the real var count
41
42          int    OperationCount;
43         tBC_Op  *Operations;
44         tBC_Op  *OperationsEnd;
45 };
46
47 #endif

UCC git Repository :: git.ucc.asn.au