Skip to main content



      Home
Home » Modeling » TMF (Xtext) » [Xbase] Scripting Language
[Xbase] Scripting Language [message #1411159] Fri, 22 August 2014 10:38 Go to next message
Eclipse GuestFriend
Messages: 93
Registered: February 2013
Location: Vienna
Member
Hello to everyone. I'm a student. At the moment i would like to implement the "Scripting Language" for Xtext illustrated in the official guide.
I'm using the last version of Eclipse (Luna) with Xtext and Xbase 2.6
In the tutorial we have the specification of Xbase libraries instead of Terminals, the import of Xbase libraries from "http://www.eclipse.org/xtext/xbase/Xbase" and the definition of the model "Script"

Script returns XBlockExpression
    {Script}
    (expressions += XExpressionsInsideBlock ';'?)*;


After that i wrote the grammar, i obtained this error
"XExpressionsInsideBlock" cannot be resolve as a rule

I would like to define a tiny version of Java with the basic type and basic operators,
without definition of class.

Can i resolve this problem?
Thank you
Re: [Xbase] Scripting Language [message #1411177 is a reply to message #1411159] Fri, 22 August 2014 11:27 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

in Xtext 2.6.2 the rulename has changed to XExpressionOrVarDeclaration
Re: [Xbase] Scripting Language [message #1411828 is a reply to message #1411177] Sun, 24 August 2014 11:12 Go to previous messageGo to next message
Eclipse GuestFriend
Messages: 93
Registered: February 2013
Location: Vienna
Member
Thank you very much for your reply. It works!
Now i have another problems, related to variable and our visibility in the code.
I defined the following grammar:

Domainmodel:
	importSection=XImportSection?
	elements+=AbstractElement*
;

AbstractElement:
	PackageDeclaration | Entity
;

PackageDeclaration:
	'package' name=QualifiedName '{'
		elements+=AbstractElement*
	'}'
;

Entity:
	'entity' name=ValidID
	('extends' superType=JvmTypeReference)? '{'
		features+=Feature*
	'}'
;

Feature:
	Property | Operation	
;

//Dichiarazione variabili
Property:
	 type=JvmTypeReference name=ValidID ';'
;

Operation:
	'function' name=ValidID
	'('(params+=FullJvmFormalParameter
		(',' params+=FullJvmFormalParameter)*)? ')'
	':' type=JvmTypeReference
	body=XBlockExpression	
;


Now i can declare variable in a java way, but when i try to use a variable inside the "function", i obtain this error "Couldn't resolve reference to JvmIdentifiableElement".
please how can i resolve this problem?
Thank you very much
Re: [Xbase] Scripting Language [message #1411837 is a reply to message #1411828] Sun, 24 August 2014 11:42 Go to previous message
Eclipse UserFriend
hi

this is usually done by mapping the dsl concepts to java concepts in the jvmmodelinferrer
Previous Topic:Referencing elements of one DSL from another DSL
Next Topic:[SOLVED] Serializer Enum
Goto Forum:
  


Current Time: Mon Jun 30 18:36:42 EDT 2025

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