首页
网站开发
桌面应用
管理软件
微信开发
App开发
嵌入式软件
工具软件
数据采集与分析
其他
首页
>
> 详细
comp2022代写、代做Java,Python编程
项目预算:
开发周期:
发布时间:
要求地区:
comp2022/2922 A2 (90 marks) – CFLs and non-regularity s2 2023
• This assignment is due in Week 8 on Sunday 24 September, 11:59pm.
• Submission is on GradeScope.
• All work must be done individually without consulting anyone else’s solutions in accordance with the University’s “Academic Dishonesty and Plagiarism” policies.
• For clarifications and more details on all aspects of this assignment (e.g., level of justification expected, late penalties, repeated submissions, what to do if you are stuck, etc.) you
are expected to regularly monitor the Ed Forum post “Assignment FAQ”.
Problem 1. (10 marks) Fix Σ = {a, b}. For each of the following grammars,
provide five strings that are in the language and five strings that are not (you
score max(0, 5 − num errors) points per part).
1.
S → aSbb | ϵ
2.
S → aA
A → aA | bB
B → bB | ϵ
Problem 2. (10 marks) Consider the following context-free grammar G over
Σ = {a, b}.
S → AA
A → AAA | bA | Ab | a
1. Show the grammar is ambiguous by providing two leftmost derivations of
the same string.
2. Provide a grammar in Chomsky Normal Form equivalent to G.
Problem 3. (20 marks) Fix Σ = {a, b}. Design context-free grammars for the
following languages:
1. The set of strings of length 6 that have the same number of a and b.
2. The set of strings of the form uvw with u, v, w ∈ {a
n
b
n
|n ∈ Z
+}.
3. The set of palindromes whose length is a multiple of 20. Use at most 100
rules.
4. The set of strings not in the set {a
n
b
2n+3
|n ∈ Z
+}.
1
comp2022/2922 A2 (90 marks) – CFLs and non-regularity s2 2023
Problem 4. (20 marks) Fix Σ = {a, b}. A string is extreme if its amount of a is
more than twice its amount of b plus one, or the other way around. For example,
aaaab and babbabbbbba are both extreme, while bbbbbaa and ababab are not.
1. Prove that the set E of extreme strings is not regular (10 marks).
2. Prove that the set P of strings that have an extreme string as a prefix is not
regular. Recall that a string x is a prefix of a string y if y = xw for some
string w. Thus aaaabbbb is in P (since it has aaaab as a prefix), while ababab
is not in P (since no prefix of it is extreme). (10 marks)
Problem 5. (10 marks) Fix Σ = {a, b}. Write a program that takes in a contextfree grammar G in CNF and outputs a context-free grammar for the language of
strings that are in L(G) and whose number of as is a multiple of 5.
For full marks, your solution should be able to take an arbitrary CNF grammar
with 10 variables and output a grammar with at most 100 variables.
Problem 6. (20 marks) You’re honing your skills for the world championship
of popular card game Magic: the Gathering. Your goal is to draw through all
the cards in your deck, and to this end, you’ve included lots of cards that help
you draw more cards. However, if you get unlucky, with some deck orderings
you’ve found that this is impossible. You’re interested in determining which
deck orderings can be won, and which can’t.
At the start of the game, you draw seven cards from your deck into your hand.
The cards in your deck are of the following types:
• Ancestral Recall. When played, you draw three cards.
• Wheel of Fortune. When played, you discard your hand, and then draw seven
cards.
• Cruel Bargain. When played for the first time in a game, you draw four
cards. It cannot be played more than once in a game.
• Other, useless cards.
Aside: Unlike in the actual game, you can play any number of cards from your
hand in any order, without needing to pay mana.
Your goal is to draw all the cards in your deck, at which point you win. Note that
”overdraw” (drawing more cards than exist in your deck) meets this condition,
and so is also a win. We encode a possible ordering of your deck as a string
over the alphabet Σ = {a, w, c, x} where a, w, c correspond to the cards starting
with those letters, and x corresponds to a useless card. We are interested in the
language of strings for which it is possible for you to win.
For example, the following strings are in the language:
aax11
, wx13
, cawx18
, awx5wx13
2
comp2022/2922 A2 (90 marks) – CFLs and non-regularity s2 2023
while the following strings are not in the language:
aax12
, wx14
, cawx19
, awx5wx14
Design a context-free grammar for the language described.
• 4 marks will be awarded for cases with strings containing only a, x.
• 4 marks will be awarded for cases with strings containing only a, c, x.
• 4 marks will be awarded for cases with strings containing only w, x.
• 4 marks will be awarded for cases with strings containing only a, w, x.
• The final 4 marks will be awarded for the general case, i.e., for strings over
the alphabet a, w, c, x.
3
软件开发、广告设计客服
QQ:99515681
邮箱:99515681@qq.com
工作时间:8:00-23:00
微信:codinghelp
热点项目
更多
代写dts207tc、sql编程语言代做
2024-12-25
cs209a代做、java程序设计代写
2024-12-25
cs305程序代做、代写python程序...
2024-12-25
代写csc1001、代做python设计程...
2024-12-24
代写practice test preparatio...
2024-12-24
代写bre2031 – environmental...
2024-12-24
代写ece5550: applied kalman ...
2024-12-24
代做conmgnt 7049 – measurem...
2024-12-24
代写ece3700j introduction to...
2024-12-24
代做adad9311 designing the e...
2024-12-24
代做comp5618 - applied cyber...
2024-12-24
代做ece5550: applied kalman ...
2024-12-24
代做cp1402 assignment - netw...
2024-12-24
热点标签
mktg2509
csci 2600
38170
lng302
csse3010
phas3226
77938
arch1162
engn4536/engn6536
acx5903
comp151101
phl245
cse12
comp9312
stat3016/6016
phas0038
comp2140
6qqmb312
xjco3011
rest0005
ematm0051
5qqmn219
lubs5062m
eee8155
cege0100
eap033
artd1109
mat246
etc3430
ecmm462
mis102
inft6800
ddes9903
comp6521
comp9517
comp3331/9331
comp4337
comp6008
comp9414
bu.231.790.81
man00150m
csb352h
math1041
eengm4100
isys1002
08
6057cem
mktg3504
mthm036
mtrx1701
mth3241
eeee3086
cmp-7038b
cmp-7000a
ints4010
econ2151
infs5710
fins5516
fin3309
fins5510
gsoe9340
math2007
math2036
soee5010
mark3088
infs3605
elec9714
comp2271
ma214
comp2211
infs3604
600426
sit254
acct3091
bbt405
msin0116
com107/com113
mark5826
sit120
comp9021
eco2101
eeen40700
cs253
ece3114
ecmm447
chns3000
math377
itd102
comp9444
comp(2041|9044)
econ0060
econ7230
mgt001371
ecs-323
cs6250
mgdi60012
mdia2012
comm221001
comm5000
ma1008
engl642
econ241
com333
math367
mis201
nbs-7041x
meek16104
econ2003
comm1190
mbas902
comp-1027
dpst1091
comp7315
eppd1033
m06
ee3025
msci231
bb113/bbs1063
fc709
comp3425
comp9417
econ42915
cb9101
math1102e
chme0017
fc307
mkt60104
5522usst
litr1-uc6201.200
ee1102
cosc2803
math39512
omp9727
int2067/int5051
bsb151
mgt253
fc021
babs2202
mis2002s
phya21
18-213
cege0012
mdia1002
math38032
mech5125
07
cisc102
mgx3110
cs240
11175
fin3020s
eco3420
ictten622
comp9727
cpt111
de114102d
mgm320h5s
bafi1019
math21112
efim20036
mn-3503
fins5568
110.807
bcpm000028
info6030
bma0092
bcpm0054
math20212
ce335
cs365
cenv6141
ftec5580
math2010
ec3450
comm1170
ecmt1010
csci-ua.0480-003
econ12-200
ib3960
ectb60h3f
cs247—assignment
tk3163
ics3u
ib3j80
comp20008
comp9334
eppd1063
acct2343
cct109
isys1055/3412
math350-real
math2014
eec180
stat141b
econ2101
msinm014/msing014/msing014b
fit2004
comp643
bu1002
cm2030
联系我们
- QQ: 9951568
© 2021
www.rj363.com
软件定制开发网!