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

Practice Homework on Grammars and Parsing, Assignments of Programming Languages

A practice homework assignment for cmsc 330 students focusing on grammars, derivations, parse trees, dfas, and regular expressions. The assignment includes exercises on deriving specific strings, constructing parse trees, designing dfas, and creating regular expressions for given grammars.

Typology: Assignments

Pre 2010

Uploaded on 02/13/2009

koofers-user-aj4
koofers-user-aj4 🇺🇸

10 documents

1 / 1

Toggle sidebar

Related documents


Partial preview of the text

Download Practice Homework on Grammars and Parsing and more Assignments Programming Languages in PDF only on Docsity! CMSC 330 practice homework on Grammars Do NOT turn in your solutions—this homework is only for practice 1. Given the regular grammar: S → aT | bS | a T → aS | bT | b (a) Give a leftmost derivation that shows S produces abaabb (b) Draw the parse tree for abaabb (c) Give a DFA that recognizes the same language (d) Give a regular expression for this set. 2. Give grammars for each of the following: (a) {a3nb2n | n>0} (b) {a3nb2m | m,n>0} (c) { a2nbm+ncm | m,n>0} (d) {ambncpdq | m+n = p+q} (d) { ambn | m≠n, m, n >0} 3. Given the grammar X → 0 X | X 1 | 01 (a) Give the parse tree for 00011111 (b) Give a regular grammar for the same language (c) Describe the language as simply as you can as an English sentence
Docsity logo



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