Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Serialization: Tolerant Expressions Grammar
Serialization: Tolerant Expressions Grammar [message #655691] Tue, 22 February 2011 05:37 Go to next message
Eclipse UserFriend
Hi,

I just designed an expressions grammar and I would like to design concrete expressions in the XTextEditor and in the Sample EMF Editor. Unfortunately, I cannot write the expressions grammar very tolerant as the parser could not be generated in that case.

In consequence, it is easy to write syntactically incorrect expressions in the Sample EMF Editor. These expressions cannot be saved and very hardly debugged in the Sample EMF Editor.

Do you have an alternative idea how to make the Sample EMF Editor not crash that easily when saving?
Re: Serialization: Tolerant Expressions Grammar [message #655901 is a reply to message #655691] Wed, 23 February 2011 04:03 Go to previous messageGo to next message
Eclipse UserFriend
Looks like a question for the EMF newsgroup.

If you plan to use other editors than the textual Xtext editor, it's
generally a good idea to write a more tolerant grammar and esure the
strictness by means of validation rules. See the section on EMF
Integration in the Xtext user guide for hints how to do that.

Am 22.02.11 11:37, schrieb Martin:
> Hi,
>
> I just designed an expressions grammar and I would like to design
> concrete expressions in the XTextEditor and in the Sample EMF Editor.
> Unfortunately, I cannot write the expressions grammar very tolerant as
> the parser could not be generated in that case.
>
> In consequence, it is easy to write syntactically incorrect expressions
> in the Sample EMF Editor. These expressions cannot be saved and very
> hardly debugged in the Sample EMF Editor.
>
> Do you have an alternative idea how to make the Sample EMF Editor not
> crash that easily when saving?


--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Re: Serialization: Tolerant Expressions Grammar [message #655953 is a reply to message #655901] Wed, 23 February 2011 09:05 Go to previous messageGo to next message
Eclipse UserFriend
Hi Jan,

I got the idea of making the grammar more tolerant from your docs and blogs. But I was wondering if this is possible for algebraic expressions, too.

Xbase expressions are not implemented in a tolerant way, right?

I dont unserstand why this is a question to the EMF, isnt it more a question of whether a tolerant LL(k) grammar is possible to design with tolerant algebraic expressions?
Re: Serialization: Tolerant Expressions Grammar [message #656011 is a reply to message #655953] Wed, 23 February 2011 13:04 Go to previous messageGo to next message
Eclipse UserFriend
Hi Martin,

what do you mean by 'tolerant expressions'?

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 23.02.11 15:05, schrieb Martin:
> Hi Jan,
>
> I got the idea of making the grammar more tolerant from your docs and
> blogs. But I was wondering if this is possible for algebraic
> expressions, too.
>
> Xbase expressions are not implemented in a tolerant way, right?
>
> I dont unserstand why this is a question to the EMF, isnt it more a
> question of whether a tolerant LL(k) grammar is possible to design with
> tolerant algebraic expressions?
Re: Serialization: Tolerant Expressions Grammar [message #656020 is a reply to message #656011] Wed, 23 February 2011 14:03 Go to previous messageGo to next message
Eclipse UserFriend
Hi Sebastian,

I mean it would be nice if the grammar would also parse syntactically invalid expressions, e.g. "1 + " and its correctness later be validated. This way in the Sample EMF Editor you could create a BinaryExpression and just give it the AdditionOperator and an IntegerLiteral child.

Optimally, I would like to be able to serialize any expression node in the EMF Editor which has no children to allow the user to contructs arbitrarily broken expressions Smile

[Updated on: Wed, 23 February 2011 14:26] by Moderator

Re: Serialization: Tolerant Expressions Grammar [message #656024 is a reply to message #656011] Wed, 23 February 2011 14:25 Go to previous messageGo to next message
Eclipse UserFriend
No Message Body

[Updated on: Wed, 23 February 2011 14:25] by Moderator

Re: Serialization: Tolerant Expressions Grammar [message #656028 is a reply to message #656020] Wed, 23 February 2011 14:08 Go to previous messageGo to next message
Eclipse UserFriend
Hi Martin,

the parser will create the mentioned incomplete expression - depending
on how you write your grammar. This error recovery suffers from
backtracking (if you enable it in your grammar) but works pretty well
for many cases.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 23.02.11 20:05, schrieb Martin:
> Hi Sebastian,
>
> I mean it would be nice if the grammar would also parse syntactically
> invalid expressions, e.g. "1 + " and its correctness later be validated.
> This way in the Sample EMF Editor you could not create a
> BinaryExpression and just give it the AdditionOperator and an
> IntegerLiteral child.
>
> Optimally, I would like to be able to serialize any expression node in
> the EMF Editor which has no children to allow the user to contructs
> arbitrarily broken expressions :)
Re: Serialization: Tolerant Expressions Grammar [message #656040 is a reply to message #656028] Wed, 23 February 2011 16:20 Go to previous message
Eclipse UserFriend
Hi Sebastian,

I am not sure whether I get your point. I have binary expression productions like this:

Addition:
Multiplication ('+' Multiplication)*

Parsing with this one works fine but not serialization of for example an addition node without children. But I would like to have productions that behave like this:

Addition:
Multiplication? ('+' Multiplication?)*

Ideally, this one would offer exception-free serialization, right? But unfortunately, I cannot use ones like these, right?

I was wondering if there is another twist that I dont know of.

[Updated on: Wed, 23 February 2011 16:24] by Moderator

Previous Topic:Serialization: Missing whitespaces lead to parsing failure
Next Topic:OCL and XTEXT
Goto Forum:
  


Current Time: Sat Jul 05 09:14:20 EDT 2025

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

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

Back to the top