On 01/29/2013 04:10 AM, kototama kototama wrote:
> Erik wrote on this list that it would be too slow to have a full
> parser within semantic ; so I'm developing only what is needed to
Just to clarify, full parsers with wisent aren't too bad on modern
machines, but tagging parsers are faster. Since full parsing usually
involves no benefit to the existing tools, it is best to just do a
> parse functions and packages definitions. However, in a few cases, I
> would like to fully parse some definitions, like the definition of the
> project, which can be arbitrary Clojure code.
> The first rule of my grammar is of the type
> sexpr | PAREN_BLOCK
> | STRING
> but does not contain the full definition of what is an s-expression in Clojure.
> Would it make sense to have a sexpr_full rule which would be "invoked"
> when I need to do a full parser within the grammar?
> Also, if I need to parse some code with Emacs Lisp code, how could I
> invoke parsing with the sexpr_full and not the top rule?
> What I mean by full parsing is a parsing of all element and the
> construction of an AST, not the generation of tags.
If you have two rules, both sexpr, and sexpr_full, then you would just
choose which you want depending on context. sexpr_full would probably
recurse on itself, where sexpr probably would not need recurse at all.
It might also be that sexpr_full is plenty fast for your needs and you
don't need to worry about it.