Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Questions around XBase(Is XBase designed around pure Eclipse use-cases or does it integrate with JavaCC/ANTLR outside of the XText environment?)
Questions around XBase [message #642506] Wed, 01 December 2010 15:54 Go to next message
Chris Ainsley is currently offline Chris AinsleyFriend
Messages: 78
Registered: March 2010
Location: UK
Member
I am trying to decide if XBase appropriate for my framework.

My Use-Case Scenario

I have a library that I am currently working with XText (initial stages) and JavaCC in parallel together to develop a new more concise DSL. I am using XText purely for editor integration so I do not require XText to process my model beyond applying the validation and scoping rules.

At the same time as writing the XText grammar, I am trying to update the JavaCC grammar. The reason for this is that my library must have a very small footprint at runtime (currently less than a megabyte for the core with no external jar dependencies) and cannot afford to use XText for my runtime parsing (although of course this duplicates effort).

In my DSL currently, I have a blocks of text that represent expressions that I extract from their contexts and dynamically generate Java code upon reading the model. The expression validation at runtime within my framework consists of checking for compiler errors in the Java code but I'd prefer the editor to be more pro-active in its auto-completes and expression validation so that the user is aware of syntax and scoping errors within Eclipse before execution.

Questions


  • Will XBase be supported outside of the XText infrastructure (ANTLR/JAVACC AST integration)?
  • That is, can I mix-in the XBase javaCC grammar and feed the AST into the XBase compiler and emit Java code same as via the XText parser (without xtext jar files)? Does the compiler expect me to provide scoping and integration injection + AST?
  • What will be the size of the XBase compiler .jar files approximately (in megabytes)? Which libraries are XBase languages dependent on? More GUICE?
  • How much control will the DSL author have over the templates available to the Java emitter?
  • Will I be able to hold the XBase version to an older version in the future for my DSL or will it automatically be validated against the version that ships with the current version of XText (for the GUI side)?
  • Where can I find the current version of XBase for evaluation?
  • Not strictly XBase but will it be possible in XText 2.0 to refer to contextual Java grammar between two given tokens (similar to scriptlets in JSPs?)


I like the design of XBase as it has been presented thus far but weight and integration with JavaCC/ANTLR directly without XText is important for the language to be applicable for my particular use-case.

Thanks,

Chris
Re: Questions around XBase [message #642911 is a reply to message #642506] Fri, 03 December 2010 10:06 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Chris,

please find my comments inline.

Am 01.12.10 16:54, schrieb Chris Ainsley:
> I am trying to decide if XBase appropriate for my framework.

Please note that Xbase is still subject to heavy changes and
refactorings. I'd recommend to wait for the M5 / M6 until you evaluate
it for serious use cases.

>
> My Use-Case Scenario
>
> I have a library that I am currently working with XText (initial stages)
> and JavaCC in parallel together to develop a new more concise DSL. I am
> using XText purely for editor integration so I do not require XText to
> process my model beyond applying the validation and scoping rules.
>
> At the same time as writing the XText grammar, I am trying to update the
> JavaCC grammar. The reason for this is that my library must have a very
> small footprint at runtime (currently less than a megabyte for the core
> with no external jar dependencies) and cannot afford to use XText for my
> runtime parsing (although of course this duplicates effort).

You could try to create a generator fragment that derives your JavaCC
grammar from the Xtext grammar. This would minimize the effort for
keeping both in sync.

>
> In my DSL currently, I have a blocks of text that represent expressions
> that I extract from their contexts and dynamically generate Java code
> upon reading the model. The expression validation at runtime within my
> framework consists of checking for compiler errors in the Java code but
> I'd prefer the editor to be more pro-active in its auto-completes and
> expression validation so that the user is aware of syntax and scoping
> errors within Eclipse before execution.

Sounds like a reasonable use case for Xtext / Xbase.

>
> Questions
>
>
> Will XBase be supported outside of the XText infrastructure
> (ANTLR/JAVACC AST integration)?

No, languages derived from Xbase will always leverage the Xtext
infrastructure by default. Support for other parser frameworks or AST
models has to be implemented in your very own project or automatically
derived from the grammar by means of generator fragments.

> That is, can I mix-in the XBase javaCC grammar and feed the AST into the
> XBase compiler and emit Java code same as via the XText parser (without
> xtext jar files)? Does the compiler expect me to provide scoping and
> integration injection + AST?

Xbase compilers will create Java code by default. However, they are
extensible so you can basically derive any architecture that you need.
However, I didn't get the Xbase-javaCC grammar part. What do you mean?

> What will be the size of the XBase compiler .jar files approximately (in
> megabytes)? Which libraries are XBase languages dependent on? More GUICE?

The Xbase compiler / code generator will use Guice to be configured. But
as I already said there are no restrictions with respect to the code
that you want to generate from that. Necessary Jars will always be the
Xtext runtime dependencies and a Java compiler to actually get
exectuable code. You could of course write your own compiler based on
the given infrastructure and directly generate bytecode or whatever but
that would increase the complexity tremendously for the default use
cases and debugging would be more than worse. That's why we decided to
generate source code instead of byte code.

> How much control will the DSL author have over the templates available
> to the Java emitter?

Everything can be overwritten or replaced.

> Will I be able to hold the XBase version to an older version in the
> future for my DSL or will it automatically be validated against the
> version that ships with the current version of XText (for the GUI side)?

It will always be validated against the installed version of Xbase /
Xtext respectively.

> Where can I find the current version of XBase for evaluation?

In the Xtext git repository. See
http://git.eclipse.org/c/tmf/org.eclipse.xtext.git/

> Not strictly XBase but will it be possible in XText 2.0 to refer to
> contextual Java grammar between two given tokens (similar to scriptlets
> in JSPs?)
>

There are currently no plans to make that available as a feature in the
framework in the near future (Xtext 2.0). However, we did some
experiments and prototypes and technically that's possible for your very
own language.

>
> I like the design of XBase as it has been presented thus far but weight
> and integration with JavaCC/ANTLR directly without XText is important
> for the language to be applicable for my particular use-case.

I understand that but we try to leverage as much functionality as
possible from proven existing frameworks such as Antlr, EMF and Guice or
some Apache libs. There is currently no focus on the size (in MB) of the
runtime depedencies although we try to minimize the number of required
libraries itself.

>
> Thanks,
>
> Chris

You're welcome.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Re: Questions around XBase [message #643106 is a reply to message #642911] Sat, 04 December 2010 14:24 Go to previous message
Chris Ainsley is currently offline Chris AinsleyFriend
Messages: 78
Registered: March 2010
Location: UK
Member
Thanks Sebastian.

You really answered my key questions very clearly.

Regarding my course of action, I think that I should defer the problem for a while as you suggest until M5/M6 time and in the meantime use my unvalidated block technique for my scriptlets until I'm better equipped to deal with the problem.

In addition I am adding all of the XBase reserved tokens to my grammar as reserved words so that I can expand into XBase in the future without dropping backwards compatibility.

Thanks again,

Chris
Previous Topic:Bug in content assist, Xtext 1.0.1
Next Topic:Scriplets
Goto Forum:
  


Current Time: Fri Apr 26 17:40:48 GMT 2024

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

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

Back to the top