Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Reading the .mydsl file(A beginner question about using XText)
Reading the .mydsl file [message #897460] Tue, 24 July 2012 08:19 Go to next message
Robert Breunung is currently offline Robert BreunungFriend
Messages: 3
Registered: July 2012
Junior Member
Hello,

I want to parse a file with instructions of my DSL. I read the tutorial on the homepage and the documentation and I got a basic idea how to design the language. In the editor it worked all fine as described.

Now my scenario is: I have the basic mydsl, after starting a new project. I saved the "Hello World!" in that language into a file "hello.mydsl". I want to use the DSL in my own RCP App.

What do I have to do, to read the content of the file? How do I get the EMF representation?

Sincerely
Robert
Re: Reading the .mydsl file [message #897613 is a reply to message #897460] Tue, 24 July 2012 18:25 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13409
Registered: July 2009
Senior Member
Hi,

i am not quite sure what you exactly want to do. never the less the following may be a starting point.
http://christiandietrich.wordpress.com/2011/10/15/xtext-calling-the-generator-from-a-context-menu/
if not please give us more details about what you want to do.

~Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Reading the .mydsl file [message #897638 is a reply to message #897460] Tue, 24 July 2012 20:39 Go to previous messageGo to next message
Henrik Lindberg is currently offline Henrik LindbergFriend
Messages: 2509
Registered: July 2009
Senior Member
On 2012-24-07 10:19, Robert Breunung wrote:
> Hello,
>
> I want to parse a file with instructions of my DSL. I read the tutorial
> on the homepage and the documentation and I got a basic idea how to
> design the language. In the editor it worked all fine as described.
>
> Now my scenario is: I have the basic mydsl, after starting a new
> project. I saved the "Hello World!" in that language into a file
> "hello.mydsl". I want to use the DSL in my own RCP App.
>
> What do I have to do, to read the content of the file? How do I get the
> EMF representation?
>

1. You install (include the bundles for) your dsl along with xtext, emf,
etc. in your RCP application. Does your .mydsl depend on JDT (does it
just the java model in any way - classpath resolution of resources,
types, etc.)? If so, you need to include JDT.

2. You simply use EMF to open a .myDSL file (a Resource) - this will
trigger the parser and produce an EMF Resource with an EMF model.

Question somewhat unclear depending on what is in your RCP application,
and you want to allow users to do. Edit .mydsl files? Do you plan to
ship some .mydsl files as some sort of library that they are supposed to
just read/use in the form of a model? Do you want to generate things
from .mydsl and use that instead in the RCP?

etc.

Hope the general answer helps though.
- henrik
Re: Reading the .mydsl file [message #897692 is a reply to message #897638] Wed, 25 July 2012 06:38 Go to previous message
Robert Breunung is currently offline Robert BreunungFriend
Messages: 3
Registered: July 2012
Junior Member
Hello,

thanks for your hints. I will try your hints on next opportunity.

My intention is, to ship in my RCP application a minimal arithmetic language. I want to express a list of rules with the language, to aggregate some vales. This language should be used by the user of the application to configure the result.

Robert
Previous Topic:embedded languages
Next Topic:weird error with Guice
Goto Forum:
  


Current Time: Sun Mar 29 06:44:14 GMT 2020

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

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

Back to the top