Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » need explanation regarding assignments
need explanation regarding assignments [message #870552] Tue, 08 May 2012 16:23 Go to next message
Tim Student is currently offline Tim StudentFriend
Messages: 12
Registered: May 2012
Junior Member
I'm totaly new in Xtext and have a probably simple question.

Here is my code.
Several different types of lines will be present in my language, here you only see two of them (activity_line and command_line).

Model:
		lines+=line*
		;

line:		activity_line  |
		command_line
		;

activity_line:	'activity:' name=ID comment*
		;

command_line:	'command:' ID comment*
		;

comment:	'#' ID*
		;


Now the question:
What causes the assignment name=ID in rule activity_line. The generated editor recognizes equivalent the same at the command_line rule, when I only regard the Syntaxhighlighting, spell checking etc.

Can somebody tell me the difference of name=ID and ID?
Can I somehow use the 'name' as some kind of variable, where the explicit ID is stored? I can't understand that...

Thanks so far.

[Updated on: Tue, 08 May 2012 18:26]

Report message to a moderator

Re: need explanation regarding assignments [message #870565 is a reply to message #870552] Tue, 08 May 2012 18:34 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

guess some basic reading on parsers will help you. Xtext does not only parse (this would be senseless) but it creates an Object Tree / Abstract Syntax Tree too. This tree can be used in a code Generator or Interpreter.

The tree is actually a Graph that consists of Nodes (EClass). There eclasses have attributes and can contain other Nodes (through a containment reference) and reference other Nodes (Cross References)

doing a Xtext tutorial and doing some basic reading on EMF Ecore will give you more information.

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: need explanation regarding assignments [message #870726 is a reply to message #870565] Wed, 09 May 2012 13:22 Go to previous message
Tim Student is currently offline Tim StudentFriend
Messages: 12
Registered: May 2012
Junior Member
Thanks Christian,

that hadn't solved my problem directly, but it can never be wrong to read some basics again Wink

---
Previous Topic:error running workflow
Next Topic:Dynamic Template Proposals in Xtext
Goto Forum:
  


Current Time: Thu Apr 25 09:51:04 GMT 2024

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

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

Back to the top