摘要
用Python的解析工具Pyparsing对TeX文件中的数学公式进行解析。从数学类LaTeX文件中总结出LaTeX数学公式的上下文无关文法。用Pyparsing写出解析程序。解析结果可以表示LaTeX中数学公式的逻辑结构。该方法也可以用Wiki百科中数学公式的解析。
引文
[1] LaTeX https://en.wikipedia.org/wiki/LaTeX[OL].
[2] McGuire P. Getting Started with Pyparsing[M]. O'Reilly Media, 2007.
[3] Parsing expression grammar. https://en.wikipedia.org/wiki/Parsing_expression_grammar[OL].
[4] Medeiros, Sérgio, Mascarenhas F, Ierusalimschy R.Left Recursion in Parsing Expression Grammars[C],Brazilian Symposium on Programming Languages.Springer, Berlin, Heidelberg, 2012.
[5] Mozzherin D Y, Myltsev A A, Patterson D J.“gnparser”:a powerful parser for scientific names based on Parsing Expression Grammar[J]. BMC Bioinformatics, 2017, 18(1).
[6] Redziejowski R. R. Some Aspects of Parsing Expression Grammar[J] Appeared in Fundamenta Informaticae 85, 1-4(2008)441-454.
[7] Context free grammar. https://en.wikipedia.org/wiki/Context-free_grammar[OL]
[8]李泽,古超,龙政.基于Python的文本分析方法研究[J].电脑编程技巧与维护, 2018,(4):25-26.
[9] Norvell T. A Short Introduction to Regular Expressions and Context-Free Grammars[OL]. 2012-8-24.