Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ambiguous parsing #6

Open
egormkn opened this issue Mar 21, 2020 · 1 comment
Open

Ambiguous parsing #6

egormkn opened this issue Mar 21, 2020 · 1 comment
Assignees
Labels
test case Witnesses an error in other library

Comments

@egormkn
Copy link

egormkn commented Mar 21, 2020

Problem
I found a bug in lama parser, that is somehow connected to ambiguous grammar rules for case expression and infix operators.

Example code

infix | at ++ (lhs, rhs) {
  lhs ++ rhs
}

infix -> at ++ (lhs, rhs) {
  lhs ++ rhs
}

(* Prints "WAT" *)
printf ("%s\n", 
  case "?" of
    "?" -> "W" 
  | "A" -> "T"
  esac.string
);

(* Prints W *)
printf ("%s\n", 
  case "?" of
    "?" -> "W" 
  | "A" -> "T"
  esac
)

Expected behaviour
Both outputs are quite reasonable but they should be the same for both expressions.

Environment

@dboulytchev dboulytchev added the test case Witnesses an error in other library label Apr 9, 2020
@dboulytchev
Copy link
Collaborator

#5 (comment)

@dboulytchev dboulytchev self-assigned this Apr 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test case Witnesses an error in other library
Projects
None yet
Development

No branches or pull requests

2 participants