in reply to Clunky parsing problem, looking for simple solution
The second pass would peform the fixups.1800 IF V$="K" THEN GOTO {fixup:skip} 1800.1 GOTO {fixup:after-next-goto} 1800.2 A$="+K+" 1800.3 GOTO {fixup:end} 1800.4 IF V$="R" THEN GOTO {fixup:skip} 1800.5 GOTO {fixup:after-next-goto} 1800.6 A$="?R?" 1800.7 GOTO {fixup:end} 1800.8 IF V$="M" THEN GOTO {fixup:skip} 1800.9 GOTO {fixup:end} 1800.a A$="!M!" 1800.b Z1=R1 1800.c Z2=R2 1800.d REM
By using a {fixup:skip} fixup (rather than calculating the target line number as you're generating the sequence, you allow for the possibility of doing peephole optimizations. In the sequence above,
could be optimized to1800.8 IF V$="M" THEN GOTO {fixup:skip} 1800.9 GOTO {fixup:end} 1800.a
This "renumbers" lines within the sequence, but since target line number calculation/assignment has been deferred, not GOTOs are broken.1800.8 IF V$<>"M" THEN GOTO {fixup:end} 1800.9
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Clunky parsing problem, looking for simple solution
by clintp (Curate) on Jun 16, 2002 at 14:25 UTC | |
by orkysoft (Friar) on Jun 16, 2002 at 19:10 UTC |