Last modified by superadmin on 2018-01-12 20:29

HW20: Use Antlr parser generator

Use Antlr parser generator to deal with a custom non-XML markup. Process a subset of LaTeX expressions of mathematical formulae in order to create their MathML representation. For example, convert \frac{2}{3} (fraction 2/3) into a MathML notation.

Example input formats

Here is an example of LaTeX expression:

x_{1,2}=\frac{-b \pm \sqrt{b^2-4ac}}{2a}

sq_equation_formula.png - the same equation converted to an image

LaTeX can be tried out in any of the Sandbox areas of the Wikipedia (LaTeX markup is enclosed between tags <math> and </math>). We suggest that you use AntLR parser generator for Java to develop a grammar dealing with LaTeX.


  1. http://rubyforge.org/frs/?group_id=167 - installations of Ruby (e.g. take the most recent version, which at the moment of writing this is 1.8.6-25).
  2. http://en.wikipedia.org/wiki/Textile_(markup_language) - Textile markup language.
  3. http://www.w3.org/Math/ - MathML specifications and software supporting it.
  4. http://rubyforge.org/projects/ritex - Ritex software converting LaTeX formulae into MathML.
  5. http://www.artofproblemsolving.com/Wiki/index.php/LaTeX:Commands, http://www.andy-roberts.net/misc/latex/latextutorial9.html - some tutorials of LaTeX.
  6. http://lv.wikipedia.org/wiki/Wikipedia:Smil%C5%A1u_kaste - Wikipedia sandbox, a good place where to learn LaTeX markup for mathematical formulae.
Created by Kalvis Apsītis on 2007-10-21 16:15
This wiki is licensed under a Creative Commons 2.0 license
XWiki Enterprise 6.4 - Documentation