# 4.1-4.3 - CSC4510 AUTOMATA 4.1 Using Grammar Rules to...

• Notes
• 8

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

1 CSC4510 AUTOMATA 4.1 Using Grammar Rules to Define a Language 4.2 Context-Free Grammars: Definitions and More Examples 4.3 Regular Languages and Regular Grammars Using Grammar Rules to Define a Language (cont’d.) A grammar is a set of rules, by which strings in a language can be generated. AnBn = { a n b n | n 0}, recursive definition: 1.  AnBn 2. For every S AnBn , aSb AnBn Write these rules as S  and S aSb 2

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

2 Using Grammar Rules to Define a Language (cont’d.) If and are strings, and contains at least one occurrence of S , then  means that is obtained from in one step, by using one of the two rules to replace a single occurrence of S by either or aSb. S aSb aaSbb aaaSbbb aaabbb Simplify the rules: S   | aSb 3 Using Grammar Rules to Define a Language (cont’d.) Consider the language Expr involving + , * , ( , ) , and a : 1. a Expr . 2. For every x and y Expr , x + y and x * y are in Expr . 3. For every x Expr , ( x ) Expr . S a | S+S | S*S | (S) How to derive a+(a*a) and a+a*a ? 4
3 Using Grammar Rules to Define a Language (cont’d.) Consider the language Pal of palindromes over { a, b }: S   | a | b | aSa | bSb The language NonPal : 1. For every A {a, b}* , aAb and bAa

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

This is the end of the preview. Sign up to access the rest of the document.
• Spring '14
• K.N.King
• Formal language, Regular expression, Regular language, CFL, Chomsky hierarchy, Regular grammar

{[ 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