100 likes | 387 Views
Chapter 3 Language Translation Issues . Programming Languages Pratt. Programming Syntax. During the early days of language design (1960), they believed that a formal syntax is all that is required. Backus-Naur form (BNF) Context-free grammer
E N D
Chapter 3Language Translation Issues Programming Languages Pratt
Programming Syntax • During the early days of language design (1960), they believed that a formal syntax is all that is required. • Backus-Naur form (BNF) • Context-free grammer • Syntax: the arrangement of words as elements in a sentence to show their relationship. • The sequence of symbols that make up valid programs.
Syntax is not enough, semantics are needed too. • Use of declarations, operations,sequence control, and referencing environments, affect a variable, not always determined by syntax.
General Syntactic Criteria • The primary purpose: provide a notation for communication between the programmer and the programming language processor.
The Criteria • Readability • Writeability • Ease of verifiability • Ease of translation • Lack of ambiguity
Syntactic Elements of a Language • Character set • Identifiers • Operator symbols • Keywords and reserved word • Noise words • Comments
Syntactic Elements of a Language • Blanks • Delimiters and brackets • Free- and fixed- field formats • Expressions • Statements
Overall Program-subprogram Structure • Separate subprogram definitions • Separate data definitions • Nested subprogram definitions • Separate interface definitions • Data descriptions separated from executable from executable statements • Unseparated subprogram definitions
What do you know about Compiling? • Lexical analysis • syntactic analysis • semantic analysis • optimization • code generation • linking, loading