// file: math-grm-standard.def // version: 1.0 // // Provides an open grammar that can be used to recognize math // expressions. // _____________________________________________________________________________ /* quick reminder about the syntax supported by MkMathGrammar . comments: . whole line comments starting with //, # or " sign (up to end of line) . block comments delimited by /* */ (can be nested) . inline comments are not supported . terminal symbol definitions: . terminal_name = terminal_str . terminal_name is defined as: [-a-zA-Z_][-a-zA-Z_0-9]* . terminal_str is defined as: ( ( !EOL . )+ | EOL space+ )+ . space is defined as ' ' | '\t' . EOL is defined as '\r\n' | '\n' | '\r' . terminal_ str is allowed to span multiple lines provided a "continuation line" starts with a space, which allows you to pretty format long terminal symbol definitions . rule definitions: . non_terminal_name ::= rule (| rule)? . non_terminal_name is defined as: [-a-zA-Z_][-a-zA-Z_0-9]* . supported rules are: . identity(source) . hpair(left, right) . fence(source, left, right) . fraction(numerator, denominator) . sqrt(source) . subscript(source, index) . superscript(source, exponent) . subsuperscript(source, index, exponent) . underscript(source, bottom) . overscript(source, top) . underoverscript(source, bottom, top) . presuperscript(source, exponent) . vpair(top, bottom) . leftfence(source, left) . presubscript(source, exponent) . vlist(source) . columnaroperation(digit, carry, decimal_separator_flags, cancel_flags, operation_flags) . decimal_separator_flags are defined as 'none' | 'dot' | 'comma' . cancel_flags are defined as 'none' | 'cancel' | 'bcancel' | 'xcancel' . operation_flags are defined as 'addition' | 'subtraction' | 'multiplication' | 'division english' | 'division french' | 'division dutch' | 'division indian' | 'division german' . rule continuations allow you to pretty format rule definitions by avoiding repeating target non_terminal_name . start symbol definition: . start(non_terminal_name) apart from continuation lines, everything is pretty much space insensitive */ // terminal symbol definitions symbol1 = 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z Γ Δ Θ Λ Ξ Π Σ Υ Φ Ω α β γ δ ε η ζ θ ι κ λ ν ξ π ρ σ τ υ φ χ ψ ω ϕ µ Ψ ℂ ℕ ℚ ℝ ℤ 𝔻 ℑ ℜ ℓ ℱ ℒ € $ £ ¥ ₩ ¢ ( ) < > [ ] { } ⟨ ⟩ ⌈ ⌉ ⌊ ⌋ ⟦ ⟧ ! # % & ? @ / \ | ∥ © ∂ ∅ ∇ ∞ ℏ ‰ ⊥ ∦ ⫻ ∴ ∵ □ △ km hm dam dm cm mm µm ha hl dal dl cl ml µl kg hg dag dg cg mg µg ms µs GHz MHz kHz Hz dx dy dz dt sin cos tan cot asin acos atan acot arcsin arccos arctan arccot cosh sinh tanh coth acosh asinh atanh acoth arcosh arsinh artanh arcoth min max arg argmin argmax inf sup lim liminf limsup ln log exp lg card Im Re µA µC µF µHz µJ µN µPa µS µT µV µW µWb µWh µbar µcd µeV µlm µlx det dim deg sec Pr csc ker gcd symbol2 = + - ± ∓ × ÷ * ∘ · = ' , . … : ; _ ⋮ ⋱ ⋰ ← ↑ → ↓ ↔ ↕ ↖ ↗ ↘ ↙ ↼ ⇀ ↽ ⇁ ⇐ ⇑ ⇒ ⇓ ⇔ ⇕ ⇋ ⇌ ∃ ∄ ∈ ∉ ∋ ∌ ∩ ∪ ⊂ ⊃ ⊄ ⊅ ⊆ ⊈ ⊇ ⊉ ∼ ≃ ≠ ≡ ≢ ≒ ≈ ≄ ≅ ≆ ≇ ≈ ≉ ≤ ≥ ≪ ≫ ≮ ≯ ≰ ≱ ≦ ≧ ∀ ∝ ∠ ∧ ∨ ⦞ ⊕ ⊗ ⊖ ⊙ ⋉ ⋊ ¬ symbol3 = ∏ ∑ ∫ ∮ ∬ ∭ ∯ ∰ ∐ symbol4 = ∏ ∑ ∫ ∮ ∬ ∭ ∯ ∰ ∐ min max arg argmin argmax inf sup lim liminf limsup symbol5 = - ∧ ← → ↔ ⌒ symbol6 = ( [ { | ∥ ⟨ ⌈ ⌊ ⟦ ] symbol7 = ) ] } | ∥ ⟩ ⌉ ⌋ ⟧ [ symbol8 = { symbol9 = √ // rule definitions sqrtTerm ::= sqrt(term) | identity(symbol9) table ::= table(term) vectorTerm ::= vpair(term, term) | vpair(vectorTerm, term) system ::= leftfence(vectorTerm, symbol8) exponentiable ::= identity(symbol1) | identity(sqrtTerm) | presuperscript(sqrtTerm, term) | overscript(term, symbol5) | fence(term, symbol6, symbol7) | fence(table, symbol6, symbol7) term ::= identity(exponentiable) | identity(symbol2) | identity(symbol3) | hpair(term, term) | fraction(term, term) | partialfractionnumerator(term) | partialfractiondenominator(term) | slantedfraction(term, term) | subscript(exponentiable, term) | superscript(exponentiable, term) | subsuperscript(exponentiable, term, term) | underscript(symbol4, term) | overscript(symbol3, term) | underoverscript(symbol3, term, term) expression ::= identity(term) | identity(system) | hpair(term, system) vlist ::= vlist(expression) // start symbol start(vlist)