Page 197 - DCAP507_SYSTEM_SOFTWARE
P. 197
Unit 12: Formal Systems and Programming Languages
9. A ................................ is a sentence written in terms of the elements of the syntactic domain; Notes
it indicates a specific and set, a subset of the semantic domain.
10. A ................................ is just a boolean expression which is true or false and whose variables
are the parameters of the function being specified.
12.3 Formal Grammars
A grammar is a controlling tool for depicting and analyzing languages. It is a set of rules by
which applicable sentences in a language are created.
Example: Here's a trivial example of English grammar:
sentence <subject> <verb-phrase> <object>
subject This | Computers | I
verb-phrase <adverb> <verb> | <verb>
adverb never
verb is | run | am | tell
object the <noun> | a <noun> | <noun>
noun university | world | cheese | lies
By means of the above rules or productions, we can obtain simple sentences like these:
This is a university.
Computers run the world.
I am the cheese.
I never tell lies.
Here is a leftmost derivation of the first sentence using these productions.
sentence <subject> <verb-phrase> <object>
This <verb-phrase> <object>
This <verb> <object>
This is <object>
This is a <noun>
This is a university
In addition to numerous reasonable sentences, we can also obtain nonsense like "Computers
run cheese" and "This am a lies". These sentences don't make semantic logic, but they are
syntactically accurate since they are of the sequence of subject, verb-phrase, and object. Formal
grammars are a tool for syntax, not semantics. In the syntax analysis phase, we confirm structure,
not meaning.
12.3.1 Vocabulary
We want to review some definitions before we can continue: grammar: a set of rules by which
applicable sentences in a language are constructed.
LOVELY PROFESSIONAL UNIVERSITY 191