Skip to main content



      Home
Home » Modeling » TMF (Xtext) » need explanation regarding assignments
need explanation regarding assignments [message #870552] Tue, 08 May 2012 12:23 Go to next message
Eclipse UserFriend
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 14:26] by Moderator

Re: need explanation regarding assignments [message #870565 is a reply to message #870552] Tue, 08 May 2012 14:34 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: need explanation regarding assignments [message #870726 is a reply to message #870565] Wed, 09 May 2012 09:22 Go to previous message
Eclipse UserFriend
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: Wed Jul 23 05:12:24 EDT 2025

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

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

Back to the top