This preview shows pages 1–7. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Chapter 10, Section 1.12 1 Discussion #2 Discussion #2 Grammars and Languages Chapter 10, Section 1.12 2 Discussion #2 Topics Set basics Programming languages / compilers Grammars as set generators Languages as defined by grammars Chapter 10, Section 1.12 3 Discussion #2 Set Basics Set = unordered collection of distinct items Notation: curly braces enclose items, e.g. {0, a, xy} Unordered: {0, a, xy} = {a, xy, 0} Distinct: {0, 0, a, xy} is not a set; contains duplicates Can name sets: A = {0, a, xy}; B = {a, b} Empty set: { } or ∅ Common operations Element: 0 ∈ {0, a, xy}; 0 ∈ A; 0 ∉ B; aa ∉ A Count or cardinality: {0, a, xy} = 3; A = 3; B = 2 Union: A ∪ B = {0, a, xy, b} Intersection: A ∩ B = {a} Difference: A  B = {0, xy}; B  A = {b} Subset Subset: {0, xy} ⊆ {0, a, xy}; ∅ ⊆ A; A ⊆ A; B ⊆ A Proper Subset: {0, xy} ⊂ {0, a, xy}; ∅ ⊂ A; A ⊂ A Chapter 10, Section 1.12 4 Discussion #2 Programming Language Specification Define the alphabet a set of symbols that can be used to construct programs Define the set of all correct programs Define the “meaning” of all correct programs Chapter 10, Section 1.12 5 Discussion #2 Alphabets An alphabet (or vocabulary) V is a nonempty set of symbols. Examples: V 1 = {0, 1} V 2 = { a , b , … , z , …} Chapter 10, Section 1.12 6 Discussion #2 Strings An element of an alphabet set is called a letter , character...
View
Full
Document
This note was uploaded on 03/02/2012 for the course C S 236 taught by Professor Michaelgoodrich during the Winter '12 term at BYU.
 Winter '12
 MichaelGoodrich

Click to edit the document details