02-LexAnalGramsLangs

# 02-LexAnalGramsLangs - Discussion#2 Grammars and Languages...

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

Chapter 10, Section 1.1-2 1 Discussion #2 Discussion #2 Grammars and Languages

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

View Full Document
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

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

View Full Document
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 , …}

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

View Full Document
Chapter 10, Section 1.1-2 6 Discussion #2 Strings An element of an alphabet set is called a letter ,
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern