Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Grammar Analysis Seminar Homework: Identifying Grammar Types, Exercises of Theory of Formal Languages for Automata

Several examples of context-free grammar rules. For each rule, students are asked to identify the grammar type and provide proof based on the given rules.

Typology: Exercises

2021/2022

Uploaded on 06/07/2022

hicham-rahmouni
hicham-rahmouni ๐Ÿ‡ท๐Ÿ‡ด

16 documents

1 / 1

Toggle sidebar

Related documents


Partial preview of the text

Download Grammar Analysis Seminar Homework: Identifying Grammar Types and more Exercises Theory of Formal Languages for Automata in PDF only on Docsity! Seminar 2: Homework - February 2022 1. Specify language generated by the grammar G = (VN , VT , S, P ): (a) VN = {A}, VT = {a, b}, S = A, P = {A โ†’ aA|b} (b) VN = {x0, x1, x2}, VT = {A,B, ..., Z}, S = x0, P = {x0 โ†’ Ex1, x1 โ†’ Nx2, x2 โ†’ D} (c) VN = {A}, VT = {0, 1, 2}, S = A, P = {A โ†’ 0A0|1A1|2A2|ฮป} (d) VN = {S,A}, VT = {0, 1, ..., 9, .}, P = {S โ†’ A.A,A โ†’ 0A|1A|...|9A|0|1|...|9} (e) VN = {A,B,C}, VT = {0, 1}, S = A, P = {A โ†’ 0A|1B|1, B โ†’ 0C|1A, C โ†’ 0B|1C|0} (f) VN = {S,A,B,C}, VT = {0, 1, ..., 9,+,โˆ’}, P = {S โ†’ +A|โˆ’A|A, A โ†’ 0A|1A|...|9A|0|...|9} (g) VN = {S}, VT = {(, )}, P = {S โ†’ S(S)S|ฮป} (h) VN = {E, T, F}, VT = {(, ), i,+, โˆ—}, S = E, P = {E โ†’ E + T |T, T โ†’ T โˆ— F |F, F โ†’ (E)|i} (i) VN = {S,A,B}, VT = {a, b, c}, S = E, P = {S โ†’ abc|aAbc, Ab โ†’ bA,Ac โ†’ Bbcc, bB โ†’ Bb, aB โ†’ aaA|aa} (j) VN = {S,A,B,C,D,E}, VT = {a}, P = {S โ†’ ACaB,Ca โ†’ aaC,CB โ†’ DB|E, aD โ†’ Da,AD โ†’ AC, aE โ†’ Ea,AE โ†’ ฮป} (k) VN = {S,A,B,C,D,E}, VT = {a, b}, P = {S โ†’ ABC,AB โ†’ aAD|bAE,DC โ†’ BaC,EC โ†’ BbC,Da โ†’ aD,Db โ†’ bD,Ea โ†’ aE,Eb โ†’ bE,Db โ†’ bD,AB โ†’ ฮป,C โ†’ ฮป, aB โ†’ Ba, bB โ†’ Bb} 2. Try to find the grammar type for the grammars from above and prove it based on the rules. 1
Docsity logo



Copyright ยฉ 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved