yacc grammar question

Mike McDonnell mike at ai.etl.army.mil
Mon Mar 19 21:33:49 AEST 1990


I am having trouble finding a yacc grammar for parsing a format string
of the form:
(A(3),5(I(2),3(A(4),6R(12))))
Where A is an ascii string, I is an integer, and R is a real number.

The problem is that I want to linearize this expression recursively by
expanding all the count fields so that, for example, 5I(3) becomes
I(3),I(3),I(3),I(3),I(3).

This is pretty easy to do at the innermost level.  My problem comes when
I have to consider nested counts like 6(A(4),7(I(5),6A(3))).  I hope this
is amenable to a recursive solution.  I'm looking forward to seeing some
elegant grammars since I know that some of you are wizards of this
stuff.
-- 
Mike McDonnell at the U.S. Army Engineer Topographic Laboratories, Bldg. 2592
Fort Belvoir, VA 22060-5546   TEL:(202)355-2716   NET: mike at etl.army.mil



More information about the Comp.unix.questions mailing list