Skip to content

Parsing error in fan parser (infix problem) #8

@ngunn

Description

@ngunn
let f x = x * x

doesn't generate the correct ast with Jan 19 codebase (commit 5a8fe53):

> ./pmake fan.run
> ./fan.run -loaded-parsers
Loaded Parsers: fan

> echo "let f x = x * x" > f.ml
> ./fan.run -printer o f.ml
File "f.ml", line 1, characters 12-13:
Failure: "EOI expected"

> echo "let f x = x ** x ** x" > f.ml
> ./fan.run -printer o f.ml
let f x = (x ** x) ** x

> echo "let f x = x / x" > f.ml
> ./fan.run -printer o f.ml
let f x = x / x

> echo "let f x = +. x" > f.ml
> ./fan.run -printer o f.ml
File "f.ml", line 1, characters 10-12:
Streamf.Error [exp] expected after "=" (in [cvalue_bind])

Anything with "*" fails. "**" should be right-associative. "+." as prefix should be accepted. Other infixes and prefixes succeed.

I have a fix that I'll post asap.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions