Forgot password?
 Create new account
View 147|Reply 0

嵌套堆栈自动机

[Copy link]

3147

Threads

8493

Posts

610K

Credits

Credits
66163
QQ

Show all posts

hbghlyj Posted at 2022-9-3 10:07:08 |Read mode
input/tex/StackItem.ts
   * TeX parsing in MathJax is essentially implemented via a nested stack automaton. That is the tex parser works on a stack, and each item on the stack can have a data stack of its own. Data on the stack is either a stack item or a node.
   * The checkItem method effectively implements the recursive checking of input data from the parser against data recursively given on the stack.
   * I.e., new input is parsed resulting in a new item. When pushed on the stack it is checked against the top most item on the stack. This either leads to the item being pushed onto the stack or combined with the top most element(s), pushing a new item, which is recursively checked, unless an error is thrown.
   * A simple example: If \\end{foo} is parsed, an endItem is created, pushed on the stack. Nodes on the stack are collapsed into content of the 'foo' environment, until a beginItem for 'foo' is found.  If a beginItem is not for 'foo' or does not exist an error is thrown.

en.wikipedia.org/wiki/Nested_stack_automaton

手机版Mobile version|Leisure Math Forum

2025-4-20 22:16 GMT+8

Powered by Discuz!

× Quick Reply To Top Return to the list