Chapt 3: Syntax & Semantics Flashcards
Describing Syntax & Semantics
The ___ of a programming language is the form of its expressions, statements, and program units
Syntax
The ___ of a programming language is the meaning of its expressions, statements, and program untis.
Semantics
___ ___ are the syntax and semantics of a language for all those potential users & evaluators, who are interested in learning a& building skills in a specific language.
Language Descriptions
A ___ ___ can be defined as a setup which can be used to generate sentences of a language. The setup can be made to work & produce a sentence as per the requirement as in input and output.
language generator
the operation of a general ___ ___ is to aid compiler (of a language) by helping it in analyzing the syntax of the program code.
language recognizer
The strings of a language are called ___ or statements.
sentences
The ___ of a programming language include its numeric literals, operators, and special words among others.
lexemes
A ___ represents a lexeme group; a category of its lexemes.
token
Give the token for the example lexemes:
- index
- =
- 2
- +
- count
- identifier
- equal_sign
- int_literal
- plus_op
- identifier
__ __ are literal symbols that can appear in the inputs to or outputs from the creation rules of a grammar.
terminal symbols
A ___ is a sentential form that has only terminal symbols.
sentence
___ form of a grammar G can be any sequence of grammar symbols (terminal or nonterminal) derived in 0 or more steps from the start symbol of G.
Sentential
__ __, a noted linguist, described four classes of grammars of which two are useful in describing the syntax of programming languages.
Noam Chomsky
The two classes used for describing the syntax of programming languages, that are also used in describing natural languages are ___ & ___.
context free, regular
___ is a natural notation for describing syntax; introduced in 1959 to describe ALGOL 58 and modified for the description of ALGOL 60
BNF, Backus-Naur Form
BNF is a ___ for describing programming languages.
metatlanguage
All things on the RHS combine to make the ___, or ___.
rule, production
The abstractions in a BNF description are often called ___.
nonterminals
The lexemes and tokens of BNF of the rules are called ___.
terminals
A rule is ___ if its LHS appears in its RHS.
recursive
The sentences of the language are generated through a sequence of application of the rules, beginning with a special nonterminal of the grammar called the ___ ___.
start symbol
The sequence of rule applications is called a ___.
derivation
The symbol => is read “___”.
derives
One of the most attractive features of grammars is that they naturally describe the hierarchical syntactic structure, or ___ ___, of the sentences of languages they define.
parse trees