Hi David (and others),
I went to add this question and David's answer into the doc today,
and discovered the egregious exclusion of any doc about the
In fact, there is no chapter anywhere on the back-end support
routines needed to complete a parser. I thought I'd add one, but am
not sure if this goes with the theme of David's recent
grammar-fw.texi file, or in the lang-dev-guide.
The doc is still a bit confusing to me with all the various
directions it attempts to go in. :(
Any thoughts on where this grammar lisp support doc would go?
>>> David PONCE <david.ponce@...> seems to think that:
>>>The assumption was that a give call into the parser would then return
>>>only one tag.
>>>>datatype : id theoryformals_opt COLON datatype_or_codatatype with_subtypes_ids_opt
>>>> END id
>>>> (TYPE-TAG $1 $4 (append $7 $8 $9) nil)
>>>> (when $2
>>>> (FUNCTION-TAG $1 $1 $2))
>>>> (TAG $1 'datatype (append $7 $8 $9)))
>>>>Any ideas on how to handle this problem?
>>> [ ... ]
>>>I think I would return a tag of a new class. Give it a name specific
>>>to your language.
>>>Then implement a function for `semantic-tag-expand-function'. When
>>>it sees a tag of that new class, it will replace it with two or more
>> Must (sub)functions of -expand-tag be written for all non-core
>> semantics tags, or only ones that are returned by %start denoted
>Every tag returned on parser iterations, or explicitly expanded via
>the EXPANDTAG grammar macro, are filtered by the
>`semantic-tag-expand-function' which is responsible to expand it or
>not based on its class or other criteria.
>In a WY grammar, you typically use EXPANDTAG on nested rules not
>associated with a %start symbol (this is explained in the wisent.info
>In your case I can imagine something like this:
>datatype : id theoryformals_opt COLON datatype_or_codatatype with_subtypes_ids_opt
> END id
> (TAG "custom" 'my-tag-class :value
> (TYPE-TAG $1 $4 (append $7 $8 $9) nil)
> (when $2
> (FUNCTION-TAG $1 $1 $2))
> (TAG $1 'datatype (append $7 $8 $9))))
>The `semantic-tag-expand-function' could look like this:
>(defun my-tag-expand (tag)
> (when (semantic-tag-of-class-p tag 'my-tag-class)
> (remq nil
> (semantic-tag-get-attribute tag :value))))
>So the "custom" tag will be replaced by two or three tags depending
>on the value of the :value attribute.
>> I've been updating the docs a bit in my local sandbox, fixing typos,
>> spelling errors, grammar, and clarifying issues. Shall I send a diff
>> eventually to someone?
>Please do. Thanks!
>SF.Net is sponsored by: Speed Start Your Linux Apps Now.
>Build and deploy apps & Web services for Linux with
>a free DVD software kit from IBM. Click Now!
>cedet-semantic mailing list