Related articles |
---|
Anyone have generic sed-like filter setup for yacc and lex? rsw@cs.brown.EDU (1991-08-28) |
Newsgroups: | comp.unix.programmer,comp.compilers |
From: | rsw@cs.brown.EDU (Bob Weiner) |
Keywords: | translator, parse, question |
Organization: | Brown U. |
Date: | 28 Aug 91 07:30:17 GMT |
I've programmed on UNIX for years and this is something I've wanted for
a long time but never found. Very often I have a lex scanner and a Yacc
grammar. I need to take valid grammar inputs and essentially stream
filter them, transforming certain constructs, or outputing only a small
part of the input that matches to particular constructs. The filtering
is too complex for sed and I want compiled performance and so don't wish
to use awk or perl.
Unfortunately, yacc provides no real support for stream filtering, yet
the problem fits well into a framework that could use yacc and lex as a
base, where one builds up a parse tree that includes the input tokens
from lex and then calls a single function within Yacc rules to output
the entire portion of the input stream that matches one of the current
production symbols, whether terminal or non-terminal. It doesn't seem
like a very hard problem, but I've never taken the time to build such a
thing and would rather not reinvent a wheel.
If anyone can provide me with or point me to such a set up I would be
quite appreciative. Please reply directly as I don't commonly read
these groups.
Bob
--
Bob Weiner rsw@cs.brown.edu
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.