What is a grammar?
A grammar is a set of formal rules that define what a valid sentence looks like
How is a grammar rule defined computationally?
Each rule describes a pattern against which we match the input string, in terms of literals and other patterns
How is a grammar defined formally? (4)
G = (N, T, P, N0)
• N = Set of non-terminals
• T = Set of terminals
• P = Set of productions mapping a non-terminal to a sequence of non-terminals and terminals
• N0 = Initial non-terminal (start symbol)
What is meant by an ambiguous grammar?
When a valid sentence has more than one parse tree, that is you can product a valid sentence using more than one different sequence of productions