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

  • Home
  • SEARCH
  • 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 7683717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T18:51:31+00:00 2026-05-31T18:51:31+00:00

Are they generated by different phases of a compiling process? Or are they just

  • 0

Are they generated by different phases of a compiling process? Or are they just different names for the same thing?

  • 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-31T18:51:32+00:00Added an answer on May 31, 2026 at 6:51 pm

    This is based on the Expression Evaluator grammar by Terrence Parr.

    The grammar for this example:

    grammar Expr002;
    
    options 
    {
        output=AST;
        ASTLabelType=CommonTree; // type of $stat.tree ref etc...
    }
    
    prog    :   ( stat )+ ;
    
    stat    :   expr NEWLINE        -> expr
            |   ID '=' expr NEWLINE -> ^('=' ID expr)
            |   NEWLINE             ->
            ;
    
    expr    :   multExpr (( '+'^ | '-'^ ) multExpr)*
            ; 
    
    multExpr
            :   atom ('*'^ atom)*
            ; 
    
    atom    :   INT 
            |   ID
            |   '('! expr ')'!
            ;
    
    ID      : ('a'..'z' | 'A'..'Z' )+ ;
    INT     : '0'..'9'+ ;
    NEWLINE : '\r'? '\n' ;
    WS      : ( ' ' | '\t' )+ { skip(); } ;
    

    Input

    x=1
    y=2
    3*(x+y)
    

    Parse Tree

    The parse tree is a concrete representation of the input. The parse tree retains all of the information of the input. The empty boxes represent whitespace, i.e. end of line.

    Parse Tree

    AST

    The AST is an abstract representation of the input. Notice that parens are not present in the AST because the associations are derivable from the tree structure.

    AST

    For a more through explanation see Compilers and Compiler Generators pg. 23
    or Abstract Syntax Trees on pg. 21 in Syntax and Semantics of Programming Languages

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

Sidebar

Related Questions

I have two classes generated by LINQ2SQL both from the same table so they
They both do the same thing. Is one way better? Obviously if I write
These two statements look the same logically to me, but they're resulting in different
I'm having trouble grasping generic methods. I have two classes that are generated (they
I have two scaffold-generated Models, student and class . They have a many-to-many relationship
how can I modify admin generated modules (acions and templates)? They are stored in
They both seem to fulfill the same purpose. When would I chose one over
I would like to use same ComplexType in two different WSDLs. How to define
I have an internal enterprise app that currently consumes 10 different web services. They're
I have many dynamically generated pages, made by the same PHP file, and I'd

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.