02-LexAnalGramsLangs

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

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

View Full Document Right Arrow Icon
Chapter 10, Section 1.1-2 1 Discussion #2 Discussion #2 Grammars and Languages
Image of page 1

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

View Full Document Right Arrow Icon
Chapter 10, Section 1.1-2 2 Discussion #2 Topics Set basics Programming languages / compilers Grammars as set generators Languages as defined by grammars
Image of page 2
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
Image of page 3

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

View Full Document Right Arrow Icon
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
Image of page 4
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 , …}
Image of page 5

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

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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    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.

    Student Picture

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

  • Left Quote Icon

    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.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    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.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern