Forgot password
 Register account
View 268|Reply 0

嵌套堆栈自动机

[Copy link]

3203

Threads

7833

Posts

51

Reputation

Show all posts

hbghlyj posted 2022-9-3 10:07 |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

Quick Reply

Advanced Mode
B Color Image Link Quote Code Smilies
You have to log in before you can reply Login | Register account

$\LaTeX$ formula tutorial

Mobile version

2025-7-13 14:07 GMT+8

Powered by Discuz!

Processed in 0.017987 seconds, 43 queries