From 03ecc2e4f8ca419c1df7dd1f111a83500a18e493 Mon Sep 17 00:00:00 2001 From: thebusytypist Date: Sat, 19 Jul 2014 10:55:53 +0800 Subject: [PATCH] Add TOC and missing hash tags. --- doc/internals.md | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/doc/internals.md b/doc/internals.md index 3d0ccf7..85fcf33 100644 --- a/doc/internals.md +++ b/doc/internals.md @@ -2,32 +2,34 @@ This section records some design and implementation details. -# Value +[TOC] -## Data Layout +# Value {#Value} -## Flags +## Data Layout {#DataLayout} -# Allocator +## Flags {#Flags} -## MemoryPoolAllocator +# Allocator {#Allocator} -# Parsing Optimization +## MemoryPoolAllocator {#MemoryPoolAllocator} -## Skip Whitespace with SIMD +# Parsing Optimization {#ParsingOptimization} -## Pow10() +## Skip Whitespace with SIMD {#SkipwhitespaceWithSIMD} -## Local Stream Copy +## Pow10() {#Pow10} -# Parser +## Local Stream Copy {#LocalStreamCopy} -## Iterative Parser +# Parser {#Parser} + +## Iterative Parser {#IterativeParser} The iterative parser is a recursive descent LL(1) parser implemented in a non-recursive manner. -### Grammar +### Grammar {#IterativeParserGrammar} The grammar used for this parser is based on strict JSON syntax: ~~~~~~~~~~ @@ -47,7 +49,7 @@ value -> STRING | NUMBER | NULL | BOOLEAN | object | array Note that left factoring is applied to non-terminals `values` and `members` to make the grammar be LL(1). -### Parsing Table +### Parsing Table {#IterativeParserParsingTable} Based on the grammar, we can construct the FIRST and FOLLOW set. @@ -101,7 +103,7 @@ Finally the parsing table can be constructed from FIRST and FOLLOW set: There is a great [tool](http://hackingoff.com/compilers/predict-first-follow-set) for above grammar analysis. -### Implementation +### Implementation {#IterativeParserImplementation} Based on the parsing table, a direct(or conventional) implementation that pushes the production body in reverse order