编译器:用python编写的C ++子集的玩具编译器

时间:2021-02-02 13:39:59
【文件属性】:
文件名称:编译器:用python编写的C ++子集的玩具编译器
文件大小:102KB
文件格式:ZIP
更新时间:2021-02-02 13:39:59
compiler CompilerPython 编译器 一个用python编写的c ++语法子集的玩具编译器需要python3,antlr4,antlr4-python3-runtime 在以下说明中,您可以在环境中将python3替换为python,将pip3替换为pip 要安装antlr4-python3-runtime,请运行pip3 install antlr4-python3-runtime == 4.6 安装 要安装,请运行python3 setup.py install 进行演示 首先,创建一个新文件,在其中写入一些代码(例如以下文件),并将其命名为test.c。 class A { int foo () { if (a < 0 ) { return a++; } else { return a--; } } int a; } int sum ( int i) { int s = 0 ; int j; for (j = 0 ; j < i; j++) { s += j; } return s; }

网友评论