Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7035057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:15:34+00:00 2026-05-28T01:15:34+00:00

I know the AST I want to make (I think), which is: ^( STATEMENT

  • 0

I know the AST I want to make (I think), which is:

 ^( STATEMENT alias ( FOREACH rel ( FOREACH_PLAN_SIMPLE ( GENERATE STAR ) ) ) )

so I added the following rule:

realias_statement : alias EQUAL rel SEMI_COLON
                 -> ^( STATEMENT alias ( FOREACH rel ( FOREACH_PLAN_SIMPLE ( GENERATE STAR ) ) ) )
;

However, when I try to compile this, I get the following errors…

 [java] error(100): src//org/apache/pig/parser/QueryParser.g:174:49: syntax error: antlr: MismatchedTokenException(73!=69)
 [java] error(100): src//org/apache/pig/parser/QueryParser.g:174:51: syntax error: antlr: NoViableAltException(75@[])
 [java] error(100): src//org/apache/pig/parser/QueryParser.g:174:95: syntax error: antlr: NoViableAltException(69@[])
 [java] error(100): src//org/apache/pig/parser/QueryParser.g:174:97: syntax error: antlr: NoViableAltException(69@[])
 [java] error(100): src//org/apache/pig/parser/QueryParser.g:174:99: syntax error: antlr: NoViableAltException(69@[])
 [java] error(100): src//org/apache/pig/parser/QueryParser.g:0:1: syntax error: assign.types: MismatchedTreeNodeException(0!=18)
 [java] error(10):  internal error: src//org/apache/pig/parser/QueryParser.g : java.lang.NullPointerException
 [java] org.antlr.grammar.v3.DefineGrammarItemsWalker.countAltsForRule(DefineGrammarItemsWalker.java:153)
 [java] org.antlr.grammar.v3.DefineGrammarItemsWalker.rule(DefineGrammarItemsWalker.java:1546)
 [java] org.antlr.grammar.v3.DefineGrammarItemsWalker.rules(DefineGrammarItemsWalker.java:1190)
 [java] org.antlr.grammar.v3.DefineGrammarItemsWalker.grammarSpec(DefineGrammarItemsWalker.java:623)
 [java] org.antlr.grammar.v3.DefineGrammarItemsWalker.grammar_(DefineGrammarItemsWalker.java:275)
 [java] org.antlr.tool.Grammar.defineGrammarSymbols(Grammar.java:748)
 [java] org.antlr.tool.CompositeGrammar.defineGrammarSymbols(CompositeGrammar.java:369)
 [java] org.antlr.Tool.process(Tool.java:465)
 [java] org.antlr.Tool.main(Tool.java:93)

I will of course continue to dig into what these errors mean, but I was wondering more general if this sort of thing can be done? IE I know exactly how I want it to look, but am not sure how to get it to look like that.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T01:15:35+00:00Added an answer on May 28, 2026 at 1:15 am

    Assuming STATEMENT, FOREACH, FOREACH_PLAN_SIMPLE and GENERATE STAR are defined in the tokens { ... } section, this should work:

    realias_statement
     : alias EQUAL rel SEMI_COLON
       -> ^(STATEMENT alias ^(FOREACH rel ^(FOREACH_PLAN_SIMPLE ^(GENERATE STAR))))
     ;
    

    Note the ^ before the opening parenthesis.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Python AST [as returned by ast.parse()]. I know this is an
Do you know of a .NET library for generating javascript code? I want to
I have a general idea of what an AST is, but I want to
Hi I want to do a java or c# method which will return a
I'm facing a kind of strange problem and don't know in which direction to
Possible Duplicate: What's the difference between parse tree and AST? I need to know
I have an abstract syntax tree which I need to iterate. The AST is
Suppose I want to write a function like the following (as usual, a trivial
I have an ANTLR grammar which creates an AST, and then I have written
I want to know the reason why there are macros such as T, TEXT,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.