syn_test.cc
来自「this is a lp0 compilator new」· CC 代码 · 共 41 行
CC
41 行
#include <iostream.h>
#include "syntax.h"
#define IF_LABEL 1
#define STATEMENT_LABEL 20
#define ELSE_LABEL 3
#define SEMICOLON 10
#define ROOT_LABEL 100
int main (void)
{
syntaxNode s1, s2, s3, s4, root,
s5, s6, s7, s8;
syntaxNode* list[4];
s1.SetLabel (IF_LABEL);
s2.SetLabel (STATEMENT_LABEL);
s3.SetLabel (ELSE_LABEL);
s4.SetLabel (STATEMENT_LABEL);
list[0] = &s1;
list[1] = &s2;
list[2] = &s3;
list[3] = &s4;
s5.SetLabel (STATEMENT_LABEL);
s5.AdoptChildren (4, list);
s6.SetLabel (SEMICOLON);
s7.SetLabel (STATEMENT_LABEL);
list[0] = &s5;
list[1] = &s6;
list[2] = &s7;
root.SetLabel (ROOT_LABEL);
root.AdoptChildren (3, list);
root.PrintTree (cout);
return (0);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?