I made the assumption that equ values would only be used to store expressions, but they may hold more syntax.
Example from "vm5" by Michal Janeczek:
d01 equ spl 0,1
d02 equ spl 0,#1
d03 equ spl -1,1
d04 equ spl -1,#1
d05 equ spl 0,@1
d06 equ spl -1,@1
for 4
y for 6
for 4
for CURLINE<MAXLENGTH
d&y
rof
rof
rof
rof
Solution
Probably use preprocesser to make a first pass of the lex stream for equ tokens, then use those values to preprocess the token stream on a second run of the lexer.
[ ] create lexer interface
[ ] Extract tokens from file with lexer
[ ] Return new implementation that wraps lexer and substitutes tokens with patterns in-stream
[ ] Remove equ handling from compiler, leave FOR handling (for now)
Problem:
I made the assumption that equ values would only be used to store expressions, but they may hold more syntax.
Example from "vm5" by Michal Janeczek:
Solution
Probably use preprocesser to make a first pass of the lex stream for equ tokens, then use those values to preprocess the token stream on a second run of the lexer.