⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 syn_test.cc

📁 this is a lp0 compilator new
💻 CC
字号:
#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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -