Folks,
I'm putting together a Pascal-like grammar and at the top level it's a
bunch of statements or declarations where statements _and_ declarations
are required to be terminated with a semicolon. The grammar below does
not work but I don't understand why as ultimately the semicolon is
present both in statements and in declarations.
(yacc:define-parser parser
(:start-symbol sections)
(:terminals (|;| :id1 :id2))
(sections
(sections section)
section)
(section statements
declarations)
(statements (statement |;|)
(statements statement |;|))
(statement ()
open-statement
closed-statement)
(declarations (declaration |;|)
(declarations declaration |;|))
(open-statement :id1)
(closed-statement :id2)
)
Thanks, Joel
Matt wrote:
> (sections (sections section)
> section
> ())
>
> (section statement |;|
> declaration |;|)
Well, I guess that's a little different than what you were doing.
You want a semicolon after a section, but this puts it after
every statement and declaration. Nevermind.
Matt