Physics Derivation Graph navigation Sign in

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

Published 2020-05-09T11:29:00.001Z by 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