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

Just arrived...

Expand Messages
  • Douglas Atique
    Hello, everybody. I have just subscribed to the list, but I have been looking at ANTLR and earlier PCCTS for a while. Just now I had the opportunity to develop
    Message 1 of 5 , Mar 18, 1999
    • 0 Attachment
      Hello, everybody.
      I have just subscribed to the list, but I have been looking at ANTLR and earlier PCCTS for a while. Just now I had the opportunity to develop a parser with ANTLR, and the article at Dr. Dobb's did a great job in motivating me.
      As a new tool, ANTLR presented some behaviors to which I am not accustomed. For example, I have read in the reference manual that I can reference the EOF predefined rule in any parser. As it starts with a capital letter, I conclude that it's a lexer rule. Then, why does ANTLR complain when I reference this rule in the lexer? I want to strip everything from some well-defined token to the end of file, because it is a comment which does not interest the users of my parser's output. I thought of defining a rule like this:

      EndComment:
      WellDefinedToken ('\0'..'\377')* EOF
      ;

      Any suggestions or comments?
      Regards to all,
      Douglas
    • Sinan Karasu
      Because antlr defines EOF as 1 .... try WellDefinedToken ( 3 .. 377 )* EOF
      Message 2 of 5 , Mar 18, 1999
      • 0 Attachment
        Because antlr defines EOF as 1 ....

        try

        WellDefinedToken ('\3'..'\377')* EOF
      • Douglas Atique
        ANTLR didn t like it. It insists on complaining : error: Lexer rule EOF is not defined Douglas ... De: sinan.karasu@Boeing.com[SMTP:sinan.karasu@Boeing.com]
        Message 3 of 5 , Mar 18, 1999
        • 0 Attachment
          ANTLR didn't like it. It insists on complaining :
          error: Lexer rule EOF is not defined
          Douglas

          ----------
          De: sinan.karasu@...[SMTP:sinan.karasu@...]
          Enviada em: Quinta-feira, 18 de Mar´┐Żo de 1999 14:07
          Para: antlr-interest@onelist.com; Douglas.Atique@...
          Assunto: Re: [antlr-interest] Just arrived...

          Because antlr defines EOF as 1 ....

          try

          WellDefinedToken ('\3'..'\377')* EOF
        • Sinan Karasu
          Ooops, shoud have read WDT ( 3 .. 377 )* no EOF. it is auto gen d
          Message 4 of 5 , Mar 18, 1999
          • 0 Attachment
            Ooops,

            shoud have read

            WDT ('\3'..'\\377')*

            no EOF. it is auto gen'd
          • Terence Parr
            ... It is a predefined token really and special ...there is no real rule associated with it; it signifies a file system state as opposed to a real
            Message 5 of 5 , Mar 18, 1999
            • 0 Attachment
              Douglas Atique hath spoken:
              >From: Douglas Atique <Douglas.Atique@...>
              >
              >Hello, everybody.
              >I have just subscribed to the list, but I have been looking at ANTLR and
              >earlier PCCTS for a while. Just now I had the opportunity to develop a
              >parser with ANTLR, and the article at Dr. Dobb's did a great job in
              >motivating me.
              >As a new tool, ANTLR presented some behaviors to which I am not accustomed.
              >For example, I have read in the reference manual that I can reference the
              >EOF predefined rule in any parser. As it starts with a capital letter, I
              >conclude that it's a lexer rule. Then, why does ANTLR complain when I
              >reference this rule in the lexer?

              It is a predefined token really and "special"...there is no real rule
              associated with it; it signifies a file system state as opposed to a real
              "character", contrary to PCs etc...

              Good luck,
              Terence
            Your message has been successfully submitted and would be delivered to recipients shortly.