From: joel de guzman (isis-tech_at_[hidden])
Date: 2001-05-28 00:37:20
> People often handle this problem by allowing different semantic actions to
> be embedded at various points in the RHS. In my opinion, that approach
> to complicate the RHS to an extent that undermines any simplicity gained
> the expression of grammar using EBNF. It also hugely complicates the
> of the meta-language. You're much better off sticking to strict
> BNF rules, since they tend to enforce a reasonable amount of
True, Semantic actions are fine to a certain extent but doesn't scale up.
end result is cluttered EBNF. As much as possible, I'd like to keep the
declarative nature of EBNF free from imperative statements. The simple
semantic action syntax in Spirit helps keep the source grammar clear and
> I think that Spirit would need to implement a similar approach, by
> an ast, and then allowing processing on the ast. For some grammars,
> having an ast in memory, it becomes difficult to process, if all you have
> are $1,$2, etc.
Yes. That is what I intend to do next. I think this is a logical extension
*separating the interface from the implementation*. The declarative EBNF
grammar is the interface and the code that works on the ASTs is the
Yet, trivial applications does not necessitate the need for ASTs. That's
the reason for the existence of simplified semantic Action(s) in Spirit.
Joel de Guzman
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk