Loading ...
Sorry, an error occurred while loading the content.

Re: [antlr-interest] Tree structure

Expand Messages
  • Anakreon
    ... This is a problem I have faced many times. The workaround for this is: int intType = INT; #priVal = #([intType, -15 ]); If this behaver is a feature of
    Message 1 of 8 , Sep 30, 2004
    • 0 Attachment
      > priVal! : INT
      >
      > {
      >
      > #priVal = #([INT,"-15"]);
      This is a problem I have faced many times.
      The workaround for this is:
      int intType = INT;
      #priVal = #([intType, "-15"]);

      If this behaver is a feature of Antlr, I wish it's removed.
      Anakreon
    • Bryan Ewbank
      I think the problem here is that the tree is not constructed (because of the ! following priVal). Therefore, INT is not recognized as special in the
      Message 2 of 8 , Oct 1, 2004
      • 0 Attachment
        I think the problem here is that the tree is not constructed (because of the
        "!" following priVal). Therefore, INT is
        not recognized as "special" in the context of tree-building directives #(
        ... ). Try removing the "!" after "priVal",
        as well as prefixing "[INT ...]" with another "#", and it should work.

        It is throwing away some information (the original priVal node is lost), but
        this way it correctly builds the tree
        components you need.

        > -----Original Message-----
        > From: Anakreon [mailto:anakreonmejdi@...]
        > Sent: Thursday, September 30, 2004 16:48
        > To: antlr-interest@yahoogroups.com
        > Subject: Re: [antlr-interest] Tree structure
        >
        >
        >
        > > priVal! : INT
        > >
        > > {
        > >
        > > #priVal = #([INT,"-15"]);
        > This is a problem I have faced many times.
        > The workaround for this is:
        > int intType = INT;
        > #priVal = #([intType, "-15"]);
        >
        > If this behaver is a feature of Antlr, I wish it's removed.
        > Anakreon
        >
        >
        >
        > Yahoo! Groups Links
        >
        >
        >
        >
        >
        >
        >
      • Colm McHugh
        Hi antlr-interest, [Language=C++ only, didn t try with Java] This is in the realm of triviality, but I noticed today that antlr produces what looks like to me
        Message 3 of 8 , Oct 1, 2004
        • 0 Attachment
          Hi antlr-interest,

          [Language=C++ only, didn't try with Java]

          This is in the realm of triviality, but I noticed
          today that antlr produces what looks like to me an
          obscure error message if a variable in an action
          begins with an '_' (underscore) char:

          // offending snippet from test.g:

          mexpr returns [int _rr = 0]
          {int tmp = 0;}
          : _rr=atom (STAR tmp=atom { _rr*=tmp; )*
          ;

          $ antlr test.g
          ANTLR Parser Generator Version 2.7.4 1989-2004
          jGuru.com
          TokenStreamException: unexpected char: '_'

          Anyways, had me baffled for a few minutes so just
          thought I'd share!




          __________________________________
          Do you Yahoo!?
          Yahoo! Mail Address AutoComplete - You start. We finish.
          http://promotions.yahoo.com/new_mail
        Your message has been successfully submitted and would be delivered to recipients shortly.