comparison src/interp.s @ 126:ac183a519439

Update parsing scheme with a keyword lookup by token value and other framework Add ability to turn a token code into a keyword string. Also correct some details related to token table generation with some additiona adjustments for token symbols. Also rework token symbol definitions and creation of some parsing tables as well as the main statement parsing loop.
author William Astle <lost@l-w.ca>
date Mon, 08 Jan 2024 22:58:08 -0700
parents eb2681108660
children 9d57279c900e
comparison
equal deleted inserted replaced
125:0607e4e20702 126:ac183a519439
67 ldx #prompt ; point to prompt string 67 ldx #prompt ; point to prompt string
68 jsr console_outstrn 68 jsr console_outstrn
69 immediate0 jsr readline ; read input line 69 immediate0 jsr readline ; read input line
70 bcs immediate0 ; brif ended with BREAK 70 bcs immediate0 ; brif ended with BREAK
71 ldx #linebuff ; point to start of line input buffer 71 ldx #linebuff ; point to start of line input buffer
72 stx inputptr ; set input pointer 72 immediate0a lda ,x ; do we have anything at all?
73 jsr curchar ; skip spaces and set flags 73 beq immediate0 ; brif not - just read another line
74 bcs immediate1 ; brif there's a line number 74 cmpa #0x20 ; space?
75 tsta ; is there anything there at all (end of line)? 75 bne immediate0c ; brif not
76 beq immediate0 ; brif not - read another line 76 immediate0b leax 1,x ; move past the
77 ldx inputptr ; get the modified input pointer processing above 77 bra immediate0a ; keep looking for the start of input
78 jsr tokenize ; tokenize the line at inputptr, return with result at tokebuff and X 78 immediate0c bsr setcifdigit ; do we have a line number?
79 bcs immediate1 ; brif so - go handle program editing
80 clrb ; flag to do actual parsing
81 jsr parse ; go parse the line
82 bra *
79 jsr interpretline ; go interpret the tokenized line 83 jsr interpretline ; go interpret the tokenized line
80 bra immediate ; go handle another line 84 bra immediate ; go handle another line
81 immediate1 bsr parse_lineno ; parse the line number 85 immediate1 bsr parse_lineno ; parse the line number
82 bsr prog_findline ; go see if the line is in the program 86 bsr prog_findline ; go see if the line is in the program
83 bne immediate3 ; brif not - no need to delete it 87 bne immediate3 ; brif not - no need to delete it