feat(v4): the ROM's symbol table
(FIND) ( -- rec | 0 ), (DEFINE) ( value kind -- ) and (OPCODE) ( -- op | -1 ), entries 3-5. Names are refused as text.c's define refuses them, compared case by case with text.c; a set variable may be set again. 256 hash heads, records growing up and names growing down in dictionary space, used only while the ROM assembles. text.c gains the data directives #, and ", (the ROM's language; its mnemonic and reserved-word tables are data); the nucleus image is byte-identical. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
080811dbd2
commit
07911dcf91
@@ -133,9 +133,32 @@
|
||||
#define ROM_NI (OUT_W - 72) /* the next character of the token */
|
||||
#define ROM_NU (OUT_W - 71) /* the value so far, unsigned */
|
||||
#define ROM_NBIG (OUT_W - 70) /* 1 once it has not fitted a cell */
|
||||
#define ROM_RECN (OUT_W - 128) /* (DEFINE): cells of symbol records used */
|
||||
#define ROM_POOLN (OUT_W - 127) /* cells of the name pool used */
|
||||
#define ROM_REC (OUT_W - 126) /* (FIND): the record being looked at */
|
||||
#define ROM_CNT (OUT_W - 125) /* (DEFINE): cells in the token's name */
|
||||
#define ROM_PTR (OUT_W - 124) /* (SAME?), (DEFINE): where in a name */
|
||||
#define ROM_I (OUT_W - 123) /* where in the token */
|
||||
#define ROM_WI (OUT_W - 122) /* (WALK): which entry of a table */
|
||||
/* THE ROM'S SYMBOL TABLE, used only while it assembles, in dictionary space (cleared at `start`): 256 hash heads,
|
||||
* then records growing up -- link, name, kind, value -- and names, as counted strings, growing down from the top. */
|
||||
#define ROM_SYMH DICT_W
|
||||
#define ROM_SYMREC (DICT_W + 256)
|
||||
#define ROM_POOLTOP DICT_END_W
|
||||
#define ROM_REC_LINK 0
|
||||
#define ROM_REC_NAME 1
|
||||
#define ROM_REC_KIND 2
|
||||
#define ROM_REC_VALUE 3
|
||||
#define ROM_KIND_WORD 1
|
||||
#define ROM_KIND_CONST 2
|
||||
#define ROM_KIND_MACRO 3
|
||||
#define ROM_KIND_SET 4
|
||||
/* the ROM's error codes */
|
||||
#define ROM_ERR_TOO_LONG 1 /* a token longer than 63 characters: "name too long" */
|
||||
#define ROM_ERR_COMMENT 2 /* a ( with no ) before the end: "comment not closed" */
|
||||
#define ROM_ERR_BAD_NAME 3 /* an opcode, a reserved word, a label, a number or &...: "cannot be used as a name" */
|
||||
#define ROM_ERR_DEFINED 4 /* "already defined" */
|
||||
#define ROM_ERR_NAMES 5 /* the symbol table is full: "too many names" */
|
||||
#define WORD_DEFINED (BUF0_W - 11) /* the xt of the word that is told of each new entry, or 0 */
|
||||
#define WORD_FORGOTTEN (BUF0_W - 12) /* the xt of the word that is told when entries go, or 0 */
|
||||
#define LOG_LEVEL (BUF0_W - 5) /* the level at or below which a message is printed */
|
||||
|
||||
Reference in New Issue
Block a user