BNF Quiz

Description

Test your knowledge on BNF and EBNF
Amy Dang
Quiz by Amy Dang, updated 9 months ago
Amy Dang
Created by Amy Dang 9 months ago
8
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

Quiz Geral
miminoma
TYPES OF DATA
Elliot O'Leary
GCSE Computing - 4 - Representation of data in computer systems
lilymate
Main People in Medicine Through Time
Holly Bamford
Life in Germany
Ben C
BIOLOGY HL DEFINITIONS IB
Luisa Mandacaru
The Anatomy of the Heart
Shannan Muskopf
GCSE History – Social Impact of the Nazi State in 1945
Ben C
GCSE REVISION TIMETABLE
holbbox
Writing successful GCSE English essays
Sarah Holmes
1PR101 2.test - Část 11.
Nikola Truong