Toinen kielioppi on edellisen kieliopin "metakielioppi", jonka avulla luen ohjelmallisesti ajonaikaisesti tuon lojban-kieliopin ja alustan "sääntöoliot" metakieliopin suorittaman parsimisen tuloksena. Metakielioppi sen sijaan on C++ -tasolla "kovakoodattu"
//
// PEG Grammar for a small subset of lojban language
//
// V.0.1
//
// ========= Notation =========
//
// [Symbol] := [Rule]
// &( ) and predicate
// !( ) not predicate
// ( )+ one or more
// ( )* zero or more
// ( )? zero or one
// E1 | E2 ordered choice
// E1 E2 sequence
//
//
// High level syntax
EBridi := (EBridiStart)? EBridiBody (EConnBridi)* // multiple connected bridi
EBridiStart := ".i" | "ni'o" // bridi start cmavo
EConnBridi := EBridiConnective EBridiBody // connected extension
EBridiConnective := ".ije" | "ri'a" | "ki'i" // bridi connectors
EBridiBody := (EBridiComp)+ // multiple
EBridiComp := ESumtiComp | ESelbriComp // Sumti- or selbri-phrase
// Selbri syntax
ESelbriComp := ("cu")? (ESpatiTempAttr)? (EConversCmavo)? EBrivla
EConversCmavo := "se" | "te" | "ve" | "xe"
// Sumti syntax
ESumtiComp := ESumtiPhrase | ESumtiTcita
ESumtiPhrase := ESingleSumtiPhr (EConnectedSumti)?
EConnectedSumti := ESumtiConnective ESingleSumtiPhr
ESumtiConnective := ".e" | ".a" | "joi" | "ce" | "ce'o"
ESingleSumtiPhr := (ESpatiTempAttr)? (ESumtiObject) (EIndirectDescrip)?
ESpatiTempAttr := "mu'o" | "ca" | "pu" | "ba" | "vi" | "va" | "vu" | "ga'u" | "ni'a" | "ca'u" | "ti'a"
ESumtiObject := EProSumti | ENamePhrase | ESelbriPlace | EAbstraction
EProSumti := "ko'i" | "ko'a" | "ko'e" | "fo'a" | "ri"
ENamePhrase := "la" EName (EProSumAssign)?
ESelbriPlace := (EPlaceTag)? EBrivlaEpress (EProSumAssign)?
EBrivlaEpress := EArticle EBrivla
EPlaceTag := "fa" | "fe" | "fi" | "fo" | "fu"
EArticle := "lo" | "le" | "lo'i" | "lei" | "le'i"
EBrivla := EGismu | ELujvo
EProSumAssign := "goi" EProSumti
EAbstraction := EArticlAbstract EAbstrPhrase
EArticlAbstract := "lenu" | "lonu"
EAbstrPhrase := EBrivla | EBridiBody
EIndirectDescrip := EAssosiation | ERelativeClause
EAssosiation := EAssosCmavo ESingleSumtiPhr
EAssosCmavo := "pe" | "po" | "po'e" | "po'u" | "ne" | "no'u"
ESumtiTcita := ESpatiTempAttr ESpatiTempExpr
ESpatiTempExpr := EAbstraction | EBrivlaEpress
ENamePhrase := ExplicitFunction_N
EGismu := ExplicitFunction_G
ELujvo := ExplicitFunction_L
//
// PEG Grammar for the PEG Grammar syntax
// "a meta grammar"
//
// V.0.1
//
// ========= Notation =========
//
// [Symbol] := [Rule]
// &( ) and predicate
// !( ) not predicate
// ( )+ one or more
// ( )* zero or more
// ( )? zero or one
// E1 | E2 ordered choice
// E1 E2 sequence
//
//
EGrammarLine := ECommentLine | ERuleClause
ECommentLine := "//" ECommentText
ERuleClause := ESymbol ":=" ERule (ECommentLine)?
ERule := ESequence | EChoice
ESequence := (ESequenceTerm)+
EChoice := EChoiceTerm EMoreChoice
ESequenceTerm := ESimppelTerm | EOperatorTerm
ESimppelTerm := ESymbol | ETerminal
EOperatorTerm := EZOne | EZMore | EOneMore | ENot | EAnd
EZOne := "(" ESimppelTerm ")?"
EZMore := "(" ESimppelTerm ")*"
EOneMore := "(" ESimppelTerm ")+"
ENot := "!(" ESimppelTerm ")"
EAnd := "&(" ESimppelTerm ")"
ESymbol := ExplicitFunction_S
ETerminal := ExplicitFunction_T