langium icon indicating copy to clipboard operation
langium copied to clipboard

`Maximum call stack size exceeded` because of missing assignments

Open Lotes opened this issue 2 years ago • 1 comments

Langium version: 2.0.1

Steps To Reproduce

I tried to create a new grammar, copy-pasting from an ANTLR grammar. I was about to assign property names. The first rule in this playground link is missing these property names.

Bad: entry Collection: '['(ElementCollection(',' ElementCollection)*)?']'; Good: entry Collection: '['(elements+=ElementCollection(',' elements+=ElementCollection)*)?']';

The current behavior

By adding names, the error disappears. But without, I get an Unhandled Promise Rejection: RangeError: Maximum call stack size exceeded. and a took a while to find the trigger for this error.

The expected behavior

It would be good to have some pointer, what is wrong or which rule caused this stack overflow. After some attempts of debugging, I just guessed to add more assignments.

Lotes avatar Oct 30 '23 15:10 Lotes

We could show an error in the grammar editor when you write an unassigned rule call with * or + multiplicity. I can't imagine any case where that would be useful.

spoenemann avatar Oct 30 '23 15:10 spoenemann

Unfortunately, I discovered that my validation rule breaks the correct domainmodel and requirements examples:

grafik

For both data type rules, and cross-references, the call to the ID terminal rule causes an error that shouldn't be there.

bjthehun avatar Apr 02 '24 11:04 bjthehun

These errors also appeared in the lint job of the build pipeline, but did not cause the pipeline to fail: https://github.com/eclipse-langium/langium/actions/runs/8239259881/job/22532070389 I'll open an issue so that this CI problem will be fixed.

bjthehun avatar Apr 02 '24 12:04 bjthehun