add AST comment

This commit is contained in:
2021-03-31 13:45:47 +08:00
parent e7e7acd153
commit 03c79f0b6c
3 changed files with 37 additions and 1 deletions

View File

@@ -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 ) */

View File

@@ -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>

View File

@@ -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