[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Calling a parser from a parser
From: |
Antoine Fink |
Subject: |
Calling a parser from a parser |
Date: |
Fri, 22 Oct 2004 16:33:16 -0400 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8a1) Gecko/20040520 |
Hi,
Is it possible with Bison/Yacc to parse a language using 2 parsers for
different sections ?
Example :
I have this language :
----------------------
LG[0] {
0 : abc : 1, 2;
1 : bcd : 3, 4, 5;
2 : x : 3;
3 : abc : 3, 4;
BB[x] {
a -> 1,2;
b -> 2,4;
c -> 3;
d -> ;
x -> 1,2,3,4,5;
}
4 : bc : 5;
5 : abc : 1,4,5;
};
----------------------
I would like to have lg_parser.y / lg_lexer.lex to parse all the lines
including colons (":") and use bb_parser.y / bb_parser.lex to parse all
the lines including arrows ("->").
How can I invoke yyparse from bb_parser when alreading in the middle of
parsing the same file with lb_parser, and then return to lb_parser to
read the remaining lines ? Say, the top level parsing function would
read "LG", and invoke lg_parser, and when lg_parser reads "BB", it would
have the following lines parsed by bb_parser up to next closing braket,
and return to lg_parser to parse the rest.
I've been playing around for a while, reading doc, and I can't figure if
this is even possible...
help anyone ?
thank you much !
--
antoine fink
software designer
IDT Canada LTD
address@hidden
- Calling a parser from a parser,
Antoine Fink <=