Related articles |
---|
Basic Yacc Question mbbad@s-crim1.daresbury.ac.uk (1995-04-05) |
Re: Basic Yacc Question salomon@silver.cs.umanitoba.ca (1995-04-14) |
Re: Basic Yacc Question ct7@datatel.com (1995-04-20) |
Newsgroups: | comp.compilers |
From: | salomon@silver.cs.umanitoba.ca (Daniel J. Salomon) |
Keywords: | yacc, design |
Organization: | Computer Science, University of Manitoba, Winnipeg, Canada |
References: | 95-04-069 |
Date: | Fri, 14 Apr 1995 17:26:56 GMT |
mbbad@s-crim1.daresbury.ac.uk (I. Badcoe) writes:
> Basically I picked up the Gnu-Bison documentation and started to read
> through it with a view to creating a pre-processor. Everything is (nearly)
> clear to be *except* if (as in this case) you're writting an interpretter
> instead of a compiler, how do you implement a definite-loop ? Several
One option is to write a function that tells the scanner where in the source
to scan next. Before you start parsing, initialize the scanner to the start
of the source program. When your parser want to repeat a section it calls
the scanner location function to reset the current scanner location.
You will have to make a prepass over the source to discover the location
of labels that have not yet been encountered by the parser.
--
Daniel J. Salomon -- salomon@cs.UManitoba.CA
Dept. of Computer Science / University of Manitoba
Winnipeg, Manitoba, Canada R3T 2N2 / (204) 474-8687
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.