Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Does Xtext have limitation on the size of the grammar?(a strang error ralated to {project}Package.Literals)
Does Xtext have limitation on the size of the grammar? [message #696688] Thu, 14 July 2011 15:25 Go to next message
alex.ren2006 is currently offline alex.ren2006Friend
Messages: 46
Registered: June 2011
Member
I am currently working on building an IDE for ATS (www.ats-lang.org). The grammar file has more than 1000 lines and everything works well on Xtext2. (I can start the ide for ats with syntax highlighting and outline which are very cool.) Today I spent sometime in improving the grammar file. (Most of the work is to add more assignment into the grammar file.) The editor of grammar file shows no error. Then I run the "GenerateAnairiatsSats.mwe2", the following is the output which seems normal.
=============================
0    [main] INFO  lipse.emf.mwe.utils.StandaloneSetup  - Registering platform uri '/home/alex/depo/ats_ide'
1617 [main] INFO  ipse.emf.mwe.utils.DirectoryCleaner  - Cleaning /home/alex/depo/ats_ide/org.ats_lang.ide.sats/../org.ats_lang.ide.sats/src-gen
1647 [main] INFO  ipse.emf.mwe.utils.DirectoryCleaner  - Cleaning /home/alex/depo/ats_ide/org.ats_lang.ide.sats/../org.ats_lang.ide.sats.ui/src-gen
1805 [main] INFO  ipse.xtext.generator.LanguageConfig  - generating infrastructure for org.ats_lang.AnairiatsSats with fragments : ImplicitRuntimeFragment, ImplicitUiFragment, GrammarAccessFragment, EcoreGeneratorFragment, SerializerFragment, ResourceFactoryFragment, XtextAntlrGeneratorFragment, JavaValidatorFragment, ImportNamespacesScopingFragment, QualifiedNamesFragment, BuilderIntegrationFragment, GeneratorFragment, FormatterFragment, LabelProviderFragment, OutlineTreeProviderFragment, QuickOutlineFragment, QuickfixProviderFragment, JavaBasedContentAssistFragment, XtextAntlrUiGeneratorFragment, Junit4Fragment, TypesGeneratorFragment, XbaseGeneratorFragment, CodetemplatesGeneratorFragment, RefactorElementNameFragment, CompareFragment
8388 [main] INFO  clipse.emf.mwe.utils.GenModelHelper  - Registered GenModel 'http://www.ats_lang.org/AnairiatsSats' from 'file:/home/alex/depo/ats_ide/org.ats_lang.ide.sats/src-gen/org/ats_lang/AnairiatsSats.genmodel'
24209 [main] INFO  or.validation.JavaValidatorFragment  - generating Java-based EValidator API
43585 [main] INFO  text.generator.junit.Junit4Fragment  - generating Junit4 Test support classes
43595 [main] INFO  text.generator.junit.Junit4Fragment  - generating Compare Framework infrastructure
43668 [main] INFO  .emf.mwe2.runtime.workflow.Workflow  - Done.

=============================

Then I notice that there are many errors in the file "src-get/org.ats_lang.serializer/AbstractAnairiatsSatsSemanticSequencer.java". The errors are similar as follows
===============================
	protected void sequence_guad0ec_dyn_guad0ec_dyn(EObject context, guad0ec_dyn semanticObject) {
		if(errorAcceptor != null) {
			if(transientValues.isValueTransient(semanticObject, Test1Package.Literals.GUAD0EC_DYN__MCOND) == ValueTransient.YES)
				errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, Test1Package.Literals.GUAD0EC_DYN__MCOND));
			if(transientValues.isValueTransient(semanticObject, Test1Package.Literals.GUAD0EC_DYN__MTHEN) == ValueTransient.YES)
				errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, Test1Package.Literals.GUAD0EC_DYN__MTHEN));
			if(transientValues.isValueTransient(semanticObject, Test1Package.Literals.GUAD0EC_DYN__MCRAZY) == ValueTransient.YES)
				errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, Test1Package.Literals.GUAD0EC_DYN__MCRAZY));
		}
		INodesForEObjectProvider nodes = createNodeProvider(semanticObject);
		SequenceFeeder feeder = createSequencerFeeder(semanticObject, nodes);
		feeder.accept(grammarAccess.getGuad0ec_dynAccess().getM_condE0xpParserRuleCall_0_0(), semanticObject.getM_cond());
		feeder.accept(grammarAccess.getGuad0ec_dynAccess().getM_thenXx2Keyword_1_0(), semanticObject.getM_then());
		feeder.accept(grammarAccess.getGuad0ec_dynAccess().getM_crazyCrazyParserRuleCall_2_0(), semanticObject.getM_crazy());
		feeder.finish();
	}

