Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/keenwrite.git

Convert EBNF to ANTLR4 syntax

AuthorDaveJarvis <email>
Date2021-04-24 12:52:33 GMT-0700
Commit19348a4726dc158a28eaebdfc9a52b668ec9ac5a
Parent72213c6
docs/development/quotes/english.ebnf
-/* Extended Backus--Naur form definition for English quotes and quotations */
-
-/* Word characters, not including straight quotes */
-/* #, $, %, &, *, +, -, /, 0-9, <, =, >, @, A-Z, \, a-z, |, ~, unicode */
-c = [#x23-#x26] | #x2A | #x2B | #x2D |
- [#x2F-#x39] | [#x3C-#x3E] | [#x40-#x5A] | #x5C | #x5E | #x5F |
- [#x61-#x7A] | #x7C |
- [#x7E-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF] ;
-
-/* Line breaks */
-cr = #xA ;
-lf = #xD ;
-eol = cr | lf | (cr lf) ;
-
-/* End of paragraph marker */
-eop = eol eol+ ;
-
-/* Word separators */
-s = (#x20 | #x9)+ ;
-
-/* Open and close quotes */
-qop = '"' ;
-qcl = '"' ;
-
-/* Apostrophes */
-apos = '\'' ;
-tick = '`' ;
-
-/* TODO: PRIMES */
-
-/* Terminal punctuation marks */
-period = '.' ;
-colon = ':' ;
-comma = ',' ;
-semicolon = ';' ;
-exclamation = '!' ;
-question = '?' ;
-aposiopesis = s* ('-' '-' '-'? | period period period) s*;
-
-/* Phrase and sentence terminators */
-terminator = period | exclamation | question | aposiopesis
- | comma | colon | semicolon ;
-
-/* A word is one or more consecutive characters */
-word = { c }+ ;
-
-/* TODO: DEFINE WORDS IN TERMS OF CONTRACTION CLASSES (inner, outer, etc.) */
-began = apos word ;
-ended = word apos ;
-inner = word (apos word)+ ;
-outer = apos word apos ;
-
-/* Ensure quotes can be found in the parse tree */
-quote = qop words qcl ;
-words = '(' words ')' | '[' words ']' | '{' words '}' | quote | words ;
-words = word (s word)* ;
-
-/* Stixi is Greek, meaning punctuation */
-stixi = words terminator ;
-stixi_d_quote = qop stixi qcl ;
-sentence = '(' stixi ')'
- | '[' stixi ']'
- | '{' stixi '}'
- | stixi_d_quote
- | stixi ;
-sentences = sentence (s sentence)* ;
-
-/* Multiline quotation */
-multiline = (qop sentences eop)+ ;
-quotation = sentences* multiline qop sentences qcl sentences* eop ;
-
-/*
-"Quotations," the professor said, "always begin with an open quote.⁋
-"If the speech crosses paragraphs, re-open the quote at the start of each.⁋
-"But at some point," she continued, "quotations must close."⁋
-*/
-
Delta0 lines added, 77 lines removed, 77-line decrease