Description
Write unambiguous BNF grammar rules for a subset of Java-style method calls. The grammar should obey the following rules: A method can take any number of parameters All parameters are comma separated Each parameter can be a variable, a method call, or a simple arithmetic expression A simple arithmetic expression can be variables/method calls separated by + and * only – no parentheses or other operations Comma-separated and arithmetic expressions are evaluated left-to-right A method call has higher precedence than arithmetic * has higher precedence than + Variables can only be named x, y, z Methods can only be named m1, m2, m3 Nested method calls must be evaluated from the inside out – in m1(m2()), m2 should be evaluated before m1 The start symbol is a method callWrite the rules using the formatting, and make sure your start symbol is the first production. Some legal examples in the language:m1(x, y, z)m2(m1() + m3(), x * m3())m1(m1(m1(m2(x+y))))Some illegal examples:m1(x,)1 + m2()m1(m2 * y)
User generated content is uploaded by users for the purposes of learning and should be used following Studypool’s honor code & terms of service.