Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 33rd International Conference Dexa 2022 Vienna Austria August 22 24 2022 Proceedings Part 1 Lncs 13426

Authors: Christine Strauss ,Alfredo Cuzzocrea ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

3031124227, 978-3031124228

More Books

Students also viewed these Databases questions