Re: Lexical feedback

pardo@cs.washington.edu (David Keppel)
Mon, 23 Oct 1995 21:07:29 GMT

          From comp.compilers

Related articles
Lexical feedback plong@perf.com (Paul Long) (1995-09-22)
Re: Lexical feedback mnp@compass-da.com (Mitchell Perilstein) (1995-09-29)
Re: Lexical feedback plong@perf.com (Paul Long) (1995-10-06)
Lexical feedback 75066.3204@CompuServe.COM (Carl Barron) (1995-10-21)
Re: Lexical feedback rich@rdp.introl.com (Richard Pennington) (1995-10-22)
Re: Lexical feedback pardo@cs.washington.edu (1995-10-23)
Re: Lexical feedback vern@daffy.ee.lbl.gov (1995-10-25)
| List of all articles for this month |

Newsgroups: comp.compilers
From: pardo@cs.washington.edu (David Keppel)
Keywords: parse, yacc, lex, comment
Organization: Computer Science & Engineering, U. of Washington, Seattle
References: 95-09-143 95-10-032 95-10-065
Date: Mon, 23 Oct 1995 21:07:29 GMT

>[Discussion: parser communicates current state when calls lexer?]


I believe -- but haven't used it for sure, so I won't promise -- that
the current version of `flex' supports a lexer with multiple entry
points. In effect, you get to define a set of cooperating lexers and
call the one that corresponds to the current parse context.


In principle, if not practice:


common definitions ...
entry1: definitions for one parser ...
entry2: definitions for a second parser ...


So, if you can embed parser context as a ``one of N'' kind of rule,
you should be able to use `flex' for the job.


This still doesn't solve the problem that John mentions, namely that
`yacc' may be reading a token ahead.


;-D on ( A token contribution ) Pardo
[I haven't seen a version of flex tha tdoes that, but it's easy to fake with
exclusive start states. -John]
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.