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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:59:14+00:00 2026-05-14T01:59:14+00:00

I have an AST generated via ANTLR, and I need to convert it to

  • 0

I have an AST generated via ANTLR, and I need to convert it to a DLR-compatible one (Expression Trees). However, it would seem that i can’t use tree pattern matchers for this as expression trees need their subtrees at instantiation (which i can’t get). What solution would be best for me to use?

  • 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-14T01:59:15+00:00Added an answer on May 14, 2026 at 1:59 am

    I did something very similar some years ago – I didn’t build a DLR structure, but I built my own expression tree structure, which also needed the arguments at construction time (to achieve immutability).

    Back then, I worked with ANTLR v2 – and I must admit, that I’m not familiar with the new v3 syntax, plus I don’t remember every detail about how I did it back then – so instead of providing you with a fully worked out example, I’ll just try to tell you my story (not sure, if it applies to your problem, too!):

    First of all, it wasn’t necessary to build my structure from the AST. I only used ANLTR’s AST builder as a vehicle: Every AST building rule can return an Object in addition to the AST node itself. The return value can then be used in the outer rule as an argument for the constructor, and so on. So that structure is automatically built bottom up for you!

    IOW, you build the final structure at the same time that the AST is built (the AST is only built to ensure the syntax rules, and can be thrown away.) This approach is very solid, and it’s even faster than first building the AST, and then transforming that! But it still utilizes the power of the AST parser (as opposed to just using the normal Parser/Lexer alone). And if you need the AST, too – just save it somewhere.

    If, however you want to walk a finished AST – I imagine you can use any programmatic routine to do that – just make sure, that it works bottom up to construct your result!

    Hope this helps in some way!

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

Sidebar

Related Questions

Have deployed numerous report parts which reference the same view however one of them
I have a tree parser that's doing semantic analysis on the AST generated by
I have an antlr generated Java parser that uses the C target and it
I have a set S of small trees S[i] which I need to find
I have lexer/parser (Generated from an ANTLR grammar file) which (for performance reasons) I
I have an abstract syntax tree which I need to iterate. The AST is
I have an AST derived from the ANTLR Parser Generator for Java. What I
I have an ANTLR grammar which creates an AST, and then I have written
So I have generated a parser via JISON: // mygenerator.js var Parser = require(jison).Parser;
I have a Python AST [as returned by ast.parse()]. I know this is an

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.