BNF Quiz

Description

Test your knowledge on BNF and EBNF
Amy Dang
Quiz by Amy Dang, updated more than 1 year ago
Amy Dang
Created by Amy Dang over 1 year ago
13
0

Resource summary

Question 1

Question
Define a grammar for the empty language, which is a language containing no strings. (There is no valid sentence in the empty language.)
Answer
  • empty ->

Question 2

Question
Define a grammar for the letter language. A letter is a lower-case Latin letter between a and z.
Answer
  • <letter> -> <a> | <b>| <c> | ... |<z>|

Question 3

Question
Define a grammar for the word language. A word is a sequence of one or more letters. You may refer to the letter nonterminal defined above.
Answer
  • <word> -> <letter> |<word> <letter>

Question 4

Question
Define a grammar for the parenthesis language, where all sentences in the parenthesis language consist of balanced pairs of left and right parentheses. Example of valid pairs: (), (()), ()(), (((()())()())). Example of invalid pairs: ())(, (, )(, )(((((((((.
Answer
  • <paren> -> (<paren>) <paren> | <empty>
Show full summary Hide full summary

Similar

Tips for IB History Paper 1
enyarko
CHEMISTRY C1 1
x_clairey_x
CHEMISTRY C1 2
x_clairey_x
The Wife of Bath Quotes
rlshindmarsh
How Parliament Makes Laws
harryloftus505
CLASS DIFFERENCES IN ACHIEVEMENT
ashiana121
Ancient Roman Quiz
Rev32
AQA GCSE Physics Unit 2 Mindmap
Gabi Germain
2PR101 1.test - Doplňující otázky
Nikola Truong
Clinical Pathoanatomy MCQs (Q 151-250)
Ore iyanda
Účto Fífa 4/6
Bára Drahošová