bitmark-grammar
Version:
228 lines (169 loc) • 6.6 kB
Plain Text
//
// Bitbook BNF grammar
// May 6, 2020 by Yoshi
//
Bitbook: Bit+
Bit: '[.' type
type: cloze
cloze-instruction
cloze-instruction-grouped # All instructions [!...] of the cloze are collected and
# displayed together as a help for the user.
cloze-solution-grouped # All solutions [_...] of the cloze are collected and displayed
# together as a help for the user.
cloze-and-multiple-choice-text
multiple-choice
multiple-choice-1
multiple-choice-text
multiple-response
multiple-response-1
essay
interview
interview-instruction-grouped
match
match-solution-grouped
true-false-1
true-false
sequence
correction
mark
document-upload
take-picture
record
preparation-note
assignment
article
//article-attachment
flashcard
flashcard-1
chat
bot-interview
self-assessment
//
// [.cloze] This sentence is a [_cloze][_gap text][!noun] with [_2][?1 or 2]
// gaps including an instruction for the first and a hint for the second gap.
//
cloze: 'cloze' format? ']' ( text | ucloze | bitElem )*
bitElem: text
| gap
| hint
| instruction
// [_cloze]
ucloze: '[_cloze]'
//
gap: '[_' answer ']' ' ( instruction | hint )
answer: text
instruction:'[!' ( text | color-text )+ ']'
hint: '[?' text ']'
// There must be 2 choices at least
choices: '[' ('+'|'-') text ']' ( '[' ('+'|'-') text ']' )*
// 1 choice set
multiple-choice-1: 'multiple-choice-1' format? ']' instruction choices
// multi choise sets
multiple-choice: 'multiple-choice' format? ']' instruction ( HSPL choices )+ HSPL
multiple-response-1: 'multiple-response-1' format? ']' instruction choices
// [.multiple-response]
// [!What colors can animals have in Switzerland?]
// ===
// [!What colours can cows have in Switzerland?]
// [+brown]
// [+purple, but only in chocolate ads]
// [-blue]
// [-green]
// ===
// [!What colours can cats have in Switzerland?]
// [+brown]
// [+black]
// [+blue]
// [-green]
// ===
multiple-response: 'multiple-response' format? ']' instruction ( HSPL instruction choices )+ HSPL
//
// [.multiple-choice-text]
// The students ['complete][+d][-t][-s] the [+cloze][-close][-cloth] with the correct verb forms.
//
multiple-choice-text: 'multiple-coice-text]' ( text | text-choice )+
text-choice: '[\'' text ']' ( text | choice )
// [.cloze-and-multiple-choice-text]
// The students completed the [_cloze] with the correct verb [+forms][-formats].
//
cloze-and-multiple-choice-text: 'cloze-and-multiple-choice-text' format? ']' text '[_cloze]' ( text | choice )+
essay: 'essay' format? ]' instruction resource? example?
| 'essay&article-attachment]' NL instruction '[.article-attachment' format? ']'
resource: image | audio
// Cloze does not allow line breaks in example solutions
example: '[@example:' text ']'
interview:
'interview' format? ']' interview_answer resource? ( HSPL interview_answer )+ HSPL
| 'interview-instruction-grouped' format? ']' instruction ( HSPL interview_answer )+ HSPL
interview_answer: ( text | instruction | example )+ ( '[@shortAnswer]' | '[@longAnswer]' )?
title: '[#' text ']'
query: text ( '[@example]' )?
answer: text ( OR text )
match: 'match' format? ']' instruction HSPL title EQ title ( HSPL query EQ answer )+ HSPL
| 'match-solution-grouped' format? ']' instruction HSPL title EQ title ( HSPL query EQ answer )+ HSPL
//
// Simple true/false quiz
// [.true-false]
// [+Ein Elefant ist grösser als eine Maus.]
// Multiple true/false statements in one quiz
// [.true-false]
// [+Ein Elefant ist grösser als eine Maus.]
// [+Ein Tiger ist grösser als eine Hauskatze.]
// [-Eine Kuh ist kleiner als ein Hund.]
// With labels
// [.true-false]
// [@label-true:rather yes][@label-false:rather no]
// [+A house is bigger than a car.]
// [+A tiger is bigger than a cat.]
// [-A cow is bigger than a dog.]
//
true-false-1: 'true-false-1' format? ']' ( bool-label | instruction | resource )* choices
true-false: 'true-false' format? ']' ( bool-label | instruction | resource )* ( HSPL choices )+ HSPL
bool-label: '[@label-true]' | '[@label-false]'
sequence: 'sequence' format? ']' ( SSPL text (NL text)? )+ SSPL
correction: 'correction]' instruction choices
// mark
// [.mark:bitmark--]
// [!Please mark all ==verbs==(blue)== and ==nouns==(red)==.]
//
// When Diaz returned and seated himself to play the Berceuse, I saw that he could look at me without turning his head.
//
mark: 'mark' format? ']' instruction ( text | mark-text )+
color-text: EQ text EQ '( cname ')'
color-name: 'red', 'black', 'blue', .... # replace with text?
// ['Diaz][@mark:red]
mark-text: '[\'' text ']' mark-color?
mark-color: '[@mark:' cname ']'
document-upload: 'document-upload' ( ':' ( audio-choice | image-choice | video-choice ) )? ']' instruction text
take-picture: 'take-picture' format? ']' instruction text?
record: 'record' format? ']' instruction text?
preparation-note: 'preparation-note' format? ']' instruction text?
assignment: 'assignment' format? ']' instruction text?
chat: 'chat' format? ']' HSPL senderName HSPL receiverName ( HSPL text ( OR text )* )+ HSPL
senderName: name-text image?
receiverName: name-text image?
name-text: '[#' text ']'
bot-interview: 'bot-interview' format? ']'
'bot-interview&audio]' HSPL ( text | audio | gap |
format: ( ':bitmark--' | :bitmark++ )? ( ':text' | image-format | audio-format )?
image_foramt: '&image:' image-choice?
image-choice: 'basic' | 'jpg' | 'png' | 'gif' | 'svg'
audio-format: '&audio:' audio-choice?
audio-choice: 'basic' | 'mp3' | 'mp4'
video-format: '&video:' video-choice?
video-choice: 'basic' | 'mp4' | 'flv' | 'gif' | 'wmv' | 'mpeg' | 'mpg' | 'mp4' | 'mp2'
// [&image:...]
imagebit: '[' image-format ':' resolution? url ']' ( NL '[@showInIndex]' )? ( '[@alt:' text ']' )?
audiobit: '[' audio-format ':' url ']' ( '[@alt:' text ']' )?
videobit: '[' video-format ':' url ']' ( '[@alt:' text ']' )?
resolution: '.@' [1-9][0-9]* '::'
url: 'http://' .*
| 'https://' .*
// Separators
EQ: '=='
OR: '--'
HSPL: '===' // hard split
SSPL: '---' // soft split
COMMENT: '||' .* '||'
text: .+
---------END BNF---------------------------------------------------------------------------------------------