[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Jumps and yyin
From: |
Anthony DeRobertis |
Subject: |
Re: Jumps and yyin |
Date: |
05 Jun 2002 00:26:54 -0400 |
On Tue, 2002-06-04 at 23:41, Bruno Ribeiro wrote:
> Hello!
>
> I'm trying to implement jump operation, like GOTO, on my visual basic
> interpreter. What I have done was index all the line numbers as file
> positions.
Don't do that! Instead, build a parse tree of some sort.
file --> LEXICAL ANALYZER --> tokens --> PARSER --> tree --> INTERPRETER
This will give you a much easier and cleaner implementation, and it'll
even run faster. See just about any book on compilers or interpreters
for more; look up, e.g., "abstract syntax tree."
[ As for your yyin stuff, bison and flex do a fair amount of buffering.
You'll have to flush all the buffers after doing that seek. Don't
remember off hand how to do that, but I think its in the manual. ]
signature.asc
Description: This is a digitally signed message part