Question: An interpreter for a language L maps programs written in L to their answers. Remember that a language is a set of words. Let us

 An interpreter for a language L maps programs written in L

An interpreter for a language L maps programs written in L to their answers. Remember that a language is a set of words. Let us define our language L_ inductively as follows: The words 0, 1, and 2 are in L_ Assume that both A and B stand for words in the language L_ Then (a) (A+B) are also in L_ Examples of add-mod3 expressions are: ((1 + 2) + 0) and (1 + (2 + 2)). However, 1 + 1 is not in the language (parenthesis are missing). Give a rewrite system that "evaluates" or "computes" the value of expressions in L_ The operators + corresponds to the standard modulo 3 addition functions given below: Define a rewrite system for modulo 3 expressions in L_ that produces the final value of the expression. A final value is represented by either 0, 1 or 2. Your rewrite system is basically an interpeter for L_ For example, our two expressions ((1 + 2) + 0) and (1 + (2 + 2)) should be rewritten to 0 and 2, respectively. You can assume that your rewrite system will only be presented with correct L_ expressions, so don't worry about error messages. Show your rewrite system steps that are performed for our two example expressions given above. For each step clearly show the left-hand side of the rule in the current expression that you are rewriting. Is the choice of your next rewrite rule and its left-hand side always unique in your rewrite system? If not, show an example

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!