Commit 1822adc0 authored by jhe's avatar jhe

lab1&lab2

parent ff3807a8
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
...@@ -24,12 +24,12 @@ class Scope { ...@@ -24,12 +24,12 @@ class Scope {
// push a name to scope // push a name to scope
// return true if successful // return true if successful
// return false if this name already exits // return false if this name already exits
bool push(const std::string& name, Value *val) { bool push(const std::string &name, Value *val) {
auto result = inner[inner.size() - 1].insert({name, val}); auto result = inner[inner.size() - 1].insert({name, val});
return result.second; return result.second;
} }
Value *find(const std::string& name) { Value *find(const std::string &name) {
for (auto s = inner.rbegin(); s != inner.rend(); s++) { for (auto s = inner.rbegin(); s != inner.rend(); s++) {
auto iter = s->find(name); auto iter = s->find(name);
if (iter != s->end()) { if (iter != s->end()) {
...@@ -62,11 +62,13 @@ class CminusfBuilder : public ASTVisitor { ...@@ -62,11 +62,13 @@ class CminusfBuilder : public ASTVisitor {
std::vector<Type *> output_params; std::vector<Type *> output_params;
output_params.push_back(TyInt32); output_params.push_back(TyInt32);
auto *output_type = FunctionType::get(TyVoid, output_params); auto *output_type = FunctionType::get(TyVoid, output_params);
auto *output_fun = Function::create(output_type, "output", module.get()); auto *output_fun =
Function::create(output_type, "output", module.get());
std::vector<Type *> output_float_params; std::vector<Type *> output_float_params;
output_float_params.push_back(TyFloat); output_float_params.push_back(TyFloat);
auto *output_float_type = FunctionType::get(TyVoid, output_float_params); auto *output_float_type =
FunctionType::get(TyVoid, output_float_params);
auto *output_float_fun = auto *output_float_fun =
Function::create(output_float_type, "outputFloat", module.get()); Function::create(output_float_type, "outputFloat", module.get());
...@@ -106,8 +108,11 @@ class CminusfBuilder : public ASTVisitor { ...@@ -106,8 +108,11 @@ class CminusfBuilder : public ASTVisitor {
std::unique_ptr<Module> module; std::unique_ptr<Module> module;
struct { struct {
// whether require lvalue
bool require_lvalue = false;
// function that is being built // function that is being built
Function *func = nullptr; Function *func = nullptr;
// TODO: you should add more fields to store state // detect scope pre-enter (for elegance only)
bool pre_enter_scope = false;
} context; } context;
}; };
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
This diff is collapsed.
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
...@@ -34,6 +34,7 @@ ASTNode *AST::transform_node_iter(syntax_tree_node *n) { ...@@ -34,6 +34,7 @@ ASTNode *AST::transform_node_iter(syntax_tree_node *n) {
*/ */
if (_STR_EQ(n->name, "program")) { if (_STR_EQ(n->name, "program")) {
auto node = new ASTProgram(); auto node = new ASTProgram();
// flatten declaration list // flatten declaration list
std::stack<syntax_tree_node *> std::stack<syntax_tree_node *>
s; // 为什么这里要用stack呢?如果用其他数据结构应该如何实现 s; // 为什么这里要用stack呢?如果用其他数据结构应该如何实现
...@@ -96,23 +97,34 @@ ASTNode *AST::transform_node_iter(syntax_tree_node *n) { ...@@ -96,23 +97,34 @@ ASTNode *AST::transform_node_iter(syntax_tree_node *n) {
// id 字段填充 // id 字段填充
node->id = n->children[1]->name; node->id = n->children[1]->name;
/* // flatten params
params 字段填充 std::stack<syntax_tree_node *> s;
注意这里的params是一个列表,每个元素都是一个ASTParam,需要flatten auto list_ptr = n->children[3]->children[0];
params -> param-list | void if (list_ptr->children_num != 0) {
param-list -> param-list , param | param if (list_ptr->children_num == 3) {
*/ while (list_ptr->children_num == 3) {
// TODO: 1.fill in the fields of ASTFunDeclaration s.push(list_ptr->children[2]);
// 1.1 flatten params list_ptr = list_ptr->children[0];
}
}
s.push(list_ptr->children[0]);
// 1.2 compound_stmt 字段填充 while (!s.empty()) {
auto child_node = static_cast<ASTParam *>(transform_node_iter(s.top()));
auto child_node_shared = std::shared_ptr<ASTParam>(child_node);
node->params.push_back(child_node_shared);
s.pop();
}
}
auto stmt_node =
static_cast<ASTCompoundStmt *>(transform_node_iter(n->children[5]));
node->compound_stmt = std::shared_ptr<ASTCompoundStmt>(stmt_node);
return node; return node;
} else if (_STR_EQ(n->name, "param")) { } else if (_STR_EQ(n->name, "param")) {
// param -> type-specifier ID | type-specifier ID [ ] // param -> type-specifier ID | type-specifier ID [ ]
// ASTParam的结构 主要需要填充的属性有 type, id, isarray // ASTParam的结构 主要需要填充的属性有 type, id, isarray
auto node = new ASTParam(); auto node = new ASTParam();
// type, id, isarray
if (_STR_EQ(n->children[0]->children[0]->name, "int")) if (_STR_EQ(n->children[0]->children[0]->name, "int"))
node->type = TYPE_INT; node->type = TYPE_INT;
else else
...@@ -123,19 +135,41 @@ ASTNode *AST::transform_node_iter(syntax_tree_node *n) { ...@@ -123,19 +135,41 @@ ASTNode *AST::transform_node_iter(syntax_tree_node *n) {
return node; return node;
} else if (_STR_EQ(n->name, "compound-stmt")) { } else if (_STR_EQ(n->name, "compound-stmt")) {
auto node = new ASTCompoundStmt(); auto node = new ASTCompoundStmt();
// TODO: 2.fill in the fields of ASTCompoundStmt if (n->children[1]->children_num == 2) {
/* // flatten local declarations
文法表达式如下 auto list_ptr = n->children[1];
compound-stmt -> { local-declarations statement-list } std::stack<syntax_tree_node *> s;
local-declarations -> local-declarations var-declaration | empty while (list_ptr->children_num == 2) {
statement-list -> statement-list statement | empty s.push(list_ptr->children[1]);
*/ list_ptr = list_ptr->children[0];
// local declarations }
// 2.1 flatten local declarations
while (!s.empty()) {
// statement list auto decl_node =
// 2.2 flatten statement-list static_cast<ASTVarDeclaration *>(transform_node_iter(s.top()));
auto decl_node_ptr = std::shared_ptr<ASTVarDeclaration>(decl_node);
node->local_declarations.push_back(decl_node_ptr);
s.pop();
}
}
if (n->children[2]->children_num == 2) {
// flatten statement-list
auto list_ptr = n->children[2];
std::stack<syntax_tree_node *> s;
while (list_ptr->children_num == 2) {
s.push(list_ptr->children[1]);
list_ptr = list_ptr->children[0];
}
while (!s.empty()) {
auto stmt_node =
static_cast<ASTStatement *>(transform_node_iter(s.top()));
auto stmt_node_ptr = std::shared_ptr<ASTStatement>(stmt_node);
node->statement_list.push_back(stmt_node_ptr);
s.pop();
}
}
return node; return node;
} else if (_STR_EQ(n->name, "statement")) { } else if (_STR_EQ(n->name, "statement")) {
return transform_node_iter(n->children[0]); return transform_node_iter(n->children[0]);
...@@ -151,18 +185,25 @@ ASTNode *AST::transform_node_iter(syntax_tree_node *n) { ...@@ -151,18 +185,25 @@ ASTNode *AST::transform_node_iter(syntax_tree_node *n) {
return node; return node;
} else if (_STR_EQ(n->name, "selection-stmt")) { } else if (_STR_EQ(n->name, "selection-stmt")) {
auto node = new ASTSelectionStmt(); auto node = new ASTSelectionStmt();
// TODO: 5.fill in the fields of ASTSelectionStmt
/*
selection-stmt -> if ( expression ) statement | if ( expression )
statement else statement ASTSelectionStmt的结构,需要填充的字段有
expression, if_statement, else_statement
*/
// 5.1 expresstion
// 5.2 if statement auto expr_node =
static_cast<ASTExpression *>(transform_node_iter(n->children[2]));
auto expr_node_ptr = std::shared_ptr<ASTExpression>(expr_node);
node->expression = expr_node_ptr;
auto if_stmt_node =
static_cast<ASTStatement *>(transform_node_iter(n->children[4]));
auto if_stmt_node_ptr = std::shared_ptr<ASTStatement>(if_stmt_node);
node->if_statement = if_stmt_node_ptr;
// check whether this selection statement contains // check whether this selection statement contains
// 5.3 else structure // else structure
if (n->children_num == 7) {
auto else_stmt_node =
static_cast<ASTStatement *>(transform_node_iter(n->children[6]));
auto else_stmt_node_ptr = std::shared_ptr<ASTStatement>(else_stmt_node);
node->else_statement = else_stmt_node_ptr;
}
return node; return node;
} else if (_STR_EQ(n->name, "iteration-stmt")) { } else if (_STR_EQ(n->name, "iteration-stmt")) {
...@@ -242,13 +283,20 @@ ASTNode *AST::transform_node_iter(syntax_tree_node *n) { ...@@ -242,13 +283,20 @@ ASTNode *AST::transform_node_iter(syntax_tree_node *n) {
} else if (_STR_EQ(n->name, "additive-expression")) { } else if (_STR_EQ(n->name, "additive-expression")) {
auto node = new ASTAdditiveExpression(); auto node = new ASTAdditiveExpression();
if (n->children_num == 3) { if (n->children_num == 3) {
// TODO: 4.fill in the fields of ASTAdditiveExpression auto add_expr_node = static_cast<ASTAdditiveExpression *>(
/* transform_node_iter(n->children[0]));
文法表达式如下 node->additive_expression =
additive-expression -> additive-expression addop term | term std::shared_ptr<ASTAdditiveExpression>(add_expr_node);
*/
// additive_expression, term, op auto op_name = n->children[1]->children[0]->name;
if (_STR_EQ(op_name, "+"))
node->op = OP_PLUS;
else if (_STR_EQ(op_name, "-"))
node->op = OP_MINUS;
auto term_node =
static_cast<ASTTerm *>(transform_node_iter(n->children[2]));
node->term = std::shared_ptr<ASTTerm>(term_node);
} else { } else {
auto term_node = auto term_node =
static_cast<ASTTerm *>(transform_node_iter(n->children[0])); static_cast<ASTTerm *>(transform_node_iter(n->children[0]));
...@@ -287,19 +335,12 @@ ASTNode *AST::transform_node_iter(syntax_tree_node *n) { ...@@ -287,19 +335,12 @@ ASTNode *AST::transform_node_iter(syntax_tree_node *n) {
return transform_node_iter(n->children[i]); return transform_node_iter(n->children[i]);
else { else {
auto num_node = new ASTNum(); auto num_node = new ASTNum();
// TODO: 3.fill in the fields of ASTNum
/*
文法表达式如下
factor -> ( expression ) | var | call | integer | float
float -> FLOATPOINT
integer -> INTEGER
*/
if (_STR_EQ(name, "integer")) { if (_STR_EQ(name, "integer")) {
// 3.1 num_node->type = TYPE_INT;
num_node->i_val = std::stoi(n->children[i]->children[0]->name);
} else if (_STR_EQ(name, "float")) { } else if (_STR_EQ(name, "float")) {
// 3.2 num_node->type = TYPE_FLOAT;
num_node->f_val = std::stof(n->children[i]->children[0]->name);
} else { } else {
_AST_NODE_ERROR_ _AST_NODE_ERROR_
} }
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
...@@ -25,6 +25,9 @@ void pass_node(char *text){ ...@@ -25,6 +25,9 @@ void pass_node(char *text){
/* to do for students */ /* to do for students */
/* two cases for you, pass_node will send flex's token to bison */ /* two cases for you, pass_node will send flex's token to bison */
\+ {pos_start = pos_end; pos_end += 1; pass_node(yytext); return ADD;} \+ {pos_start = pos_end; pos_end += 1; pass_node(yytext); return ADD;}
/****请在此补全所有flex的模式与动作 end******/
\- {pos_start = pos_end; pos_end += 1; pass_node(yytext); return SUB;} \- {pos_start = pos_end; pos_end += 1; pass_node(yytext); return SUB;}
\* {pos_start = pos_end; pos_end += 1; pass_node(yytext); return MUL;} \* {pos_start = pos_end; pos_end += 1; pass_node(yytext); return MUL;}
\/ {pos_start = pos_end; pos_end += 1; pass_node(yytext); return DIV;} \/ {pos_start = pos_end; pos_end += 1; pass_node(yytext); return DIV;}
...@@ -34,13 +37,34 @@ void pass_node(char *text){ ...@@ -34,13 +37,34 @@ void pass_node(char *text){
\>= {pos_start = pos_end; pos_end += 2; pass_node(yytext); return GTE;} \>= {pos_start = pos_end; pos_end += 2; pass_node(yytext); return GTE;}
== {pos_start = pos_end; pos_end += 2; pass_node(yytext); return EQ;} == {pos_start = pos_end; pos_end += 2; pass_node(yytext); return EQ;}
!= {pos_start = pos_end; pos_end += 2; pass_node(yytext); return NEQ;} != {pos_start = pos_end; pos_end += 2; pass_node(yytext); return NEQ;}
= {pos_start = pos_end; pos_end += 1; pass_node(yytext); return ASSIGN;} = {pos_start = pos_end; pos_end += 1; pass_node(yytext); return ASSIN;}
; {pos_start = pos_end; pos_end += 1; pass_node(yytext); return SEMICOLON;} ; {pos_start = pos_end; pos_end += 1; pass_node(yytext); return SEMICOLON;}
, {pos_start = pos_end; pos_end += 1; pass_node(yytext); return COMMA;} , {pos_start = pos_end; pos_end += 1; pass_node(yytext); return COMMA;}
/* TODO: phase1. 请在这里补充其他的词法规则 */ \( {pos_start = pos_end; pos_end += 1; pass_node(yytext); return LPARENTHESE;}
\) {pos_start = pos_end; pos_end += 1; pass_node(yytext); return RPARENTHESE;}
\[ {pos_start = pos_end; pos_end += 1; pass_node(yytext); return LBRACKET;}
\] {pos_start = pos_end; pos_end += 1; pass_node(yytext); return RBRACKET;}
\{ {pos_start = pos_end; pos_end += 1; pass_node(yytext); return LBRACE;}
\} {pos_start = pos_end; pos_end += 1; pass_node(yytext); return RBRACE;}
else {pos_start = pos_end; pos_end += 4; pass_node(yytext); return ELSE;}
if {pos_start = pos_end; pos_end += 2; pass_node(yytext); return IF;}
int {pos_start = pos_end; pos_end += 3; pass_node(yytext); return INT;}
float {pos_start = pos_end; pos_end += 5; pass_node(yytext); return FLOAT;}
return {pos_start = pos_end; pos_end += 6; pass_node(yytext); return RETURN;}
void {pos_start = pos_end; pos_end += 4; pass_node(yytext); return VOID;}
while {pos_start = pos_end; pos_end += 5; pass_node(yytext); return WHILE;}
[a-zA-Z]+ {pos_start = pos_end; pos_end += strlen(yytext); pass_node(yytext); return IDENTIFIER;}
[0-9]+ {pos_start = pos_end; pos_end += strlen(yytext); pass_node(yytext); return INTEGER;}
[0-9]+\.[0-9]*|[0-9]*\.[0-9]+ { pos_start = pos_end; pos_end += strlen(yytext); pass_node(yytext); return FLOATPOINT;}
\n {lines++; pos_start = 1; pos_end = 1;}
[ \t] {pos_start = pos_end; pos_end += 1;}
"/*" { pos_start = pos_end; pos_end += 2; BEGIN(COMMENT); }
<COMMENT>"*/" { pos_start = pos_end; pos_end += 2; BEGIN(INITIAL); }
<COMMENT>. { pos_start = pos_end; pos_start += 1; }
<COMMENT>\n { pos_start = 1; pos_end = 1; lines++; }
. { pos_start = pos_end; pos_end++; return ERROR; } . { pos_start = pos_end; pos_end++; return ERROR; }
/****请在此补全所有flex的模式与动作 end******/
%% %%
File mode changed from 100644 to 100755
...@@ -28,15 +28,13 @@ void yyerror(const char *s); ...@@ -28,15 +28,13 @@ void yyerror(const char *s);
syntax_tree_node *node(const char *node_name, int children_num, ...); syntax_tree_node *node(const char *node_name, int children_num, ...);
%} %}
/* Complete this definition. /* TODO: Complete this definition. */
Hint: See pass_node(), node(), and syntax_tree.h.
Use forward declaring. */
%union { %union {
struct _syntax_tree_node * node; struct _syntax_tree_node * node;
char * name; char * name;
} }
/* Your tokens here. */ /* TODO: Your tokens here. */
%token <node> ERROR %token <node> ERROR
%token <node> ADD %token <node> ADD
%token <node> SUB %token <node> SUB
...@@ -48,7 +46,7 @@ syntax_tree_node *node(const char *node_name, int children_num, ...); ...@@ -48,7 +46,7 @@ syntax_tree_node *node(const char *node_name, int children_num, ...);
%token <node> GTE %token <node> GTE
%token <node> EQ %token <node> EQ
%token <node> NEQ %token <node> NEQ
%token <node> ASSIGN %token <node> ASSIN
%token <node> SEMICOLON %token <node> SEMICOLON
%token <node> COMMA %token <node> COMMA
%token <node> LPARENTHESE %token <node> LPARENTHESE
...@@ -65,8 +63,8 @@ syntax_tree_node *node(const char *node_name, int children_num, ...); ...@@ -65,8 +63,8 @@ syntax_tree_node *node(const char *node_name, int children_num, ...);
%token <node> WHILE %token <node> WHILE
%token <node> IDENTIFIER %token <node> IDENTIFIER
%token <node> INTEGER %token <node> INTEGER
%token <node> FLOAT // 这个token 对应float 关键字 %token <node> FLOAT
%token <node> FLOATPOINT // 这个token 对应 浮点数值, 如果分不清的同学可以参考type-specifier的文法和对应产生式规则 %token <node> FLOATPOINT // 这个是 float 类型的 token
//%token <node> EOL //%token <node> EOL
//%token <node> BLANK //%token <node> BLANK
//%token <node> COMMENT //%token <node> COMMENT
...@@ -76,7 +74,7 @@ syntax_tree_node *node(const char *node_name, int children_num, ...); ...@@ -76,7 +74,7 @@ syntax_tree_node *node(const char *node_name, int children_num, ...);
%start program %start program
%% %%
/* Your rules here. TA has completed many */ /* TODO: Your rules here. */
program : declaration-list {$$ = node( "program", 1, $1); gt->root = $$;} program : declaration-list {$$ = node( "program", 1, $1); gt->root = $$;}
; ;
...@@ -122,8 +120,91 @@ local-declarations : local-declarations var-declaration {$$ = node( "local-dec ...@@ -122,8 +120,91 @@ local-declarations : local-declarations var-declaration {$$ = node( "local-dec
statement-list : statement-list statement {$$ = node( "statement-list", 2, $1, $2);} statement-list : statement-list statement {$$ = node( "statement-list", 2, $1, $2);}
| {$$ = node( "statement-list",0);} | {$$ = node( "statement-list",0);}
; ;
// TODO: phase1. 补充其他的文法产生式逻辑
statement : expression-stmt {$$ = node( "statement", 1, $1);}
| compound-stmt {$$ = node( "statement", 1, $1);}
| selection-stmt {$$ = node( "statement", 1, $1);}
| iteration-stmt {$$ = node( "statement", 1, $1);}
| return-stmt {$$ = node( "statement", 1, $1);}
;
expression-stmt : expression SEMICOLON {$$ = node( "expression-stmt", 2, $1, $2);}
| SEMICOLON {$$ = node( "expression-stmt", 1, $1);}
;
selection-stmt : IF LPARENTHESE expression RPARENTHESE statement {$$ = node( "selection-stmt", 5, $1, $2, $3, $4, $5);}
| IF LPARENTHESE expression RPARENTHESE statement ELSE statement {$$ = node( "selection-stmt", 7, $1, $2, $3, $4, $5, $6, $7);}
;
iteration-stmt : WHILE LPARENTHESE expression RPARENTHESE statement {$$ = node( "iteration-stmt", 5, $1, $2, $3, $4, $5);}
;
return-stmt : RETURN SEMICOLON {$$ = node( "return-stmt", 2, $1, $2);}
| RETURN expression SEMICOLON {$$ = node( "return-stmt", 3, $1, $2, $3);}
;
expression : var ASSIN expression {$$ = node( "expression", 3, $1, $2, $3);}
| simple-expression {$$ = node( "expression", 1, $1);}
;
var : IDENTIFIER {$$ = node( "var", 1, $1);}
| IDENTIFIER LBRACKET expression RBRACKET {$$ = node( "var", 4, $1, $2, $3, $4);}
;
simple-expression : additive-expression relop additive-expression {$$ = node( "simple-expression", 3, $1, $2, $3);}
| additive-expression {$$ = node( "simple-expression", 1, $1);}
;
relop : LT {$$ = node( "relop", 1, $1);}
| LTE {$$ = node( "relop", 1, $1);}
| GT {$$ = node( "relop", 1, $1);}
| GTE {$$ = node( "relop", 1, $1);}
| EQ {$$ = node( "relop", 1, $1);}
| NEQ {$$ = node( "relop", 1, $1);}
;
additive-expression : additive-expression addop term {$$ = node( "additive-expression", 3, $1, $2, $3);}
| term {$$ = node( "additive-expression", 1, $1);}
;
addop : ADD {$$ = node( "addop", 1, $1);}
| SUB {$$ = node( "addop", 1, $1);}
;
term : term mulop factor {$$ = node( "term", 3, $1, $2, $3);}
| factor {$$ = node( "term", 1, $1);}
;
mulop : MUL {$$ = node( "mulop", 1, $1);}
| DIV {$$ = node( "mulop", 1, $1);}
;
factor : LPARENTHESE expression RPARENTHESE {$$ = node( "factor", 3, $1, $2, $3);}
| var {$$ = node( "factor", 1, $1);}
| call {$$ = node( "factor", 1, $1);}
| integer {$$ = node( "factor", 1, $1);}
| float {$$ = node( "factor", 1, $1);}
;
integer : INTEGER {$$ = node( "integer", 1, $1);}
;
float : FLOATPOINT {$$ = node( "float", 1, $1);}
;
call : IDENTIFIER LPARENTHESE args RPARENTHESE {$$ = node( "call", 4, $1, $2, $3, $4);}
;
args : arg-list {$$ = node( "args", 1, $1);}
| {$$ = node( "args", 0);}
;
arg-list : arg-list COMMA expression {$$ = node( "arg-list", 3, $1, $2, $3);}
| expression {$$ = node( "arg-list", 1, $1);}
;
%% %%
...@@ -164,7 +245,7 @@ syntax_tree_node *node(const char *name, int children_num, ...) ...@@ -164,7 +245,7 @@ syntax_tree_node *node(const char *name, int children_num, ...)
{ {
syntax_tree_node *p = new_syntax_tree_node(name); syntax_tree_node *p = new_syntax_tree_node(name);
syntax_tree_node *child; syntax_tree_node *child;
// 这里表示 epsilon结点是通过 children_num == 0 来判断的 // 这里表示 epsilon结点是通过 children_num == 0 来判断的
if (children_num == 0) { if (children_num == 0) {
child = new_syntax_tree_node("epsilon"); child = new_syntax_tree_node("epsilon");
syntax_tree_add_child(p, child); syntax_tree_add_child(p, child);
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
This diff is collapsed.
This diff is collapsed.
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment