Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The STEP language is implemented using the following grammar: = point main begin end ( , ) = 1 ::= 1 I origin? (

The STEP language is implemented using the following grammar: a program Top level program variant that contains an expr point

The STEP language is implemented using the following grammar: = point main begin end ( , ) = 1 ::= 1 I origin? ( ) | if ( ) { } else { } 1 move ( *) { * } ::= a program point expr number origin expr if expr move expr identifier block expr val up expr down expr left expr right expr I val = up ( ) down ( ) left ( ) right ( ) Top level program variant that contains an expr List containing two numbers (coordinates) "a program" "point expr" "num expr" "origin? expr" "if expr" "move expr" "iden expr" "block expr" "val" "up expr" "down expr" "left expr" "right expr" Number variant Returns true if expr is (0,0) false otherwise Executes expr2 if exprl if correct otherwise executes expr3 Moves expr (point) using the directions dir-expr (one or more than one) Symbol that is the name of a variable Block in which the assignments in var-expr (any number) is visible Assigns the identifier a value obtained from expr (expr evaluates to a number) Used in move expr to move a point in the up direction Used in move expr to move a point in the down direction Used in move expr to move a point in the left direction Used in move expr to move a point in the right direction 2.b (20 points) Implement the the helper functions move and add-variables that work on list of directions and list of variable respectively. If you have a fully working implementation, then you do not need to im- plement these functions, otherwise these functions will be looked at to give you partial points.

Step by Step Solution

3.39 Rating (155 Votes )

There are 3 Steps involved in it

Step: 1

Move Function The move function takes two parameters a list of directions and a point a pair of coordinates The function iterates through the list of ... 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

Managerial accounting

Authors: ramji balakrishnan, k. s i varamakrishnan, Geoffrey b. sprin

1st edition

471467855, 978-0471467854

More Books

Students also viewed these Databases questions

Question

1.12 Describe the sociocultural perspective on abnormal behavior.

Answered: 1 week ago

Question

1.14 Identify four major objectives of science.

Answered: 1 week ago