|YACC parser & conditional compilation directives email@example.com (Vadim) (1995-06-23)|
|Re: YACC parser & conditional compilation directives johnm@soda.CSUA.Berkeley.EDU (1995-06-27)|
|Re: YACC parser & conditional compilation directives firstname.lastname@example.org (1995-06-27)|
|Re: YACC parser & conditional compilation directives email@example.com (Scott Nicol) (1995-07-05)|
|Keywords:||yacc, question, comment|
|Organization:||University of Wales College of Cardiff, Cardiff, WALES, UK.|
|Date:||Fri, 23 Jun 1995 03:45:34 GMT|
I'm writing a kind of assembler translator, the grammar is perfectly
suitable for Yacc, but my problem is the conditional compilation
directives. For example, in the following source first and third
sections must be bypassed:
... Do one thing ...
... Do another thing
... Do yet another thing
(All directives start with dot)
Of course, I could use some kind of hack in lexer, that would recognize
IFs, .ELSEs, .ENDIFs etc. and act accordindly, but I want to know
if there is a _nice_ way of skipping the conditioned out source ?
Besides, the conditional expression may be quite complex and I would have
problems with its parsing, had I used the hack.
[Yacc doesn't handle this kind of two-level grammar at all well. You need
either a two-pass system or some gross lexical hacks. -John]
Return to the
Search the comp.compilers archives again.