# Recursive parser raises "RangeError: Maximum call stack size exceeded"

**URL:** https://discourse.elm-lang.org/t/recursive-parser-raises-rangeerror-maximum-call-stack-size-exceeded/5856
**Category:** Learn
**Created:** [May 29, 2020, 3:35am UTC](https://discourse.elm-lang.org/t/recursive-parser-raises-rangeerror-maximum-call-stack-size-exceeded/5856 "2020-05-29T03:35:42Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![kephas](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/kephas/32/2768_2.png) [@kephas](https://discourse.elm-lang.org/u/kephas)
#### Post date: [May 29, 2020, 3:35am UTC](https://discourse.elm-lang.org/t/recursive-parser-raises-rangeerror-maximum-call-stack-size-exceeded/5856/1 "2020-05-29T03:35:42Z")

</div>

I’m trying to parse Lambda Calculus for an implementation I made of it:

> <https://github.com/kephas/elm-lambda-playground/blob/ff1e9e8de3ebe1900c84e35c0cda5d1c441a2bfd/src/Lambda/Parser.elm#L36-L59>

In the definition of `expression`, if I remove `application`, parsing variables and lambdas works fine (cf. tests). But as it is, it gives me the error `RangeError: Maximum call stack size exceeded`. I don’t understand why my definition of `application` creates an endless loop.

---

<div class="post-metadata">

### Author: ![malaire](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@malaire](https://discourse.elm-lang.org/u/malaire)
#### Post date: [May 29, 2020, 7:33am UTC](https://discourse.elm-lang.org/t/recursive-parser-raises-rangeerror-maximum-call-stack-size-exceeded/5856/2 "2020-05-29T07:33:38Z")

</div>

`application` starts by parsing `lexpression`, which parses `expression`, which starts by parsing `application` and so there is a loop.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex035/uploads/elm_lang/original/1X/50a05e53677a2c3b47776d7abd0f113eb50193a1.png) [@system](https://discourse.elm-lang.org/u/system)
#### Post date: [June 8, 2020, 7:33am UTC](https://discourse.elm-lang.org/t/recursive-parser-raises-rangeerror-maximum-call-stack-size-exceeded/5856/3 "2020-06-08T07:33:39Z")

</div>

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
