comp.lang.ada
 help / color / mirror / Atom feed
From: Charly <carl.weierstrass@googlemail.com>
Subject: question about the usage of opentoken-4.0b
Date: Tue, 24 Apr 2012 12:01:18 -0700 (PDT)
Date: 2012-04-24T12:01:18-07:00	[thread overview]
Message-ID: <10328658.73.1335294078629.JavaMail.geo-discussion-forums@vber6> (raw)

Hi,

I have a question about the usage of opentoken-4.0b, a scanner/parser-library written in Ada.
So my question isn't about the language Ada itself but only about this library.

I define a Grammar starting with 

   Grammar : constant Production_List.Instance :=
     Prog      <= Def_List & EOF                                                + Program_Token.Create     and
     Def_List  <= Def_List & Ent                                                + Element_List.Concat      and
     Def_List  <= Ent                                                           + Element_List.Create      and
     Ent       <= Entity_Key & Ident & Colon & El_List & End_Key & Semicolon    + Entity_Token.Create      and
...

and I create and call the parser with 

   Text_Parser := LALR_Parser.Generate (Grammar, Analyzer, False);

   LALR_Parser.Parse (Text_Parser);

It works fine, but to use the result of the parsing, which happens to be the start element
'Prog' of the above Grammar, I had to store it in an global variable,
as one of the actions of the procedure 'Program_Token.Create'.
But I would like to avoid this, because I don't like global variables;

The variable 'Prog' in the Grammar definition has the right type, but does not contain any data, as I expected.

Any help would be appreciated.

Sincerely

Charly




             reply	other threads:[~2012-04-24 19:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-24 19:01 Charly [this message]
2012-04-25 12:03 ` question about the usage of opentoken-4.0b Stephen Leake
2012-04-25 19:27   ` Charly
2012-04-25 12:58 ` Marc C
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox