diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2015-12-17 13:44:50 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2015-12-17 13:44:50 -0200 |
| commit | 19770b03a9faa8e2e0bf573a9417db5bfba1eac9 (patch) | |
| tree | 1c2b2e499441b97e5f8dea0cdc359ecd346b4b14 | |
| parent | a01eba657e3146f85b516a1c05c2009c626483cc (diff) | |
| download | lua-19770b03a9faa8e2e0bf573a9417db5bfba1eac9.tar.gz lua-19770b03a9faa8e2e0bf573a9417db5bfba1eac9.tar.bz2 lua-19770b03a9faa8e2e0bf573a9417db5bfba1eac9.zip | |
comments. (More explanation about kinds of expressions.)
Diffstat (limited to '')
| -rw-r--r-- | lparser.h | 44 |
1 files changed, 27 insertions, 17 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lparser.h,v 1.73 2014/06/19 18:27:20 roberto Exp roberto $ | 2 | ** $Id: lparser.h,v 1.74 2014/10/25 11:50:46 roberto Exp roberto $ |
| 3 | ** Lua Parser | 3 | ** Lua Parser |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -13,25 +13,35 @@ | |||
| 13 | 13 | ||
| 14 | 14 | ||
| 15 | /* | 15 | /* |
| 16 | ** Expression descriptor | 16 | ** Expression descriptor. |
| 17 | ** Code generation for expressions can be delayed to allow | ||
| 18 | ** optimizations; An 'expdesc' structure describes a | ||
| 19 | ** potentially-delayed expression. | ||
| 17 | */ | 20 | */ |
| 18 | 21 | ||
| 22 | /* kinds of expressions */ | ||
| 19 | typedef enum { | 23 | typedef enum { |
| 20 | VVOID, /* no value */ | 24 | VVOID, /* expression has no value */ |
| 21 | VNIL, | 25 | VNIL, /* constant nil */ |
| 22 | VTRUE, | 26 | VTRUE, /* constant true */ |
| 23 | VFALSE, | 27 | VFALSE, /* constant false */ |
| 24 | VK, /* info = index of constant in 'k' */ | 28 | VK, /* constant in 'k'; info = index of constant in 'k' */ |
| 25 | VKFLT, /* nval = numerical float value */ | 29 | VKFLT, /* floating constant; nval = numerical float value */ |
| 26 | VKINT, /* nval = numerical integer value */ | 30 | VKINT, /* integer constant; nval = numerical integer value */ |
| 27 | VNONRELOC, /* info = result register */ | 31 | VNONRELOC, /* expression has its value in a fixed register; |
| 28 | VLOCAL, /* info = local register */ | 32 | info = result register */ |
| 29 | VUPVAL, /* info = index of upvalue in 'upvalues' */ | 33 | VLOCAL, /* local variable; info = local register */ |
| 30 | VINDEXED, /* t = table register/upvalue; idx = index R/K */ | 34 | VUPVAL, /* upvalue; info = index of upvalue in 'upvalues' */ |
| 31 | VJMP, /* info = instruction pc */ | 35 | VINDEXED, /* indexed expression; |
| 32 | VRELOCABLE, /* info = instruction pc */ | 36 | ind.vt = whether 't' is register or upvalue; |
| 33 | VCALL, /* info = instruction pc */ | 37 | ind.t = table register or upvalue; |
| 34 | VVARARG /* info = instruction pc */ | 38 | ind.idx = index as R/K */ |
| 39 | VJMP, /* expression is a test/comparison; | ||
| 40 | info = pc of corresponding jump instruction */ | ||
| 41 | VRELOCABLE, /* expression can put result in any register; | ||
| 42 | info = instruction pc */ | ||
| 43 | VCALL, /* expression is a function call; info = instruction pc */ | ||
| 44 | VVARARG /* vararg expression; info = instruction pc */ | ||
| 35 | } expkind; | 45 | } expkind; |
| 36 | 46 | ||
| 37 | 47 | ||
