aboutsummaryrefslogtreecommitdiff
path: root/lparser.h
diff options
context:
space:
mode:
Diffstat (limited to 'lparser.h')
-rw-r--r--lparser.h28
1 files changed, 17 insertions, 11 deletions
diff --git a/lparser.h b/lparser.h
index a3568a6f..a64b8dda 100644
--- a/lparser.h
+++ b/lparser.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lparser.h,v 1.7 2000/03/03 12:33:59 roberto Exp roberto $ 2** $Id: lparser.h,v 1.8 2000/03/03 14:58:26 roberto Exp roberto $
3** LL(1) Parser and code generator for Lua 3** LL(1) Parser and code generator for Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -8,7 +8,6 @@
8#define lparser_h 8#define lparser_h
9 9
10#include "lobject.h" 10#include "lobject.h"
11#include "lopcodes.h"
12#include "lzio.h" 11#include "lzio.h"
13 12
14 13
@@ -42,21 +41,18 @@
42#endif 41#endif
43 42
44 43
45#if MAXLOCALS>MAXARG_U || MAXUPVALUES>MAXARG_B || MAXVARSLH>MAXARG_B || \
46 MAXPARAMS>MAXLOCALS || MAXSTACK>MAXARG_A || LFIELDS_PER_FLUSH>MAXARG_B
47#error invalid limits
48#endif
49
50
51 44
52/* 45/*
53** Expression descriptor 46** Expression descriptor
54*/ 47*/
48
49#define NOJUMPS 0
50
55typedef enum { 51typedef enum {
56 VGLOBAL, /* info is constant index of global name */ 52 VGLOBAL, /* info is constant index of global name */
57 VLOCAL, /* info is stack index */ 53 VLOCAL, /* info is stack index */
58 VINDEXED, /* no info (table and index are on the stack) */ 54 VINDEXED, /* info is info of the index expression */
59 VEXP /* info is pc index of exp main operator */ 55 VEXP /* info is NOJUMPS if exp has no internal jumps */
60} expkind; 56} expkind;
61 57
62typedef struct expdesc { 58typedef struct expdesc {
@@ -65,12 +61,22 @@ typedef struct expdesc {
65} expdesc; 61} expdesc;
66 62
67 63
64/*
65** Expression List descriptor:
66** tells number of expressions in the list,
67** and gives the `info' of last expression.
68*/
69typedef struct listdesc {
70 int n;
71 int info; /* 0 if last expression has no internal jumps */
72} listdesc;
73
74
68/* state needed to generate code for a given function */ 75/* state needed to generate code for a given function */
69typedef struct FuncState { 76typedef struct FuncState {
70 TProtoFunc *f; /* current function header */ 77 TProtoFunc *f; /* current function header */
71 struct FuncState *prev; /* enclosing function */ 78 struct FuncState *prev; /* enclosing function */
72 int pc; /* next position to code */ 79 int pc; /* next position to code */
73 int last_pc; /* last instruction coded (for optimizations) */
74 int stacksize; /* number of values on activation register */ 80 int stacksize; /* number of values on activation register */
75 int nlocalvar; /* number of active local variables */ 81 int nlocalvar; /* number of active local variables */
76 int nupvalues; /* number of upvalues */ 82 int nupvalues; /* number of upvalues */