=============================
"semanticObject, Test1Package.Literals.GUAD0EC_DYN__MCOND" requires "Literals". But there is no "Literals" in the "Test1Package".

As usual, I tried to trim some of the grammar to locate the cause of the problem. After removing certain parts of the grammar, everything goes back to normal. If I add some more rules (simple rules which have nothing to do with the existing grammar) into the grammar file, the errors show up again.

I didn't post the grammar here because I think the content of the grammar is irrelevant to the problem. Anyone else has met such problem before?

Thanks a lot.

[Updated on: Thu, 14 July 2011 15:27]

Report message to a moderator

Re: Does Xtext have limitation on the size of the grammar? [message #696729 is a reply to message #696688] Thu, 14 July 2011 18:05 Go to previous messageGo to next message
Alexander Nittka is currently offline Alexander NittkaFriend
Messages: 1193
Registered: July 2009
Senior Member
Hi,

if I remember correctly, in another post it was stated that if the Package genereted by the EMF framework gets too big, the inner Literals-Interface will not be generated. I guess this is what happens in your case. Some of the code generated by the Xtext framework itself relies on that interfae to exist.

Alex
(no subject) [message #696792 is a reply to message #696688] Thu, 14 July 2011 20:28 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi,

thanks for the hint. I filed a ticket:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=352162

As long as the new serializer does not work for you (it's still under
heavy development), you may want to disable the SerializerFragment and
use the ParsetreeConstructorFragment instead.

To answer your question: No, Xtext does not limit the size of your
grammar, although you may run into Antlr issues, which will be adressed
in the next service release:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=349992

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

On 14.07.11 17:25, forums-noreply@eclipse.org wrote:
> I am currently working on building an IDE for ATS (www.ats-lang.org).
> The grammar file has more than 1000 lines and everything works well on
> Xtext2. (I can start the ide for ats with syntax highlighting and
> outline which are very cool.) Today I spent sometime in improving the
> grammar file. (Most of the work is to add more assignment into the
> grammar file.) The editor of grammar file shows no error. Then I run the
> "GenerateAnairiatsSats.mwe2", the following is the output which seems
> normal.
> =============================
> 0 [main] INFO lipse.emf.mwe.utils.StandaloneSetup - Registering platform
> uri '/home/alex/depo/ats_ide'
> 1617 [main] INFO ipse.emf.mwe.utils.DirectoryCleaner - Cleaning
> /home/alex/depo/ats_ide/org.ats_lang.ide.sats/../org.ats_lang.ide.sats/src-gen
>
> 1647 [main] INFO ipse.emf.mwe.utils.DirectoryCleaner - Cleaning
> /home/alex/depo/ats_ide/org.ats_lang.ide.sats/../org.ats_lang.ide.sats.ui/src-gen
>
> 1805 [main] INFO ipse.xtext.generator.LanguageConfig - generating
> infrastructure for org.ats_lang.AnairiatsSats with fragments :
> ImplicitRuntimeFragment, ImplicitUiFragment, GrammarAccessFragment,
> EcoreGeneratorFragment, SerializerFragment, ResourceFactoryFragment,
> XtextAntlrGeneratorFragment, JavaValidatorFragment,
> ImportNamespacesScopingFragment, QualifiedNamesFragment,
> BuilderIntegrationFragment, GeneratorFragment, FormatterFragment,
> LabelProviderFragment, OutlineTreeProviderFragment,
> QuickOutlineFragment, QuickfixProviderFragment,
> JavaBasedContentAssistFragment, XtextAntlrUiGeneratorFragment,
> Junit4Fragment, TypesGeneratorFragment, XbaseGeneratorFragment,
> CodetemplatesGeneratorFragment, RefactorElementNameFragment,
> CompareFragment
> 8388 [main] INFO clipse.emf.mwe.utils.GenModelHelper - Registered
> GenModel 'http://www.ats_lang.org/AnairiatsSats' from
> 'file:/home/alex/depo/ats_ide/org.ats_lang.ide.sats/src-gen/org/ats_lang/AnairiatsSats.genmodel'
>
> 24209 [main] INFO or.validation.JavaValidatorFragment - generating
> Java-based EValidator API
> 43585 [main] INFO text.generator.junit.Junit4Fragment - generating
> Junit4 Test support classes
> 43595 [main] INFO text.generator.junit.Junit4Fragment - generating
> Compare Framework infrastructure
> 43668 [main] INFO .emf.mwe2.runtime.workflow.Workflow - Done.
> =============================
>
> Then I notice that there are many errors in the file
> "src-get/org.ats_lang.serializer/AbstractAnairiatsSatsSemanticSequencer.java".
> The errors are similar as follows
> ===============================
> protected void sequence_guad0ec_dyn_guad0ec_dyn(EObject context,
> guad0ec_dyn semanticObject) {
> if(errorAcceptor != null) {
> if(transientValues.isValueTransient(semanticObject,
> Test1Package.Literals.GUAD0EC_DYN__MCOND) == ValueTransient.YES)
> errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject,
> Test1Package.Literals.GUAD0EC_DYN__MCOND));
> if(transientValues.isValueTransient(semanticObject,
> Test1Package.Literals.GUAD0EC_DYN__MTHEN) == ValueTransient.YES)
> errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject,
> Test1Package.Literals.GUAD0EC_DYN__MTHEN));
> if(transientValues.isValueTransient(semanticObject,
> Test1Package.Literals.GUAD0EC_DYN__MCRAZY) == ValueTransient.YES)
> errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject,
> Test1Package.Literals.GUAD0EC_DYN__MCRAZY));
> }
> INodesForEObjectProvider nodes = createNodeProvider(semanticObject);
> SequenceFeeder feeder = createSequencerFeeder(semanticObject, nodes);
> feeder.accept(grammarAccess.getGuad0ec_dynAccess().getM_condE0xpParserRuleCall_0_0(),
> semanticObject.getM_cond());
> feeder.accept(grammarAccess.getGuad0ec_dynAccess().getM_thenXx2Keyword_1_0(),
> semanticObject.getM_then());
> feeder.accept(grammarAccess.getGuad0ec_dynAccess().getM_crazyCrazyParserRuleCall_2_0(),
> semanticObject.getM_crazy());
> feeder.finish();
> }
> =============================
> "semanticObject, Test1Package.Literals.GUAD0EC_DYN__MCOND" requires
> "Literals". But there is no "Literals" in the "Test1Package".
>
> As usual, I tried to trim some of the grammar to locate the cause of the
> problem. After removing certain parts of the grammar, everything goes
> back to normal. If I add some more rules (simple rules which have
> nothing to do with the existing grammar) into the grammar file, the
> errors show up again.
>
> I didn't post the grammar here because I think the content of the
> grammar is irrelevant to the problem. Anyone else has met such problem
> before?
>
> Thanks a lot.
Re: (no subject) [message #696835 is a reply to message #696792] Thu, 14 July 2011 22:49 Go to previous message
alex.ren2006 is currently offline alex.ren2006Friend
Messages: 46
Registered: June 2011
Member
Thank you so much for your answer. Xtext is a great tool because of all of you.

Previous Topic:[Xtend2] Code Reference
Next Topic:Include/Import other models in an Xtext DSL for an existing ecore model
Goto Forum:
  


Current Time: Thu Apr 25 17:05:12 GMT 2024

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

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

Back to the top