Edit this page Backlinks This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== 10. Writing a parser for a CF language ====== ===== 10.1. The grammar ===== 10.1.1. Write a grammar which accurately describes regular expressions. Consider the following definition: //A regular expression is built in the normal way, using the symbols (,),*,| and any other alpha-numeric caracter. Free spaces may occur freely within the expression//. 10.1.2. Starting from the solution to the previous exercise, write an unambiguous grammar for regexes: * Make sure to take precedence into account ===== 10.2. The implementation ===== 10.2.1. Write a parser for the following language: * $math[S \leftarrow M \mid M + S] * $math[M \leftarrow A \mid A * M] * $math[A \leftarrow 0 | 1 | (S)]