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 8945801
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:20:26+00:00 2026-06-15T12:20:26+00:00

How would you translate this portion of code written in ANTLR 3 into ANTLR

  • 0

How would you translate this portion of code written in ANTLR 3 into ANTLR 4?

expr: (Identifier '.')=> (refIdentifier)
  | (Identifier '!')=> (refIdentifier)
  | (Identifier '=>')=> (lambdaExpression);

I mean this kind of semantic predicate does not seem to exist now. What could I use Instead?

  • 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-06-15T12:20:28+00:00Added an answer on June 15, 2026 at 12:20 pm

    In ANTLR v4, there are no longer gated semantic predicates, { ... }?=>, and there are also no longer syntactic predicates, ( ... )=>, because the parsing algorithm used in v4 can resolve the ambiguities (the need for such predicates are no longer needed). So, this should just work for you:

    expr
     : refIdentifier
     | refIdentifier
     | lambdaExpression
     ;
    

    Note that there is just one type of predicate in v4: semantic predicates, { ... }?. If you need to inspect the contents of a token, for example, you can do it like this:

    id_capitals_only
     : {_input.LT(1).getText().matches("[A-Z]+")}? ID
     ;
    
    ID
     : [a-zA-Z]+
     ;
    

    EDIT

    And as Sam Harwell mentions in the comments:

    The semantic predicates {…}? in V4 work like the gated semantic predicates did in V3. The ungated predicates from V3 do not have a counterpart in ANTLR 4.

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

Sidebar

Related Questions

I've got some code which I would like to translate into Opengl ES. I'm
How would you translate this xcopy command into Robocopy: xcopy *.* C:\DestinationFolder\ Keeping in
I am trying to translate the VBA code found in this link into IronPython.
How would you translate this into a Rails content_tag? <td rowspan=4>glah</td>
I have to translate this preg_split code into a Java equivalent. I have tried
How would you translate this Perl regex into Java? /pattern/i While compiles, it does
How do i do translate this linq code into sql? if (storeId > 1)
Would someone please translate this into regular javaScript: $(div.intro h1).hide(); $(div.intro h2).remove(); Thanks.
Would be possible to extend this kind of layout so that I can have
I would like to know how to translate the following code to codebehind instead

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.