输入单词串,以“#”结束,如果是文法正确的句子,则输出成功信息,,否则输出“输入有误,输入了错误的符号:‘ ’”。
例如: 输入 {height=2;}#
输出 { ID= NUM;}
=>simpleexpr = NUM
=>multexprprime = empty
=>multexpr = simpleexpr multexprprime
=>assgstmt = ID=arithexpr;
=>stmt = assgstmt
=>stmts = empty
=>stmts = stmt stmts
=>compoundstmt = { stmts }
=>program = compoundstmt
接受!
输入 {aa}#
输出 { ID}输入有误,输入了错误的符号:‘}’
1