02-LexAnalGramsLangs

02-LexAnalGramsLangs - Chapter 10, Section 1.1-2 1...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Chapter 10, Section 1.1-2 1 Discussion #2 Discussion #2 Grammars and Languages Chapter 10, Section 1.1-2 2 Discussion #2 Topics Set basics Programming languages / compilers Grammars as set generators Languages as defined by grammars Chapter 10, Section 1.1-2 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.1-2 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.1-2 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.1-2 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.

Page1 / 17

02-LexAnalGramsLangs - Chapter 10, Section 1.1-2 1...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online