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

Re: Stuck in treewalkers

Expand Messages
  • Monty Zukowski
    ... From: Lars Clausen To: antlr-interest@onelist.com Date: Wednesday, September 30, 1998 8:01 PM
    Message 1 of 2 , Oct 1, 1998
    View Source
    • 0 Attachment
      -----Original Message-----
      From: Lars Clausen <lrclause@...>
      To: antlr-interest@onelist.com <antlr-interest@onelist.com>
      Date: Wednesday, September 30, 1998 8:01 PM
      Subject: [antlr-interest] Stuck in treewalkers


      >From: Lars Clausen <lrclause@...>
      >
      >
      >I am having the hardest time getting a treewalker to accept my ast. The
      >parser works beautifully, and prints out the AST as it should be, but that
      >treewalker won't accept anything, not even a simple integer. It's driving
      >me crazy, as I can't see any difference between what I do here and what the
      >docs say. It seems like the keywords (SEQ, NUMBER, "infixl" etc) aren't
      >recognized by the walker at all. Please, what am I doing wrong?
      >


      You need to specify the tokenVocabulary for your TreeParser too!

      class miniJRWalker extends TreeParser;
      options

      tokenVocabulary=miniTokens;
      }

      When you get into multiple tree parsers and start using the tokdef option,
      you will undoubtedly change your grammar which will change the token types
      file. Then if you don't rebuild all of your tree parsers you will have
      errors where the token type doesn't match what the parser had. All of a
      sudden the INT from the parser is now the STRING in the tree walker, etc.
      It may look like your parser is building wacky trees, but it's just that the
      token types no longer match. Rebuild all your tree parsers and you'll be
      ok.

      Monty
    Your message has been successfully submitted and would be delivered to recipients shortly.