|
Boost : |
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
tends
> to complicate the RHS to an extent that undermines any simplicity gained
in
> the expression of grammar using EBNF. It also hugely complicates the
description
> of the meta-language. You're much better off sticking to strict
> BNF rules, since they tend to enforce a reasonable amount of
factorization.
-Dave
True, Semantic actions are fine to a certain extent but doesn't scale up.
The
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
concise.
> I think that Spirit would need to implement a similar approach, by
building
> an ast, and then allowing processing on the ast. For some grammars,
without
> having an ast in memory, it becomes difficult to process, if all you have
> are $1,$2, etc.
-Dan
Yes. That is what I intend to do next. I think this is a logical extension
of
*separating the interface from the implementation*. The declarative EBNF
grammar is the interface and the code that works on the ASTs is the
implementation.
Yet, trivial applications does not necessitate the need for ASTs. That's
the reason for the existence of simplified semantic Action(s) in Spirit.
Many thanks,
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