You have to initialize the variable yourself, e.g.

%type course_plot { std::vector<unsigned long>* } 

course_plot(V) ::= COURSE_PLOT_BEG course_plot_sector(A) .
        {
                V = new std::vector<unsigned long>;
                V->push_back(A);
        }
course_plot(V) ::= course_plot(L) COURSE_PLOT_GT course_plot_sector(A) .
        {
                V = L;
                V->push_back(A);
        }

And yes, I parse TradeWars 2002 with lemon.  /bow

Ron Wilson, Engineering Project Lead
(o) 434.455.6453, (m) 434.851.1612, www.harris.com

HARRIS CORPORATION   |   RF Communications Division     
assuredcommunications(tm)


> -----Original Message-----
> From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-
> boun...@sqlite.org] On Behalf Of Igmar Palsenberg
> Sent: Monday, February 22, 2010 7:39 AM
> To: sqlite-users@sqlite.org
> Subject: [sqlite] Questions regarding Lemon
> 
> 
> Hi,
> 
> After a decode or so I've begun to program in C again. I've writing a
> parser, and Lemon seems like the right tool for the job. SQLite itself
> is an excellent read when starting with lemon.
> However, a few questions remain unanswered :
> 
> - How do variables get initialized ? For example :
> 
> %type assigments { struct llist *}
> 
> assignments(A) ::= assignments assignment(B). { /* ..... */ }
> assignments(A) ::= assignment(B). {/* .... */ }
> 
> Can I assume that A, when the rule is executed the first time, is NULL ?
> 
> - What is the meaning of @ in an assignment ? From the sqlite parse.y
> source :
> 
> transtype(A) ::= DEFERRED(X).  {A = @X;}
> 
> Thanx in advance for all the hints :)
> 
> 
> Regards,
> 
> 
>      Igmar
> 
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to