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

(unknown)

Expand Messages
  • rajesh radhakrishnan
    To: antlr-interest@onelist.com Cc: Date: Mon, 31 Jan 19100 20:37:31 -0800 (PST) Subject: Fwd: Fwd: print_tree Hi, As per Terence s request... :) Regards
    Message 1 of 9 , Dec 31, 1969
    • 0 Attachment
      To: antlr-interest@onelist.com

      Cc:

      Date: Mon, 31 Jan 19100 20:37:31 -0800 (PST)

      Subject: Fwd: Fwd: print_tree





      Hi,



      As per Terence's request... :)



      Regards

      -Rajesh



      >--parrt@... wrote:---

      >>You might want to send a note about this to antlr-interest@onelist.com

      >>:)

      >>

      >>Thanks,

      >>Terence

      >>

      >>rajesh radhakrishnan writes:

      >>>To: parrt@...

      >>>

      >>>Cc:

      >>>

      >>>Date: Fri, 28 Jan 19100 7:52:3 -0800 (PST)

      >>>

      >>>Subject: Re: Feedback on FAQ entry at jGuru

      >>>

      >>>Hi,

      >>>After spending a lot of time getting the AST just right, I was writing the tree grammar from the way the AST was being printed.

      >>>

      >>>After my faq post, I downloaded the 'print_tree' class by Ian Kaplan

      >>>

      >>>http://www.bearcave.com/software/antlr/antlr_examples.html

      >>>

      >>>It prints the tree vertically and marks the start/end of a child/sibling. It certainly helped in finding where I was getting the tree grammar wrong.

      >>>

      >>>I subsequently added 'print_tree.o' to libantlr.a so that I could use it in all future programs.

      >>>

      >>>I found the 'toStringList()' output hard to read for a large AST because it prints without any newline. Its hard to keep track on when a child/sibling starts or ends. I found the AST a lot easier to read when its printed vertically.

      >>>

      >>>Yes, it scrolls a couple of pages for a large AST but you only concentrate a portion of the AST to get that part of your tree grammar right. I got the whole tree grammar right by getting it right in parts.. :)

      >>>

      >>>I would certainly recommend 'print_tree' for any newbie.

      >>>

      >>>Thanks

      >>>

      >>>Rajesh

      >>>

      >>>---notifications@... wrote:---

      >>>

      >>>>You received the following FAQ feedback Submission at jGuru.com:

      >>>

      >>>>Submitted by: Terence Parr (parrt@...)

      >>>

      >>>>

      >>>

      >>>>In reference to: What debugging techniques can be used when the ANTLR-generated treewalker encounters ASTNULL in the AST tree.

      >>>

      >>>>The error message is,

      >>>

      >>>>Error: unexpected AST node: <ASTNULL>

      >>>

      >>>>Comments:

      >>>

      >>>>Ter, did you get this?





      __

      http://www.go.com









      ________________________________________________________ ____

      Get your Free GO Network Email address at http://mail.go.com
    • mzukowski@yci.com
      read the docs on keywords and also how protected rules work in the lexer. Monty ... From: gitadut [mailto:gitadut@yahoo.co.uk] Sent: Thursday, March 13, 2003
      Message 2 of 9 , Mar 13, 2003
      • 0 Attachment
        read the docs on keywords and also how "protected" rules work in the lexer.

        Monty

        -----Original Message-----
        From: gitadut [mailto:gitadut@...]
        Sent: Thursday, March 13, 2003 5:22 AM
        To: antlr-interest@yahoogroups.com
        Subject: [antlr-interest] (unknown)


        Antlr behaves abnormally when I want to describe the production rules
        in Lexer part reusing some of the rules already defined by me.

        Like METASTRING :
        ((POP) | (STRING) | "/")
        ;
        When I have defined POP in some way.

        Next is how can I parse some reserve words by Antlr?
        I've describes in Parser part

        Reserved :
        (CIRCUIT)
        ;
        Then in Lexer

        CIRCUIT
        : "Circuit"
        ;
        But it is not solving my problem.
        Are there any suggestions or comments from anyone?
        Thanks in advance.

        Gita





        Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
      • mzukowski@yci.com
        Yes, a token stream should work. You can see my filtering example for some ideas. http://www.codetransform.com/filterexample.html. This problem will be a
        Message 3 of 9 , May 15 8:17 AM
        • 0 Attachment
          Yes, a token stream should work. You can see my filtering example for some
          ideas. http://www.codetransform.com/filterexample.html. This problem will
          be a great deal harder if you have to preserve all the source code. In
          other words if you have to keep both the #ifdef and #else parts in the same
          tree then you've made things pretty interesting.

          Monty
          ANTLR consultant
          www.codetransform.com

          -----Original Message-----
          From: franck_antibes_fr [mailto:caronfranck@...]
          Sent: Thursday, May 15, 2003 7:59 AM
          To: antlr-interest@yahoogroups.com
          Subject: [antlr-interest] (unknown)


          Hi,




          I am writing a verilog parser based on the grammar found on antlr.org.


          but I have to handle in my parser `define macros and `ifdef `else
          `endif compiler directive. ( I do not want to preprocess the file).




          for the people that know nothing about verilog, the problem is the
          same as #define and #ifdef #else #endif preprocessor directive in
          C/C++ so I will transpose the problem in C++ instead of verilog.






          a litle example








          #ifdef CAN_DERIVE


          #include "base.h"




          class toto : public base {


          public:


          toto(int a):base(a){}


          #else


          class toto {


          protected:


          int a_;


          public:


          toto(int a):a_(a){}


          #endif


          virtual get_a() {return a_;}


          };






          because #ifdef ... can be everywhere in the code, it is not feasable


          to put everywhere in the grammar rules to handle this. I thought to
          use a king of tokenstream filter or multiplexer with several parsers.




          Do any one have an idea to solve this ?




          thanks




          Franck











          Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
        • franck_antibes_fr
          my goal is to keep both the #ifdef and #else parts in the same tree (not an AST but a Data Object Model). an other hard stuff is dealing with macro without
          Message 4 of 9 , May 15 8:58 AM
          • 0 Attachment
            my goal is to keep both the #ifdef and #else parts in the same tree
            (not an AST but a Data Object Model). an other hard stuff is dealing
            with macro without expanding them.




            I will have a look to your example.


            thanks




            Franck




            --- In antlr-interest@yahoogroups.com, mzukowski@y... wrote:


            > Yes, a token stream should work. You can see my filtering example
            for some


            > ideas. http://www.codetransform.com/filterexample.html. This
            problem will


            > be a great deal harder if you have to preserve all the source code.
            In


            > other words if you have to keep both the #ifdef and #else parts in
            the same


            > tree then you've made things pretty interesting.


            >


            > Monty


            > ANTLR consultant


            > www.codetransform.com


            >


            > -----Original Message-----


            > From: franck_antibes_fr [mailto:caronfranck@y...]


            > Sent: Thursday, May 15, 2003 7:59 AM


            > To: antlr-interest@yahoogroups.com


            > Subject: [antlr-interest] (unknown)


            >


            >


            > Hi,


            >


            >


            >


            >


            > I am writing a verilog parser based on the grammar found on antlr.
            org.


            >


            >


            > but I have to handle in my parser `define macros and `ifdef `else


            > `endif compiler directive. ( I do not want to preprocess the file).


            >


            >


            >


            >


            > for the people that know nothing about verilog, the problem is the


            > same as #define and #ifdef #else #endif preprocessor directive in


            > C/C++ so I will transpose the problem in C++ instead of verilog.


            >


            >


            >


            >


            >


            >


            > a litle example


            >


            >


            >


            >


            >


            >


            >


            >


            > #ifdef CAN_DERIVE


            >


            >


            > #include "base.h"


            >


            >


            >


            >


            > class toto : public base {


            >


            >


            > public:


            >


            >


            > toto(int a):base(a){}


            >


            >


            > #else


            >


            >


            > class toto {


            >


            >


            > protected:


            >


            >


            > int a_;


            >


            >


            > public:


            >


            >


            > toto(int a):a_(a){}


            >


            >


            > #endif


            >


            >


            > virtual get_a() {return a_;}


            >


            >


            > };


            >


            >


            >


            >


            >


            >


            > because #ifdef ... can be everywhere in the code, it is not feasable


            >


            >


            > to put everywhere in the grammar rules to handle this. I thought to


            > use a king of tokenstream filter or multiplexer with several
            parsers.


            >


            >


            >


            >


            > Do any one have an idea to solve this ?


            >


            >


            >


            >


            > thanks


            >


            >


            >


            >


            > Franck


            >


            >


            >


            >


            >


            >


            >


            >


            >


            >


            >


            > Your use of Yahoo! Groups is subject to http://docs.yahoo
            com/info/terms/
          • mzukowski@yci.com
            What kind of tool are you writing? Monty ... From: franck_antibes_fr [mailto:caronfranck@yahoo.fr] Sent: Thursday, May 15, 2003 8:58 AM To:
            Message 5 of 9 , May 15 10:08 AM
            • 0 Attachment
              What kind of tool are you writing?

              Monty

              -----Original Message-----
              From: franck_antibes_fr [mailto:caronfranck@...]
              Sent: Thursday, May 15, 2003 8:58 AM
              To: antlr-interest@yahoogroups.com
              Subject: [antlr-interest] Re: (unknown)


              my goal is to keep both the #ifdef and #else parts in the same tree
              (not an AST but a Data Object Model). an other hard stuff is dealing
              with macro without expanding them.




              I will have a look to your example.


              thanks




              Franck




              --- In antlr-interest@yahoogroups.com, mzukowski@y... wrote:


              > Yes, a token stream should work. You can see my filtering example
              for some


              > ideas. http://www.codetransform.com/filterexample.html. This
              problem will


              > be a great deal harder if you have to preserve all the source code.
              In


              > other words if you have to keep both the #ifdef and #else parts in
              the same


              > tree then you've made things pretty interesting.


              >


              > Monty


              > ANTLR consultant


              > www.codetransform.com


              >


              > -----Original Message-----


              > From: franck_antibes_fr [mailto:caronfranck@y...]


              > Sent: Thursday, May 15, 2003 7:59 AM


              > To: antlr-interest@yahoogroups.com


              > Subject: [antlr-interest] (unknown)


              >


              >


              > Hi,


              >


              >


              >


              >


              > I am writing a verilog parser based on the grammar found on antlr.
              org.


              >


              >


              > but I have to handle in my parser `define macros and `ifdef `else


              > `endif compiler directive. ( I do not want to preprocess the file).


              >


              >


              >


              >


              > for the people that know nothing about verilog, the problem is the


              > same as #define and #ifdef #else #endif preprocessor directive in


              > C/C++ so I will transpose the problem in C++ instead of verilog.


              >


              >


              >


              >


              >


              >


              > a litle example


              >


              >


              >


              >


              >


              >


              >


              >


              > #ifdef CAN_DERIVE


              >


              >


              > #include "base.h"


              >


              >


              >


              >


              > class toto : public base {


              >


              >


              > public:


              >


              >


              > toto(int a):base(a){}


              >


              >


              > #else


              >


              >


              > class toto {


              >


              >


              > protected:


              >


              >


              > int a_;


              >


              >


              > public:


              >


              >


              > toto(int a):a_(a){}


              >


              >


              > #endif


              >


              >


              > virtual get_a() {return a_;}


              >


              >


              > };


              >


              >


              >


              >


              >


              >


              > because #ifdef ... can be everywhere in the code, it is not feasable


              >


              >


              > to put everywhere in the grammar rules to handle this. I thought to


              > use a king of tokenstream filter or multiplexer with several
              parsers.


              >


              >


              >


              >


              > Do any one have an idea to solve this ?


              >


              >


              >


              >


              > thanks


              >


              >


              >


              >


              > Franck


              >


              >


              >


              >


              >


              >


              >


              >


              >


              >


              >


              > Your use of Yahoo! Groups is subject to http://docs.yahoo
              com/info/terms/





              Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
            • franck_antibes_fr
              I am writing a parser to be reusable for any kind of applications( prefixing modules names or port reordering, dependency checking ...) without having to
              Message 6 of 9 , May 16 2:33 AM
              • 0 Attachment
                I am writing a parser to be reusable for any kind of applications(


                prefixing modules names or port reordering, dependency checking ...)


                without having to preprocess or independently of the proprocess
                context (tool dependent macros, include files...).




                maybe it will be impossible to handle everything but I have to cover


                the maximum.




                franck


                --- In antlr-interest@yahoogroups.com, mzukowski@y... wrote:


                > What kind of tool are you writing?


                >


                > Monty


                >


                > -----Original Message-----


                > From: franck_antibes_fr [mailto:caronfranck@y...]


                > Sent: Thursday, May 15, 2003 8:58 AM


                > To: antlr-interest@yahoogroups.com


                > Subject: [antlr-interest] Re: (unknown)


                >


                >


                > my goal is to keep both the #ifdef and #else parts in the same tree


                > (not an AST but a Data Object Model). an other hard stuff is dealing


                > with macro without expanding them.


                >


                >


                >


                >


                > I will have a look to your example.


                >


                >


                > thanks


                >


                >


                >


                >


                > Franck


                >


                >


                >


                >


                > --- In antlr-interest@yahoogroups.com, mzukowski@y... wrote:


                >


                >


                > > Yes, a token stream should work. You can see my filtering example


                > for some


                >


                >


                > > ideas. http://www.codetransform.com/filterexample.html. This


                > problem will


                >


                >


                > > be a great deal harder if you have to preserve all the source
                code.


                > In


                >


                >


                > > other words if you have to keep both the #ifdef and #else parts in


                > the same


                >


                >


                > > tree then you've made things pretty interesting.


                >


                >


                > >


                >


                >


                > > Monty


                >


                >


                > > ANTLR consultant


                >


                >


                > > www.codetransform.com


                >


                >


                > >


                >


                >


                > > -----Original Message-----


                >


                >


                > > From: franck_antibes_fr [mailto:caronfranck@y...]


                >


                >


                > > Sent: Thursday, May 15, 2003 7:59 AM


                >


                >


                > > To: antlr-interest@yahoogroups.com


                >


                >


                > > Subject: [antlr-interest] (unknown)


                >


                >


                > >


                >


                >


                > >


                >


                >


                > > Hi,


                >


                >


                > >


                >


                >


                > >


                >


                >


                > >


                >


                >


                > >


                >


                >


                > > I am writing a verilog parser based on the grammar found on antlr.


                > org.


                >


                >


                > >


                >


                >


                > >


                >


                >


                > > but I have to handle in my parser `define macros and `ifdef `else


                >


                >


                > > `endif compiler directive. ( I do not want to preprocess the file)
                .


                >


                >


                > >


                >


                >


                > >


                >


                >


                > >


                >


                >


                > >


                >


                >


                > > for the people that know nothing about verilog, the problem is the


                >


                >


                > > same as #define and #ifdef #else #endif preprocessor directive in


                >


                >


                > > C/C++ so I will transpose the problem in C++ instead of verilog.


                >


                >


                > >


                >


                >


                > >


                >


                >


                > >


                >


                >


                > >


                >


                >


                > >


                >


                >


                > >


                >


                >


                > > a litle example


                >


                >


                > >


                >


                >


                > >


                >


                >


                > >


                >


                >


                > >


                >


                >


                > >


                >


                >


                > >


                >


                >


                > >


                >


                >


                > >


                >


                >


                > > #ifdef CAN_DERIVE


                >


                >


                > >


                >


                >


                > >


                >


                >


                > > #include "base.h"


                >


                >


                > >


                >


                >


                > >


                >


                >


                > >


                >


                >


                > >


                >


                >


                > > class toto : public base {


                >


                >


                > >


                >


                >


                > >


                >


                >


                > > public:


                >


                >


                > >


                >


                >


                > >


                >


                >


                > > toto(int a):base(a){}


                >


                >


                > >


                >


                >


                > >


                >


                >


                > > #else


                >


                >


                > >


                >


                >


                > >


                >


                >


                > > class toto {


                >


                >


                > >


                >


                >


                > >


                >


                >


                > > protected:


                >


                >


                > >


                >


                >


                > >


                >


                >


                > > int a_;


                >


                >


                > >


                >


                >


                > >


                >


                >


                > > public:


                >


                >


                > >


                >


                >


                > >


                >


                >


                > > toto(int a):a_(a){}


                >


                >


                > >


                >


                >


                > >


                >


                >


                > > #endif


                >


                >


                > >


                >


                >


                > >


                >


                >


                > > virtual get_a() {return a_;}


                >


                >


                > >


                >


                >


                > >


                >


                >


                > > };


                >


                >


                > >


                >


                >


                > >


                >


                >


                > >


                >


                >


                > >


                >


                >


                > >


                >


                >


                > >


                >


                >


                > > because #ifdef ... can be everywhere in the code, it is not
                feasable


                >


                >


                > >


                >


                >


                > >


                >


                >


                > > to put everywhere in the grammar rules to handle this. I thought
                to


                >


                >


                > > use a king of tokenstream filter or multiplexer with several


                > parsers.


                >


                >


                > >


                >


                >


                > >


                >


                >


                > >


                >


                >


                > >


                >


                >


                > > Do any one have an idea to solve this ?


                >


                >


                > >


                >


                >


                > >


                >


                >


                > >


                >


                >


                > >


                >


                >


                > > thanks


                >


                >


                > >


                >


                >


                > >


                >


                >


                > >


                >


                >


                > >


                >


                >


                > > Franck


                >


                >


                > >


                >


                >


                > >


                >


                >


                > >


                >


                >


                > >


                >


                >


                > >


                >


                >


                > >


                >


                >


                > >


                >


                >


                > >


                >


                >


                > >


                >


                >


                > >


                >


                >


                > >


                >


                >


                > > Your use of Yahoo! Groups is subject to http://docs.yahoo


                > com/info/terms/


                >


                >


                >


                >


                >


                > Your use of Yahoo! Groups is subject to http://docs.yahoo
                com/info/terms/
              • Matthew Ford
                Have a look at the linkChecker example in the 2.7.2 distribution. It has a catch all rule using filter. matthew ... From: franck_antibes_fr
                Message 7 of 9 , Jun 10, 2003
                • 0 Attachment
                  Have a look at the linkChecker example in the 2.7.2 distribution.
                  It has a catch all rule using filter.
                  matthew
                  ----- Original Message -----
                  From: "franck_antibes_fr" <caronfranck@...>
                  To: <antlr-interest@yahoogroups.com>
                  Sent: Tuesday, June 10, 2003 6:52 PM
                  Subject: [antlr-interest] (unknown)


                  > Hi all.
                  >
                  >
                  >
                  >
                  > I have a problem with the lexer :
                  >
                  >
                  >
                  >
                  > I have several lexer rules to detect some tokens. that's OK
                  >
                  >
                  > but I want to create a rules for any token that do not match
                  >
                  >
                  > the previous rules. In PCCTS there was a "precedence" in lexer rules
                  >
                  >
                  > so that I could have a rule (.) at the end of all the rule and
                  >
                  >
                  > if none of the previous one matched this one will.
                  >
                  >
                  > I tryed to use the filter=OTHERTOKEN option (OTHERTOKEN is a private
                  > rule) in the antlr parser but this prevent the lexer to throw
                  > exception if the char do not match any rules and match OTHERTOKEN but
                  > do not create token in the token stream
                  >
                  >
                  >
                  >
                  >
                  >
                  > Is there a way to handle this without writing an long complex rule for
                  > OTHERTOKEN?
                  >
                  >
                  >
                  >
                  >
                  >
                  > TIA,
                  >
                  >
                  > Franck
                  >
                  >
                  >
                  >
                  >
                  >
                  >
                  >
                  >
                  >
                  > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
                  >
                  >
                • Markus_Heiden@public.uni-hamburg.de
                  ... I had similar problems (described in the forum last tuesday). I solved them by adding the complete token {} section of the parser to the token {} section
                  Message 8 of 9 , Aug 18, 2003
                  • 0 Attachment
                    > I'm using grammar inheritance and a rule in the sub-grammar is not working
                    > because it does not test against the tokens defined in the sub-grammar. In
                    > other words, it appears that the generated code did not take into account
                    > the tokens defined in the sub-grammar.

                    > Can anyone else verify whether this is a bug or not.

                    I had similar problems (described in the forum last tuesday). I 'solved'
                    them by adding the complete token {} section of the parser to the token {}
                    section of the sub grammar.

                    Markus
                  • Boulanger Jean-Louis
                    Hello, I have the same pb A. with a sub-sub-grammar (twice inheritance) and I don t solve this. B. and in a grammar with implicite token (token introduce in
                    Message 9 of 9 , Aug 18, 2003
                    • 0 Attachment
                      Hello,

                      I have the same pb
                      A. with a sub-sub-grammar (twice inheritance) and I don't solve this.
                      B. and in a grammar with implicite token (token introduce in syntactic rule),
                      it's not possible to complete the token part of all grammar.

                      It's a BUG ??

                      Boulanger JL


                      > Selon Markus_Heiden@...-hamburg.de:

                      > > I'm using grammar inheritance and a rule in the sub-grammar is not working
                      > > because it does not test against the tokens defined in the sub-grammar. In
                      > > other words, it appears that the generated code did not take into account
                      > > the tokens defined in the sub-grammar.
                      >
                      > > Can anyone else verify whether this is a bug or not.
                      >
                      > I had similar problems (described in the forum last tuesday). I 'solved'
                      > them by adding the complete token {} section of the parser to the token {}
                      > section of the sub grammar.
                      >
                      > Markus
                      >
                      >
                      >
                      >
                      >
                      > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
                      >
                      >




                      -------------------------------------------------
                      Laboratoire Heudiasyc. UMR CNRS 6599
                      http://www.hds.utc.fr
                    Your message has been successfully submitted and would be delivered to recipients shortly.