Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Number Grammars Note that many of these grammars could be written as regular grammars, but here we'll practice writing them in standard Backus-Naur Form -

image text in transcribed
Number Grammars Note that many of these grammars could be written as regular grammars, but here we'll practice writing them in standard Backus-Naur Form - BNF (note: do not use Extended BNF). NUM1 = the set of all integers, including leading and optional leading '#' signs. Give parse trees for O and -128 NUM2 = the set of even negative integers (-2,-4.-6...... Give parse trees for -16, and -378. NUM3 = the set of signed decimal numbers, with at least one digit (possibly zero) both before and after the decimal point. Give parse trees for +1.2, and -33.03. Identifier Grammars ID1 = the set of strings beginning with an upper-case letter, followed by any number of lower case letters or digits. Give parse trees for Sumi and R. ID2 = the set of strings of letters, digits, underscores and dashes, provided that (1) the first character in the string is an upper-case letter, and (2) the final character is neither an underscore nor a dash. Give parse trees for BB-8 and case_1. ID3 = the set of strings axbx -- any number of a's followed by an equal number of b's. Give parse trees for the empty string (i.e. O a's and O b's) and cabb. Boolean Expression Grammar Write a grammar for Boolean expressions might be simple literals like 3 or 97 or may be more complex syntactic units like (3+x)/4. They evaluate to a number. You needn't concern yourself with their structure; just that they can be used as below. Boolean expressions include the literals TRUE and FALSE; they can be combined with the unary operator ! (meaning NOT) and binary operators && and II (meaning AND and OR). Also, arithmetic expressions can be combined with the following binary operators to form new Boolean expressions: ,,!. When your grammar is complete, you should be able to derive parse trees for expressions like the following: TRUE FALSE FALSE && !TRUE 27= TRUE FALSE

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

Informix Database Administrators Survival Guide

Authors: Joe Lumbley

1st Edition

0131243144, 978-0131243149

More Books

Students also viewed these Databases questions

Question

Develop grant applications

Answered: 1 week ago

Question

7. Senior management supports the career system.

Answered: 1 week ago