Programming Languages Tevfik Ko ar Lecture III January 24th 2006 1 Roadmap Creating Language Grammars Regular Expressions Context Free Grammars Parse Trees Ambiguity 2 1 Expressing Digits 0 digit digit digit digit digit digit digit digit digit digit 1 2 3 4 5 6 7 8 9 digit 0 1 2 3 4 5 6 7 8 9 Regular Expression 3 Expressing Numbers digit 0 1 2 3 4 5 6 7 8 9 two digit number digit digit number digit digit Kleene star zero more repetitions of the symbol to its left natural number non zero digit digit non zero digit 1 2 3 4 5 6 7 8 9 Non terminals Terminals 4 2 Operators op expr number op number op number 5 Context Free Grammars Adds recursion to regular expressions expr number op number op number expr number expr op expr 6 3 Example 3 4 5 derive this expr number expr op expr expr from this expr op expr expr op number expr number expr op expr num expr op num num expr num num num num num 3 4 5 7 4
View Full Document
Unlocking...