Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Extending Java Grammar
Extending Java Grammar [message #1703486] Sat, 01 August 2015 07:09 Go to next message
waltervt88gmail.com Dirksen is currently offline waltervt88gmail.com DirksenFriend
Messages: 1
Registered: July 2015
Junior Member
I'd like to add operator overloading and custom operators to the Java grammar. I believe it is not possible in Xtext to inherit and extent the Java grammar by default and add this custom behavior. A possible approach includes porting the antlr Java grammar to Xtext; an unattractive approach. I am also wondering if it possible to add custom operators, for example but purely illustrative: <|.

Another approach seems taking the XTend grammar and make it more like Java. As I am new to XText I'm most likely missing better alternatives. Please advise.
Re: Extending Java Grammar [message #1703615 is a reply to message #1703486] Mon, 03 August 2015 16:22 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14716
Registered: July 2009
Senior Member
I recommed you to have a look at xbase (the expression part of xtext) it is covered in the xtext tutorial in the docs (have a look at domainmodel example as well)
Maybe the following is interesting for you as well https://github.com/LorenzoBettini/javamm


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Mon, 03 August 2015 16:23]

Report message to a moderator

Re: Extending Java Grammar [message #1703620 is a reply to message #1703615] Mon, 03 August 2015 16:35 Go to previous message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1813
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 03/08/2015 18:22, Christian Dietrich wrote:
> Maybe the following is interesting for you as
> well https://github.com/LorenzoBettini/javamm

with that respect, I'm working on extracting from javamm a reusable
expression language which is a customization of Xbase but with Java
expression language. I can't promise it'll be ready by the end of
August, but I'm working on that :)

Of course, you need to be familiar with Xbase concepts though.

cheers
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it
Xtext Book:
http://www.packtpub.com/implementing-domain-specific-languages-with-xtext-and-xtend/book


Previous Topic:Hidden tokens are replaced by a whitespace
Next Topic:How to reuse existing yacc grammar in xtext
Goto Forum:
  


Current Time: Mon Sep 23 04:08:41 GMT 2024

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

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

Back to the top