Community
Participate
Working Groups
The following grammar causes xtext to hang while generating artifacts: grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.common.Terminals generate myDsl "mydsl" Model: greetings+=Expr*; Expr returns Expr: i=INT | '(' Expr ')' | '[' Expr ']' | '{' Expr '}' ; This hangs with the following output: 0 [main] INFO lipse.emf.mwe.utils.StandaloneSetup - Registering platform uri 'C:\eclipse-xtext\workspace' 606 [main] INFO ipse.emf.mwe.utils.DirectoryCleaner - Cleaning C:\eclipse-xtext\workspace\org.xtext.example.mydsl\..\org.xtext.example.mydsl\src-gen 637 [main] INFO ipse.emf.mwe.utils.DirectoryCleaner - Cleaning C:\eclipse-xtext\workspace\org.xtext.example.mydsl\..\org.xtext.example.mydsl.ui\src-gen 776 [main] INFO ipse.xtext.generator.LanguageConfig - generating infrastructure for org.xtext.example.mydsl.MyDsl 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 2034 [main] INFO clipse.emf.mwe.utils.GenModelHelper - Registered GenModel 'mydsl' from 'file:/C:/eclipse-xtext/workspace/org.xtext.example.mydsl/src-gen/org/xtext/example/mydsl/MyDsl.genmodel'
Quoting the newsgroup: it works if you dont choose the experimental features in the xtext project wizard. it works with the 2.1.0 nightlys with the experimental features neither. Seems to be related to one of the new fragments.
Seems like I got similar problem with my grammar. The MWE workflow hangs on the new experimental Serializer fragment, but works on the old one. During debug mode it appears to loop on finding alternatives. I can provide more details if required.
(In reply to comment #2) > I can provide more details if required. A grammar snippet would help if it looks different from the case in comment #0
Reproducable with this even simpler example: Expr : i=INT | '(' Expr ')' | '[' Expr ']' | '{' Expr '}' ;
fixed & pushed to master: http://git.eclipse.org/c/tmf/org.eclipse.xtext.git/commit/?id=505f6a2976400fc96352e57aa1e3b02bb66bada2 Thanks for the minimal example. It made it much easier to track down the problem. The problem was that syntactically, INT can be prefixed with any amount of "(", "[", or "{". In the code that is generated by the SerializerFragment, this is visualized using grammar notation: ("(" | "[" | "{")*. The internal algorithm which converts state machines to grammar snippets didn't detect alternatives with cardinality * correctly.
This bug seems to have re-appeared. The example hangs in Xtext 2.12.0.
This is the stack when the generator hangs: GenerateMyDsl.mwe2 [Mwe2 Launch] org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher at localhost:54878 Thread [main] (Suspended) System.identityHashCode(Object) line: not available [native method] HashMap$TreeNode<K,V>.tieBreakOrder(Object, Object) line: 1896 HashMap$TreeNode<K,V>.putTreeVal(HashMap<K,V>, Node<K,V>[], int, K, V) line: 1992 LinkedHashMap<K,V>(HashMap<K,V>).putVal(int, K, V, boolean, boolean) line: 637 LinkedHashMap<K,V>(HashMap<K,V>).put(K, V) line: 611 LinkedHashSet<E>(HashSet<E>).add(E) line: 219 PdaUtil$HashStack<T>.push(T) line: 71 PdaUtil.filterEdges(Pda<S,P>, Traverser<Pda<S,P>,S,R>, Map<S,Integer>, PdaFactory<D,S,P,S>) line: 454 ContextTypePDAProvider.collectTypes(Pda<ISerState,RuleCall>, Map<ISerState,Integer>) line: 241 ContextTypePDAProvider.getContextTypePDAs(Grammar) line: 264 SyntacticSequencerPDAProvider.getSyntacticSequencerPDAs(Grammar) line: 596 SemanticSequencerNfaProvider.getSemanticSequencerNFAs(Grammar) line: 239 GrammarConstraintProvider.getConstraints(Grammar) line: 621 SemanticSequencerExtensions.xtend line: 97 SerializerFragment2.xtend line: 212 SerializerFragment2.xtend line: 141 CompositeGeneratorFragment2.xtend line: 40 XtextGenerator.xtend line: 168 XtextGenerator(AbstractWorkflowComponent).invoke(WorkflowContext, ProgressMonitor, Issues) line: 126 Mwe2Bridge.invoke(IWorkflowContext) line: 34 XtextGenerator(AbstractWorkflowComponent).invoke(IWorkflowContext) line: 201 Workflow(AbstractCompositeWorkflowComponent).invoke(IWorkflowContext) line: 35 Workflow.run(IWorkflowContext) line: 19 Mwe2Runner.run(Module, Map<String,String>, IWorkflowContext) line: 102 Mwe2Runner.run(URI, Map<String,String>, IWorkflowContext) line: 62 Mwe2Runner.run(URI, Map<String,String>) line: 52 Mwe2Launcher.run(String[]) line: 78 Mwe2Launcher.main(String[]) line: 36
Hi, I am curious when this bug might be resolved, and if not resolved, are there any workarounds? Currently we are exercising this bug on a language we're using for a production tool. The good news is the language generates after a lengthy period of time, about half an hour. I've observed that it takes roughly half an hour no matter what machine I'm running it on. Is it possible that after some timeout that the tool uses a different language generator? If so, is that timeout configurable? The half hour wait period is not intolerable, but is a bit of an obstacle when trying to train others in the tool's development. I'm running Photon with Xtext 2.14 and still seeing this issue. Thanks!
@Lucas. could you please provide a minimal reproducing grammar?
The following grammar takes roughly 3 minutes to generate. So it does not hang any longer, but does seem rather inefficient. Expr : i=INT | '(' Expr ')' | '[' Expr ']' | '{' Expr '}' ; This was tested just now on Photon 4.8.0 and Xtext 2.16.