fan icon indicating copy to clipboard operation
fan copied to clipboard

Parsing error in fan parser (infix problem)

Open ngunn opened this issue 10 years ago • 1 comments

let f x = x * x

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

> ./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.

ngunn avatar Feb 19 '14 17:02 ngunn

Fixed in commit fc191fbfd456e7cdcca87c5b1359794c96dbd82c (see comment for that commit for more details)

ngunn avatar Feb 19 '14 18:02 ngunn