Skip to main content



      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 04:19 Go to next message
Eclipse UserFriend
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 14:25 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: Reading the .mydsl file [message #897638 is a reply to message #897460] Tue, 24 July 2012 16:39 Go to previous messageGo to next message
Eclipse UserFriend
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 02:38 Go to previous message
Eclipse UserFriend
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: Fri Jul 04 03:05:18 EDT 2025

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

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

Back to the top