test dangling else grammar

This commit is contained in:
ChUrl
2020-12-07 23:34:44 +01:00
parent cafa6f3981
commit 2543f700f9
2 changed files with 18 additions and 0 deletions

View File

@ -0,0 +1,8 @@
START: stmt
EPS: epsilon
TERM: expr if else then other
NTERM: stmt matched open
stmt -> matched | open
matched -> if expr then matched else matched | other
open -> if expr then stmt | if expr then matched else open

View File

@ -0,0 +1,10 @@
class DanglingElse {
public static void main(String[] args) {
if (expr) {
expr;
} else {
expr;
}
}
}