CS420 Lecture17 SyntaxSemantics
CS420 Lecture17 SyntaxSemantics
Programming Languages
(Part 3)
Book: Chapter 3
ISBN 0-321-49362-1
Extended BNF
• EBNF
<expr> → <term> {(+ | -) <term>}
<term> → <factor> {(* | /) <factor>}
<factor> → <exp> {** <exp>}
<exp> → (<expr>) | id
• Syntax
<assign> -> <var> = <expr>
<expr> -> <var> + <var> | <var>
<var> A | B | C
• actual_type: synthesized for <var>
and <expr>
• expected_type: inherited by <expr>
<expr>.actual_type <var>[1].actual_type
<expr>.actual_type =? <expr>.expected_type
Exam Format
• Duration: 75 minutes
• Programming languages
• Categories and properties
• All chapters related to C programming from zyBooks
• All chapters related to C++ programming from zyBooks
• Functions and Pointers
• Syntax and semantics
• NOT INCLUDED: Lexical Analysis, Concurrency, Synchronization
Resources:
• Review Lecture slides
• Review zyBooks chapters
• Suggested readings: Concepts of Programming Languages book
Practice Materials:
• Assigned PA, CA, and zyLabs from zyBooks
• Homework Assignment for syntax and semantic analysis
• Participation Discussions
Extra Notes:
• You may be asked to write pseudocode, but not actual C++ code.
• No need to memorize formulas; they will be provided if necessary.
• Be prepared to draw diagrams