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
21
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

Pythagorean Theorem Quiz
Selam H
Essay Writing: My Essay Plan
Andrea Leyden
01 Long Term causes of the French Revolution
Holly Lovering
Prueba de Aptitud Académica - Lenguaje
Teresa Nadal
P2 Radioactivity and Stars
dfreeman
B6 - Brain and Mind OCR
franimal
GCSE Biology 4 OCR - The Processes of Life
blairzy123
Unit 1: Business Studies GCSE
Libby Rose
Mind Maps with GoConqr
Elysa Din
Romeo + Juliet (Themes)
alexandra_m_
Study tips/hacks
Sarah Biswas