In old versions of Fortran that did not have the character data type, character strings were expressed in the following format: ::= H where the is a base-ten integer (≥ 1), H is a keyword (named after Herman Hollerith), and is a sequence of characters. The semantics of this string literal is correct if the base-ten numeral's numeric value matches the string's length. Write an attribute grammar using only synthesized attributes for the nonterminals in the definition. Below is an example of an attribute grammar that defines the meaning of binary numerals consisting only of Synthesized Attributes. Base your answer on the example below. Val - stands for the attribute Value. Len - stands for the attribute Length. Nonterminals Synthesized Attributes Inherited Attributes Val Val, Len Val :: , 2 Val ()<- Val ()+ Val ()/2lm (chinary digits binary digits> ::- Val ()2 Val (>2) + Val () Len () + Len ()+1 | Val () Val () Len ( ::= 0 Val ()0 | 1 Val ()1

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
In old versions of Fortran that did not have the character data type, character strings were
expressed in the following format:
<string literal> ::= <numeral> H <string>
where the <numeral> is a base-ten integer (≥ 1), H is a keyword (named after Herman
Hollerith), and <string> is a sequence of characters.
The semantics of this string literal is correct if the base-ten numeral's numeric value matches
the string's length.
Write an attribute grammar using only synthesized attributes for the nonterminals in the <string
literal> definition.
Below is an example of an attribute grammar that defines the meaning of binary numerals
consisting only of Synthesized Attributes.
Base your answer on the example below.
Val - stands for the attribute Value.
Len - stands for the attribute Length.
Nonterminals
<binary numeral>
<binary digits>
<bit>
Synthesized
Attributes
Inherited
Attributes
Val
Val, Len
Val
<binary numeral> :: <binary digits>, <binary digits>2
Val (<binary numeral>)<- Val (<binary digits>)+
Val (<binary digits>)/2lm (chinary digits
binary digits> ::-
<binary digits> <bit>
Val (<binary digits>)2 Val (<binary digits>>2) + Val (<bit>)
Len (<binary digits>) + Len (<binary digits>)+1
| <bit>
Val (<binary digits>) Val (<bit>)
Len (<binary digits) 1
<bit> ::=
0
Val (<bit>)0
| 1
Val (<bit>)1
Transcribed Image Text:In old versions of Fortran that did not have the character data type, character strings were expressed in the following format: <string literal> ::= <numeral> H <string> where the <numeral> is a base-ten integer (≥ 1), H is a keyword (named after Herman Hollerith), and <string> is a sequence of characters. The semantics of this string literal is correct if the base-ten numeral's numeric value matches the string's length. Write an attribute grammar using only synthesized attributes for the nonterminals in the <string literal> definition. Below is an example of an attribute grammar that defines the meaning of binary numerals consisting only of Synthesized Attributes. Base your answer on the example below. Val - stands for the attribute Value. Len - stands for the attribute Length. Nonterminals <binary numeral> <binary digits> <bit> Synthesized Attributes Inherited Attributes Val Val, Len Val <binary numeral> :: <binary digits>, <binary digits>2 Val (<binary numeral>)<- Val (<binary digits>)+ Val (<binary digits>)/2lm (chinary digits binary digits> ::- <binary digits> <bit> Val (<binary digits>)2 Val (<binary digits>>2) + Val (<bit>) Len (<binary digits>) + Len (<binary digits>)+1 | <bit> Val (<binary digits>) Val (<bit>) Len (<binary digits) 1 <bit> ::= 0 Val (<bit>)0 | 1 Val (<bit>)1
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education