Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How xtext Lexer and Parser works?
How xtext Lexer and Parser works? [message #892816] Fri, 29 June 2012 20:56 Go to next message
Andrew A is currently offline Andrew AFriend
Messages: 9
Registered: June 2012
Junior Member
Hello!

Where can I find the information, how xtext Lexer and Parser works?

I have wrote some xtext grammars, but I still don't understand, what's under the hood.
Re: How xtext Lexer and Parser works? [message #892845 is a reply to message #892816] Sat, 30 June 2012 11:32 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13373
Registered: July 2009
Senior Member
Hi,

ANTLR is under the hood

so let us take the sample grammar

Model:
	greetings+=Greeting*;
	
Greeting:
	'Hello' name=ID '!';


and the sample file

Hello Me!
Hello You!


the lexer divides the file into a token stream

Keyword:"Hello" ID Keyword:"!"
Keyword:"Hello" ID Keyword:"!"


and the parser then assembles the ast based on the rules in the grammar

-Model
--Greeting(name=Me)
--Greeting(name=You)

Maybe some basic reading on formal languages and parsing helps

~Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:mwe2 with resources from different projects
Next Topic:extraneous input '}' expecting EOF
Goto Forum:
  


Current Time: Sat Feb 29 04:28:18 GMT 2020

Powered by FUDForum. Page generated in 0.01881 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top