Worked on documentation, parser.

* Added planning documentation regrding the process.
* Updated grammer.
* Refactored the test code a bit.
* Added sample input file from vbs-suite
* Refactored the AST node structure created by the parser.
This commit is contained in:
Jonathan Bernard
2011-08-29 09:44:05 -05:00
parent c275fd0ce1
commit 557feaeb83
8 changed files with 398 additions and 53 deletions

View File

@ -1,8 +1,8 @@
CodePage -> DocBlock / CodeBlock
SourceFile -> (DocBlock / CodeBlock)*
DocBlock -> DirectiveBlock / MarkdownBlock
DocBlock -> (DirectiveBlock / MarkdownBlock)+
Code Block -> !DOC_START RemainingLine
Code Block -> ((!DOC_START RemainingLine) / EmptyLine)+
DirectiveBlock -> DOC_START DIRECTIVE_START (LongDirective / LineDirective)
@ -15,7 +15,9 @@ LineDirective -> ORG_DIR RemainingLine
MarkdownLine -> DOC_START !DIRECTIVE_START RemainingLine
RemainingLine -> (!EOL)+, EOL
RemainingLine -> (!EOL)+ (EOL / EOI)
EmptyLine -> EOL
Tokens
------

52
doc/phase-doc.txt Normal file
View File

@ -0,0 +1,52 @@
Parse phase
===========
Init: none
Input: Map<Name, InputStream>
Output: Map<Name, ASTNode List>
Generate phase
==============
Input: Map<Name, AST Node List>
Output: Map<Name, String>
Emitter (object)
----------------
Emitter is good for one emit run.
Object fields:
* where the value goes
* current emit state (may need existing state from generate phase)
+--Generate---------------------------------+
| |
| GenerationState--+ |
| v |
| +->Emitter>-+ |
| [Sources]>-+->Emitter>-+->[Destinations] |
| +->Emitter>-+ |
| |
| |
+-------------------------------------------+
+--Emitter----------+
| |
| GenerationState |
| Source |
| Output |
| |
+-------------------+
Emit Process:
Order nodes, emit based on type.
Refer to generation state when neccessary.
Emitters:
FormattingEmitter - accepts a paramets, formatter, that formats a block of
text.