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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:07:53+00:00 2026-06-17T16:07:53+00:00

Can someone explain me the relationship between a parse tree, AST and metamodel. I

  • 0

Can someone explain me the relationship between a parse tree, AST and metamodel.
I know so far that xtext derive an EMF Ecore metamodel out of the grammar and generate a parser with antlr.
But how will it then be parsed: An input goes first trough the lexer and then the parser creates a parse tree out of the parser rules, right? And out of the parse tree, Xtext creates also an AST? For what? And what purpose has the metamodel in this case?
I’m a little bit confused of all the definitions.

  • 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-17T16:07:54+00:00Added an answer on June 17, 2026 at 4:07 pm

    You are right about the three-step parsing procedure: first the lexer starts with the input stream, then an Antlr-based parse tree is created, finally Xtext generated an EMF-based AST from the parse tree. The first two steps are natural for every parser (generator), the third step needs some explaining. I will start a bit lengthy explanation with some motivation, then I will shortly speak about metamodels and EMF in general.

    First of all, the generated parsers do not support identifier resolution (required for handling variables or function calls), these functions needs to be added manually, so a manually coded post-processing step is needed for almost all languages, that needs an extension of the already existing parse tree.

    Second, EMF provides a nice, type-safe API for its models, together with a powerful reflective API, that allows the creation of very generic, but useful components that ease the processing of the models (e.g. code generators such as Acceleo or one aspect of Xtend, model transformation tools, such as ATL, ETL, VIATRA2). I cannot tell exactly the difference between the parse tree API of Antlr and EMF, but I worked with the API of the LPG parser generator, and in my opinion, EMF is easier to work with.

    Even better, the use of EMF allows the re-use of the rich Xtext functionality together with other EMF-based editors, such as GMF-based graphical editors. See an earlier EclipseCon presentation for the basic idea: TMF meets GMF – Combining Textual and Graphical Modeling.

    In general, if we need to extend our parse tree with resolution information, then by re-using an already used paradigm can ease the integration of our language with other tools.

    EMF relies on the concept of metamodeling: we have to define the set of elements usable in the models, together with additional constraints, such as information about connectivity. This concept is similar to schema definitions for XML (such as DTD or SML Schema) – we have a uniform way to describe models. Xtext works together with EMF in several ways:

    • First of all, based on the grammar, it generates and registers an EMF metamodel that can be used in every EMF-based tooling.
    • Then the end result of the parsing process is an EMF model, that can be read and modified using the EMF API – changes are serialized back into the textual form.

    I hope, the answer was clear enough. Feel free to ask for more clarifications if needed.

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

Sidebar

Related Questions

Can someone explain the difference/relationship between bounds and constraints in Draw2d? I'm trying to
Can someone explain the relationship between asynchronous NSURL requests and GCD and NSOperationQueues? I
In WPF: Can someone please explain the relationship between DependencyProperty and Databinding? I have
can someone explain me the difference between the 2 programs, basically the difference between
Can someone explain to me the differences between these Certificate types shown in my
Can someone explain the significance of specifying a relationship in a Django model as
Can someone explain why everything in WPF is blurry? Is this something that can
Can someone explain to me what the difference between include_once 'classb.php' class A {
Can someone explain the difference between using define('SOMETHING', true); and $SOMETHING = true; And
Can someone explain me why with that query: SELECT * FROM `tags` WHERE (tag

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.