add AST comment
This commit is contained in:
@@ -23,7 +23,7 @@ typedef struct ASTString_str {
|
||||
|
||||
} ASTString;
|
||||
|
||||
/* AST Node structure, describe in ./README.md */
|
||||
/* AST Node structure */
|
||||
typedef struct ASTNode_str {
|
||||
|
||||
/* 1: string, 2: left (, 3: right ) */
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
/*
|
||||
* Author: Walter
|
||||
* Student ID: 1930006025
|
||||
* Assignment_1_Problem_3
|
||||
* uncompress using AST method
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -1,3 +1,32 @@
|
||||
/*
|
||||
* Author: Walter
|
||||
* Student ID: 1930006025
|
||||
* Assignment_1_Problem_3
|
||||
*
|
||||
* AST (Abstract Syntax Tree) is a tree representation of the abstract
|
||||
* syntactic structure of source code written in a programming language.
|
||||
* Each node of the tree denotes a construct occurring in the source code.
|
||||
*
|
||||
* First of all, ASTScanner can scan the source code with LL(1) parser,
|
||||
* return a token (ASTNode) of source code, there are 3 types of token.
|
||||
* 1: string
|
||||
* 2: loop start with repeat times
|
||||
* 3: end loop
|
||||
*
|
||||
* Then ASTScanAll() can take all token into tree.
|
||||
*
|
||||
* For example:
|
||||
* source code start3(miku6(aaa)asdf)end will generate the following tree:
|
||||
*
|
||||
* "start" -> 3 -> "end"
|
||||
* |
|
||||
* -> "miku" -> 6 -> "asdf"
|
||||
* |
|
||||
* -> "aaa"
|
||||
*
|
||||
* ASTCompileTree() can compile the tree into output.
|
||||
*/
|
||||
|
||||
#ifndef UNCOMPRESS
|
||||
#define UNCOMPRESS
|
||||
|
||||
|
||||
Reference in New Issue
Block a user