CS118 Programming Languages

Lecture 4


Reference

Contents

  1. Discuss the regular expression for /**/
  2. Definition of grammars <VT, VN, R, G>
  3. Everyday grammars
  4. Sentential forms and language
  5. Canonical parse
  6. Assignments

Definition of Grammars

Grammars are defined in terms of sets and sequences.

Everyday Grammars

Lacking typesetting, we often settle for some formatted ASCII characters to represent grammars. There is such a grammar for X and another for M. Here is one for propositions:

Proposition
  Disjunction                            r0
Disjunction
  Disjunction \/ Conjunction             r1
  Conjunction                            r2
Conjunction
  Conjunction /\ Complement              r3
  Complement                             r4
Complement
  ~ Boolean                              r5
  Boolean                                r6
Boolean
  t                                      r7
  f                                      r8
  ( Disjunction )                        r9

Sentential forms and language

Sentential forms are intermediate expressions between a linguistic expression and the proof that is represented by the grammar.

Canonical parse

By picking one order of rewritings out of many, we provide a structure to which we can attach meaning.


go to:

CS118
Home Page
CS118
Summary
Previous
Lecture
Next
Lecture