|
- ; parser.inc - parser tables and limits (E03-S01..E03-S04).
-
- .ifndef PARSER_INC
- PARSER_INC = 1
-
- ; Top-level type kinds (type table column C_TYPE_KIND)
- TYPE_NONE = 0
- TYPE_INTERFACE = 1
- TYPE_CLASS = 2
- TYPE_PROGRAM = 3
-
- PARSE_MAX_DEPTH = 16 ; nested method/program/if/while/for blocks
- EX_MAX_DEPTH = 16 ; expression levels: parse_expr calls + unary ops
-
- ; What a postfix expression ends in (statement checks)
- EX_OTHER = 0 ; literal, self, new, (group), operator result
- EX_PLACE = 1 ; name, field, or element: assignable
- EX_CALL = 2 ; method call: a statement by itself
-
- ; Test trace bytes (parser ex_trace_on): operand = its column (1-80)
- TR_BINARY = $80 ; + operator token kind ($80-$DF)
- TR_NEG = $F0 ; unary -
- TR_NOT = $F1 ; unary not
- TR_LINE = $FF ; statement start, then line lo/hi
-
- ; A type is base, name, length (E03-S04, types.s). Declared types use the
- ; first four bytes; an expression's type adds a constant's value and sign.
- ; base TY_*
- ; name class/interface name ID when base = TY_REF, else 0
- ; length array length (2 bytes); 0 = not an array
- ; value TY_CONST only: magnitude 0..65535 (2 bytes)
- ; neg TY_CONST only: 1 = negative (magnitude 1..32768)
- TY_NONE = 0 ; declared: no result; expression: unknown
- TY_BOOLEAN = 1 ; (an error was already reported: no checks)
- TY_BYTE = 2
- TY_CHAR = 3
- TY_INTEGER = 4
- TY_WORD = 5
- TY_REF = 6
- TY_NULL = 7 ; expressions only: the null literal
- TY_STRING = 8 ; a string literal (print only)
- TY_CONST = 9 ; a number literal or constant expression
- TY_VOID = 10 ; the result of a method without `as type`
- TV_SIZE = 7 ; bytes in a type value (sc_*, tt_*)
-
- ; Member flags
- MF_METHOD = $01 ; clear = field
- MF_PRIVATE = $02 ; clear = public
-
- MEMBERS_MAX = 255 ; rows 0..254, all classes and interfaces
- PARAMS_MAX = 255 ; rows 0..254, all method signatures
- IMPLS_MAX = 255 ; rows 0..254, all implements lists
-
- ; Bank-1 parser tables: 256-byte columns, consecutive from type_kind.
- ; tb_get/tb_set take A = column and Y = row (a name ID for type columns).
- C_TYPE_KIND = 0 ; TYPE_*
- C_TYPE_LINE_LO = 1 ; declaration line
- C_TYPE_LINE_HI = 2
- C_TYPE_MFIRST = 3 ; first member row
- C_TYPE_MCOUNT = 4 ; member rows (contiguous, declaration order)
- C_TYPE_IFIRST = 5 ; class: first implements row
- C_TYPE_ICOUNT = 6 ; class: implements rows (source order)
- C_TYPE_INIT = 7 ; class: init member row + 1, 0 = none
- C_MEM_OWNER = 8 ; owning class/interface name ID
- C_MEM_NAME = 9 ; member name ID
- C_MEM_FLAGS = 10 ; MF_*
- C_MEM_TBASE = 11 ; field type / method result type
- C_MEM_TNAME = 12
- C_MEM_TLEN_LO = 13
- C_MEM_TLEN_HI = 14
- C_MEM_PFIRST = 15 ; first parameter row
- C_MEM_PCOUNT = 16 ; parameter rows (declaration order)
- C_PAR_TBASE = 17 ; parameter type
- C_PAR_TNAME = 18
- C_PAR_TLEN_LO = 19
- C_PAR_TLEN_HI = 20
- C_IMPL_IFACE = 21 ; implemented interface name ID
- TABLE_COLUMNS = 22
- C_TYPE_LAST = C_TYPE_INIT ; type columns 0..this are cleared per run
-
- .endif
|