Related articles |
---|
Dynamic change of state table during runtime euahjn@uab.ericsson.se (Henrik Johansson) (1996-09-15) |
Re: Dynamic change of state table during runtime Norman.Culver.ndc@icanect.net (1996-09-16) |
From: | Henrik Johansson <euahjn@uab.ericsson.se> |
Newsgroups: | comp.compilers |
Date: | 15 Sep 1996 01:03:56 -0400 |
Organization: | Ericsson AXE Research and Development |
Keywords: | parse, question |
I have a somewhat odd parser project going on where I need to load the
state tables in the parser and scanner during runtime. Imagine the
YACC program and add a function that can save something like the
"y.output" on files during design time, and then load one of them from
file, including action symbols, during runtime. The different grammars
(thousands!) looks similar, but could not be loaded in the parser all
at the same time due to a lot of reasons.
The current approach is to write parser and scanner tools from
scratch using the theorys found in "Crafting a Compiler with C" by
Fischer and LeBlanc: The LR(1) algorithm, finite automaton for regular
expressions and so on. The action routines normally written as C code
between { } are limited to predefined ones that are distingiushed by
names. The finite automata are not executed directly, but stored on
files until the proper one is loaded and executed during runtime. I
believe in this approach, but maybe alternatives exist?
YACC and LEX cannot be used simply because they will have to be
compiled and linked a lot of times during runtime, which will be too
slow and cumbersome. They are currently used until a more effective
solution is implemented and the number of different grammars are
currently only 6. To handle thousands of executable precompiled
parsers, one for each file, is not a good idea either.
Is there any experience on dynamically loaded state tables out there?
Are there any freeware or commercial products available that adds
dynamic loading to YACC and LEX?
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.