Concept of Programming language chapter 3

Posted: April 8, 2013 in Assignment
Tags: ,

hi everyone, here another chapter of the concept of programming language.
hope you guys find this useful.

Review Question

1. Q: Define syntax and semantics.
A: Syntax is the form of expression, statement and program units.
Semantic is the meaning of expression, statement and program units of the syntax.

2. Q: Who are language descriptions for?
A: Language descriptions are used for describing syntax.

3. Q: Describe the operation of a general language generator.
A: A language generator is a device that will create any sentence of language each time it used.

4. Q: Describe the operation of a general language recognizer
A: A language recognizer works like a filter. It will check a sentence and will follow the rule that was given. If there was a sentence that no in the rule then the recognizer will reject that sentence input.

5. Q: What is the difference between a sentence and a sentential form?
A: A sentence is a sentential form that consist only terminal or lexemes while sentential form is a string that consist of derivations.

6. Q: Define a left-recursive grammar rule.
A: Left-recursive grammar rules happen when LHS appear at the beginning of the RHS.

7. Q: What three extensions are common to most EBNFs?
A: The common extensions in EBNFs are:

  • denote an optional part of a RHS
  • the use of brace in RHS to indicate that the enclosed part can be repeated in definitely or left out altogether
  • deals with multiple-choice options

8. Q: Distinguish between static and dynamic semantic.
A: Static semantic is semantic that unable to be describe by BNF while dynamic semantic is semantic that able to describe meaning of the expressions, statements and program units of a programming language.

9. Q: What purpose doe predicates serve in an attribute grammar?
A: The purpose of predicates in attribute grammar is to keep the statement in static semantic rule of language.

10. Q: What is the difference between a synthesized and an inherited attribute?
A: Synthesized attribute in used to store the actual type int or real, that is expected for the expression, as determined by the type of the variable on the left side of the assignment statement.

Problem  Set

Leave a comment