Skip to content

Untyped Lambda Calculus: application needs brackets around function #1

@dvberkel

Description

@dvberkel

Our parser combinator framework returns all possible parsings of an input. Without the bracketed part in the applicationParser

applicationParser : Parser Context Term
applicationParser =
    let
        eventuallyTerm =
            Parser.lazy (\_ -> parser)
    in
    Parser.bracketed '(' ')' eventuallyTerm
        |> Parser.keepThenIgnore (many space)
        |> Parser.followedBy eventuallyTerm
        |> Parser.map (\( l, r ) -> TmApp l r)

could not consume any input and happily go down an infinite stack hole.

Because bracketed consumes '(' in order to succeed, this is prevented.

This is artifical and ideally should be prevented.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions