rules.cpp
1. Input Alphabet
Let the input lines be: Each line is a tuple: where:- indicates if the line is empty
- is the leading space count
- is the raw text of the line
2. State Machine Definition
We modelRuleParagraph as a deterministic state machine:
States
- : initial line evaluation
- : scanning subsequent lines until termination
- : extract paragraph content and build tokens
- : final state
Initial State
Final State
State Variables
- : current line index
- : scanning index
- : current block context
- : flag indicating terminator hit
3. Transition Rules
3.1 Start State ()
At , reject if the line is empty: If: Then: Otherwise:3.2 Scan State ()
For , continue scanning while all conditions hold: Then: Otherwise if :3.3 Extract State ()
At , the machine:- the paragraph content:
- Builds the tokens:
- Open token:
paragraph_open - Inline token:
inlinewithcontent - Close token:
paragraph_close
4. Tabular Format
5. Image
