Re: How to properly use VARIABLE-TAG
Eric Ludlam <[email protected]> Sat, 13 Feb 2016 08:19:47 -0500
| Newsgroups | gmane.emacs.semantic |
|---|---|
| Message-ID | <[email protected]> |
Hi Gracjan,
The grammars in Semantic are a little different than what you may be
used to in that the iteration between tags is declared outside the
grammar. The grammar is called and returns one tag, then the grammar is
called again starting at the next lexical symbol.
Thus your grammar would be just:
%token WORD
%start start
start : word
| next-tag-to-impl
;
word : WORD
(VARIABLE-TAG $1 nil nil)
;
next-tag-to-impl : ...
;
thus supporting many kinds of tags. Once all the tags are found, there
is a process that will split compound tags apart, which is useful for
languages that can declare multiple things in one statement, such as
this in C:
int a, b;
Good Luck
Eric
On 02/12/2016 03:33 PM, Gracjan Polak wrote:
> Hi all,
>
> I try to get around Wisent/Semantic and I'm playing with toy languages
> at this point. Issue I'm stuck with is how to mark multiple variable
> declarations.
>
> My toy language has only WORD terminal and all terminals should get
> VARIABLE-TAG. I tried this:
>
> %token WORD
> %start words
>
> words : word
> | words word
> (append $1 (list $2))
> ;
>
> word : WORD
> (VARIABLE-TAG $1 nil nil)
> ;
>
> The above seems to mark only first word as variable. How to properly use
> VARIABLE-TAG so that all word as marked as variables?
>
> --
> Gracjan
>
>
> ------------------------------------------------------------------------------
> Site24x7 APM Insight: Get Deep Visibility into Application Performance
> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> Monitor end-to-end web transactions and take corrective actions now
> Troubleshoot faster and improve end-user experience. Signup Now!
> http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
>
>
>
> _______________________________________________
> cedet-semantic mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/cedet-semantic
>
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140