EBNF Grammar of Lojban

Lojban Machine Grammar, EBNF Version, Final Baseline

This EBNF document is explicitly dedicated to the public domain by its author, The Logical Language Group, Inc. Contact that organization at: 2904 Beau Lane, Fairfax VA 22031 USA 703-385-0273 (intl: +1 703 385 0273)

Explanation of notation: All rules have the form:

name number= bnf-expression

which means that the grammatical construct name is defined by bnf-expression. The number cross-references this grammar with the rule numbers in the YACC grammar. The names are the same as those in the YACC grammar, except that subrules are labeled with A, B, C, ... in the YACC grammar and with 1, 2, 3, ... in this grammar. In addition, rule 971 is simple_tag in the YACC grammar but stag in this grammar, because of its frequent appearance.

  1. Names in lower case are grammatical constructs.

  2. Names in UPPER CASE are selma'o (lexeme) names, and are terminals.

  3. Concatenation is expressed by juxtaposition with no operator symbol.

  4. | represents alternation (choice).

  5. [] represents an optional element.

  6. & represents and/or (A & B is the same as A | B | A B).

  7. ... represents optional repetition of the construct to the left. Left-grouping is implied; right-grouping is shown by explicit self-referential recursion with no ...

  8. () serves to indicate the grouping of the other operators. Otherwise, ... binds closer than &, which binds closer than |.

  9. # is shorthand for [free ...], a construct which appears in many places.

  10. // encloses an elidable terminator, which may be omitted (without change of meaning) if no grammatical ambiguity results.

YACC rule #0 text 0=

