Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Free Identifiers Implement the function free-ids, which take a WAE and produces a list of symbols. (define-type WAE [num (n number?)] [add (lhs WAE?)(rhs WAE?)]

Free Identifiers Implement the function free-ids, which take a WAE and produces a list of symbols. (define-type WAE [num (n number?)] [add (lhs WAE?)(rhs WAE?)] [sub (lhs WAE?)(rhs WAE?)] [with (name symbol?)(named-expr WAE?)(body WAE?)] [id (name symbol?)]) The list should contain a symbol for each free identifier in the given WAE, each symbol should appear at most once in the list, and the symbols should be ordered according to the following comparison procedure: (define (symbolstring a) (symbol->string b))) Hint 1: First, write a function that generates an unordered list of symbols with duplicates, and then write separate functions to re-order the list and then remove duplicates. Hint 2: The free variables of a with form include all of the free variable of the named expression, plus all of the free variables in the body expression except for the name bound by with. Hint 3: The PLAI language includes several helpful list-processing functions: filter - takes a predicate and a list, and returns a list that contains only values for which the predicate returned true. This is useful for removing a value from a list. sort - takes a list and a less-than comparison function (i.e., a function of two arguments where the result is true when the first argument is less than the second) and produces a sorted list. member - takes a value and a list, and returns a boolean indicating whether the value is in the list. Part 2 Binding Identifiers Implement the function binding-ids, which is like free-ids, but the result list contains a symbol for each binding identifier in the given WAE (whether or not the binding identifier is ever referenced by a bound identifier). The result list of symbols must be sorted and have no duplicates. Part 3 Bound Identifiers Implement the function bound-ids, which is like free-ids, but the result list contains a symbol for each bound identifier in the given WAE. The result list of symbols must be sorted and have no duplicates. PLEASE!!!! ANYONE HELP ME!!!! TOMORROW IS THE DEADLINE!!!! I SPENT SEVERAL DAYS STILL HAVEN'T WORK IT OUT!!!!! PLEASE HELP ME SOLVE AT LEAST THE FIEST PART

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

OCA Oracle Database SQL Exam Guide Exam 1Z0-071

Authors: Steve O'Hearn

1st Edition

1259585492, 978-1259585494

More Books

Students also viewed these Databases questions