Saturday, May 9, 2020

dynamically build latex parser grammar based on symbols used in the Physics Derivation Graph

I've been using the Sympy Latex parser. After encountering a wide variety of issues, I realized a new strategy is needed.

The previous mindset was "make modifications to the ANTLR grammar as we encounter novel issues in Latex." That approach would constant process of catching up with whatever is in the Physics Derivation Graph.

Here is a different method that takes advantage of the information available in the Physics Derivation Graph to inform the ANTLR grammar.

The Physics Derivation Graph has a list of symbols in its database. We could leverage that list of symbols and build an ANTLR grammar specification that is based on the Physics Derivation Graph list of symbols.

The process would be
  1. get list of symbols from Physics Derivation Graph
  2. add those symbols into the ANTLR grammar
  3. when Sympy parses Latex, use the modified grammar specification
  4. when new symbols are added to the Physics Derivation Graph, go to step 1

No comments:

Post a Comment