[NAI ...] [CMENE ... # | (indicators & free ...)] [joik-jek] text-1 YACC rule #2

text-1 2=

[(I [jek | joik] [[stag] BO] #) ... | NIhO ... #] [paragraphs] YACC rule #4

paragraphs 4=

paragraph [NIhO ... # paragraphs] YACC rule #10

paragraph 10=

(statement | fragment) [I # [statement | fragment]] ... YACC rule #11

statement 11=

statement-1 | prenex statement YACC rule #12

statement-1 12=

statement-2 [I joik-jek [statement-2]] ... YACC rule #13

statement-2 13=

statement-3 [I [jek | joik] [stag] BO # [statement-2]] YACC rule #14

statement-3 14=

sentence | [tag] TUhE # text-1 /TUhU#/ YACC rule #20

fragment 20=

ek # | gihek # | quantifier | NA # | terms /VAU#/ | prenex | relative-clauses | links | linkargs YACC rule #30

prenex 30=

terms ZOhU # YACC rule #40

sentence 40=

[terms [CU #]] bridi-tail YACC rule #41

subsentence 41=

sentence | prenex subsentence YACC rule #50

bridi-tail 50=

bridi-tail-1 [gihek [stag] KE # bridi-tail /KEhE#/ tail-terms] YACC rule #51

bridi-tail-1 51=

bridi-tail-2 [gihek # bridi-tail-2 tail-terms] ... YACC rule #52

bridi-tail-2 52=

bridi-tail-3 [gihek [stag] BO # bridi-tail-2 tail-terms] YACC rule #53

bridi-tail-3 53=

selbri tail-terms | gek-sentence YACC rule #54

gek-sentence 54=

gek subsentence gik subsentence tail-terms | [tag] KE # gek-sentence /KEhE#/ | NA # gek-sentence YACC rule #71

tail-terms 71=

[terms] /VAU#/ YACC rule #80

terms 80=

terms-1 ... YACC rule #81

terms-1 81=

terms-2 [PEhE # joik-jek terms-2] ... YACC rule #82

terms-2 82=

term [CEhE # term] ... YACC rule #83

term 83=

sumti | (tag | FA #) (sumti | /KU#/) | termset | NA KU # YACC rule #85

termset 85=

NUhI # gek terms /NUhU#/ gik terms /NUhU#/ | NUhI # terms /NUhU#/ YACC rule #90

sumti 90=

sumti-1 [VUhO # relative-clauses] YACC rule #91

sumti-1 91=

sumti-2 [(ek | joik) [stag] KE # sumti /KEhE#/] YACC rule #92

sumti-2 92=

sumti-3 [joik-ek sumti-3] ... YACC rule #93

sumti-3 93=

sumti-4 [(ek | joik) [stag] BO # sumti-3] YACC rule #94

sumti-4 94=

sumti-5 | gek sumti gik sumti-4 YACC rule #95

sumti-5 95=

[quantifier] sumti-6 [relative-clauses] | quantifier selbri /KU#/ [relative-clauses] YACC rule #97

sumti-6 97=

(LAhE # | NAhE BO #) [relative-clauses] sumti /LUhU#/ | KOhA # | lerfu-string /BOI#/ | LA # [relative-clauses] CMENE ... # | (LA | LE) # sumti-tail /KU#/ | LI # mex /LOhO#/ | ZO any-word # | LU text /LIhU#/ | LOhU any-word ... LEhU # | ZOI any-word anything any-word # YACC rule #111

sumti-tail 111=

[sumti-6 [relative-clauses]] sumti-tail-1 | relative-clauses sumti-tail-1 YACC rule #112

sumti-tail-1 112=

[quantifier] selbri [relative-clauses] | quantifier sumti YACC rule #121

relative-clauses 121=

relative-clause [ZIhE # relative-clause] ... YACC rule #122

relative-clause 122=

GOI # term /GEhU#/ | NOI # subsentence /KUhO#/ YACC rule #130

selbri 130=

[tag] selbri-1 YACC rule #131

selbri-1 131=

selbri-2 | NA # selbri YACC rule #132

selbri-2 132=

selbri-3 [CO # selbri-2] YACC rule #133

selbri-3 133=

selbri-4 ... YACC rule #134

selbri-4 134=

selbri-5 [joik-jek selbri-5 | joik [stag] KE # selbri-3 /KEhE#/] ... YACC rule #135

selbri-5 135=

selbri-6 [(jek | joik) [stag] BO # selbri-5] YACC rule #136

selbri-6 136=

tanru-unit [BO # selbri-6] | [NAhE #] guhek selbri gik selbri-6 YACC rule #150

tanru-unit 150=

tanru-unit-1 [CEI # tanru-unit-1] ... YACC rule #151

tanru-unit-1 151=

tanru-unit-2 [linkargs] YACC rule #152

tanru-unit-2 152=

BRIVLA # | GOhA [RAhO] # | KE # selbri-3 /KEhE#/ | ME # sumti /MEhU#/ [MOI #] | (number | lerfu-string) MOI # | NUhA # mex-operator | SE # tanru-unit-2 | JAI # [tag] tanru-unit-2 | any-word (ZEI any-word) ... | NAhE # tanru-unit-2 | NU [NAI] # [joik-jek NU [NAI] #] ... subsentence /KEI#/ YACC rule #160

linkargs 160=

BE # term [links] /BEhO#/ YACC rule #161

links 161=

BEI # term [links] YACC rule #300

quantifier 300=

number /BOI#/ | VEI # mex /VEhO#/ YACC rule #310

mex 310=

mex-1 [operator mex-1] ... | FUhA # rp-expression YACC rule #311

mex-1 311=

mex-2 [BIhE # operator mex-1] YACC rule #312

mex-2 312=

operand | [PEhO #] operator mex-2 ... /KUhE#/ YACC rule #330

rp-expression 330=

rp-operand rp-operand operator YACC rule #332

rp-operand 332=

operand | rp-expression YACC rule #370

operator 370=

operator-1 [joik-jek operator-1 | joik [stag] KE # operator /KEhE#/] ... YACC rule #371

operator-1 371=

operator-2 | guhek operator-1 gik operator-2 | operator-2 (jek | joik) [stag] BO # operator-1 YACC rule #372

operator-2 372=

mex-operator | KE # operator /KEhE#/ YACC rule #374

mex-operator 374=

SE # mex-operator | NAhE # mex-operator | MAhO # mex /TEhU#/ | NAhU # selbri /TEhU#/ | VUhU # YACC rule #381

operand 381=

operand-1 [(ek | joik) [stag] KE # operand /KEhE#/] YACC rule #382

operand-1 382=

operand-2 [joik-ek operand-2] ... YACC rule #383

operand-2 383=

operand-3 [(ek | joik) [stag] BO # operand-2] YACC rule #385

operand-3 385=

quantifier | lerfu-string /BOI#/ | NIhE # selbri /TEhU#/ | MOhE # sumti /TEhU#/ | JOhI # mex-2 ... /TEhU#/ | gek operand gik operand-3 | (LAhE # | NAhE BO #) operand /LUhU#/ YACC rule #812

number 812=

PA [PA | lerfu-word] ... YACC rule #817

lerfu-string 817=

lerfu-word [PA | lerfu-word] ... YACC rule #987

lerfu-word 987=

BY | any-word BU | LAU lerfu-word | TEI lerfu-string FOI YACC rule #802

ek 802=

[NA] [SE] A [NAI] YACC rule #818

gihek 818=

[NA] [SE] GIhA [NAI] YACC rule #805

jek 805=

[NA] [SE] JA [NAI] YACC rule #806

joik 806=

[SE] JOI [NAI] | interval | GAhO interval GAhO YACC rule #932

interval 932=

[SE] BIhI [NAI] YACC rule #421

joik-ek 421=

joik # | ek # YACC rule #422

joik-jek 422=

joik # | jek # YACC rule #807

gek 807=

[SE] GA [NAI] # | joik GI # | stag gik YACC rule #808

guhek 808=

[SE] GUhA [NAI] # YACC rule #816

gik 816=

GI [NAI] # YACC rule #491

tag 491=

tense-modal [joik-jek tense-modal] ... YACC rule #971

stag 971=

simple-tense-modal [(jek | joik) simple-tense-modal] ... YACC rule #815

tense-modal 815=

simple-tense-modal # | FIhO # selbri /FEhU#/ YACC rule #972

simple-tense-modal 972=

[NAhE] [SE] BAI [NAI] [KI] | [NAhE] (time [space] | space [time]) & CAhA [KI] | KI | CUhE YACC rule #1030

time 1030=

ZI & time-offset ... & ZEhA [PU [NAI]] & interval-property ... YACC rule #1033

time-offset 1033=

PU [NAI] [ZI] YACC rule #1040

space 1040=

VA & space-offset ... & space-interval & (MOhI space-offset) YACC rule #1045

space-offset 1045=

FAhA [NAI] [VA] YACC rule #1046

space-interval 1046=

((VEhA & VIhA) [FAhA [NAI]]) & space-int-props YACC rule #1049

space-int-props 1049=

(FEhE interval-property) ... YACC rule #1051

interval-property 1051=

number ROI [NAI] | TAhE [NAI] | ZAhO [NAI] YACC rule #32

free 32=

SEI # [terms [CU #]] selbri /SEhU/ | SOI # sumti [sumti] /SEhU/ | vocative [relative-clauses] selbri [relative-clauses] /DOhU/ | vocative [relative-clauses] CMENE ... # [relative-clauses] /DOhU/ | vocative [sumti] /DOhU/ | (number | lerfu-string) MAI | TO text /TOI/ | XI # (number | lerfu-string) /BOI/ | XI # VEI # mex /VEhO/ YACC rule #415

vocative 415=

(COI [NAI]) ... & DOI YACC rule #411

indicators 411=

[FUhE] indicator ... YACC rule #413

indicator 413=

(UI | CAI) [NAI] | Y | DAhO | FUhO

The following rules are non-formal:

YACC rule #1100 word 1100=

[BAhE] any-word [indicators]

any-word =

any single word (no compound cmavo)

anything =

any text at all, whether Lojban or not YACC rule #1101

null 1101=

any-word SI | utterance SA | text SU

FAhO is a universal terminator and signals the end of parsable input.