[Home]TheInquisitor/LatexGenerator

ec2-3-81-28-94.compute-1.amazonaws.com | ToothyWiki | TheInquisitor | RecentChanges | Login | Webcomic

Right. This now generates compilable LaTeX? - which tends to produce some mathematical gibberish - although it tends to overrun the size limit.

I'm done playing with this for now - other people are welcome to prod to their heart's content.

To view the results properly, you'll need to be able to compile and view LaTeX?. Sad to say, while this is worth doing for its own sake, it probably isn't worth it for the sake of playing with this properly.

Some things I found out about the BNF parser:

To get a literal '/', type '//'.

'option ::= spaces = 0' is possibly a must if you want to punctuate properly.

Currently, the parser will not spew out more than 64k of text or resolve more than 16000 tags - it'll just slap "(...)" on the end and stop; this is to prevent people setting up infinite recursion. - MoonShadow

Looking at the output now the bar has been lifted, I'm pretty sure something is recursing infinitely. I'll go through it with pen and paper and see what, later today. -- TI
(PeterTaylor) With probability 8/105, an expression will be punctuation etc + one expression. With probability 1/5 it will have two direct sub-expressions. With probability 16/105 it will have three direct sub-expressions. Someone who can be bothered can work out the expected total number of indivisible expressions in an expression.
TheInquisitor: Right. I've watered a few things down, and it appears to be a little more likely to terminate, now. If people are getting compile errors other than 'overfull (h/v)box', I'd quite like to know.

Without further ado:

BNF: TheInquisitor/LatexGenerator




 bnf ::= $$ compoundexpression $$
option ::= spaces = 0

 compoundexpression ::= expressionb sp relation sp expressionb | expressionb sp relation sp expressionb | expressionb sp relation sp compoundexpression

 relation ::= relsym | relsym | relsym | \\not relsym
relsym ::= = | = | = | = | = | < | > | \\leq | \\geq | \\equiv | \\sim | \\simeq |  \\ll | \\gg | \\approx | \\doteq | \\therefore | \\because | \\propto

 expressionb ::= exprobj | exprobj | varexpr | mathexpr | exprcomp

 expression ::= exprobj | exprobj | exprobj | exprobj | exprobj | exprobj | exprcomp
exprcomp ::= expression + expression | expression - expression | bracketexpr bracketexpr | \\frac { expression } { expression } | { expression } ^ { expression }
exprobj ::= object | object | object | object | object | object | object | object | varexpr | mathexpr
exprlist ::= expression | expression | expression | expression , exprlist
bracketexprlist ::= \\left( exprlist \\right) | \\left[ exprlist \\right] | \\left \\{ exprlist \\right \\} | \\left \\vert sp exprlist \\right \\vert
bracketexpr ::= \\left( expression \\right) | \\left[ expression \\right] | \\left \\{ expression \\right \\} | \\left \\vert sp expression \\right \\vert

 varexpr ::= { \\ varsym } _ { expression } ^ { expression } expression | { \\ varsym } _ { expression } ^ { expression } bracketexpr
varsym ::= sum | prod | coprod | int

 mathexpr ::= \\ mathsym sp expression | \\ mathsym sp bracketexpr | \\ subsym _ { expression sp relation sp expression } expression
mathsym ::= arccos | arcsin | arctan | cos | cosh | cot | coth | exp | lg | ln | log | sec | sin | sinh | tan | tanh
subsym ::= inf | lim | liminf | limsup | max | min | sup

 object ::= { negate symbol subscr supscr func }

 negate ::= nothing | nothing | nothing | nothing | nothing | negsym
subscr ::= nothing | nothing | nothing | _ { symlist }
supscr ::= nothing | nothing | nothing | ^ { symbol }
func ::= nothing | nothing | nothing | { bracketexprlist }
symlist ::= symbol | symbol | symbol , symlist

 symbol ::= letter | letter | letter | letter | \\ accent { letter }

 accent ::= hat | check | tilde | acute | grave | dot | ddot | breve | bar | vec

 negsym ::= \\pm sp | \\mp sp | - 

 letter ::= romanlower | romanlower | greeklower | greeklower | romanupper | romanupper | greekupper
romanlower ::= 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
greeklower ::= \\alpha | \\beta | \\gamma | \\delta | \\epsilon | \\zeta | \\eta | \\theta | \\iota | \\kappa | \\lambda | \\mu | \\nu | \\xi | \\pi | \\sigma | \\tau | \\upsilon | \\phi | \\chi | \\psi | \\omega
romanupper ::= 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
greekupper ::= \\Gamma | \\Delta | \\Theta | \\Lambda | \\Xi | \\Pi | \\Sigma | \\Upsilon | \\Phi | \\Psi | \\Omega | \\aleph

 sp ::= " "
nothing ::= ""



CategoryGenerator

ec2-3-81-28-94.compute-1.amazonaws.com | ToothyWiki | TheInquisitor | RecentChanges | Login | Webcomic
Edit this page | View other revisions | Recently used referrers
Last edited May 3, 2004 6:21 pm (viewing revision 37, which is the newest) (diff)
Search: