├── .gitattributes ├── .gitignore ├── LICENSE ├── README.md ├── executor ├── __init__.py └── executor.py ├── generator ├── __init__.py ├── errors.py ├── generator.py ├── symbol_table.py ├── types.py └── util.py ├── main.py ├── parser_ ├── C.g4 ├── C.tokens ├── CLexer.py ├── CLexer.tokens ├── CListener.py ├── CParser.py ├── CVisitor.py └── __init__.py ├── test.py ├── test ├── AVLTree.c ├── KMP.c ├── __init__.py ├── arithmetic.c ├── fibonacci.c ├── linkedlist.c ├── palindrome.c └── testcase.py └── unit_test ├── __init__.py ├── array.c ├── array.txt ├── assignment_operator.c ├── assignment_operator.txt ├── error.c ├── expression.c ├── function.c ├── function.txt ├── initialize.c ├── initialize.txt ├── loop.c ├── loop.txt ├── pointer.c ├── pointer.txt ├── scope.c ├── scope.txt ├── select.c ├── select.txt ├── struct.c ├── struct.txt ├── temp.txt ├── testcase.py ├── unaryop.c └── unaryop.txt /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | *.egg-info/ 24 | .installed.cfg 25 | *.egg 26 | MANIFEST 27 | 28 | # PyInstaller 29 | # Usually these files are written by a python script from a template 30 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 31 | *.manifest 32 | *.spec 33 | 34 | # Installer logs 35 | pip-log.txt 36 | pip-delete-this-directory.txt 37 | 38 | # Unit test / coverage reports 39 | htmlcov/ 40 | .tox/ 41 | .nox/ 42 | .coverage 43 | .coverage.* 44 | .cache 45 | nosetests.xml 46 | coverage.xml 47 | *.cover 48 | .hypothesis/ 49 | .pytest_cache/ 50 | 51 | # Translations 52 | *.mo 53 | *.pot 54 | 55 | # Django stuff: 56 | *.log 57 | local_settings.py 58 | db.sqlite3 59 | 60 | # Flask stuff: 61 | instance/ 62 | .webassets-cache 63 | 64 | # Scrapy stuff: 65 | .scrapy 66 | 67 | # Sphinx documentation 68 | docs/_build/ 69 | 70 | # PyBuilder 71 | target/ 72 | 73 | # Jupyter Notebook 74 | .ipynb_checkpoints 75 | 76 | # IPython 77 | profile_default/ 78 | ipython_config.py 79 | 80 | # pyenv 81 | .python-version 82 | 83 | # celery beat schedule file 84 | celerybeat-schedule 85 | 86 | # SageMath parsed files 87 | *.sage.py 88 | 89 | # Environments 90 | .env 91 | .venv 92 | env/ 93 | venv/ 94 | ENV/ 95 | env.bak/ 96 | venv.bak/ 97 | 98 | # Spyder project settings 99 | .spyderproject 100 | .spyproject 101 | 102 | # Rope project settings 103 | .ropeproject 104 | 105 | # mkdocs documentation 106 | /site 107 | 108 | # mypy 109 | .mypy_cache/ 110 | .dmypy.json 111 | dmypy.json 112 | 113 | # Pyre type checker 114 | .pyre/ 115 | 116 | *.DS_Store 117 | *.interp 118 | .idea/* 119 | parser/*.class 120 | parser/*.java 121 | *.ll 122 | *.bc 123 | *.out 124 | reference/* 125 | unit_test/temp.txt 126 | unit_test/temp.txt 127 | unit_test/temp.txt 128 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 JunguangJiang 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 本文的石墨文档链接 [https://shimo.im/docs/CNQYjCjRt3QF89hz](https://shimo.im/docs/CNQYjCjRt3QF89hz) 2 | github地址 [https://github.com/JunguangJiang/TinyCCompiler/tree/master](https://github.com/JunguangJiang/TinyCCompiler/tree/master) 3 | # 开发环境 4 | python 3.6 5 | ANTLR 可通过pip install antlr4-python3-runtime安装 6 | LLVM 可通过pip install llvmlite安装 7 | # 代码结构 8 | * parser 9 | * C.g4 C语言的完整语法文件,来自于[ANTLR官方对C语言的支持](https://github.com/antlr/grammars-v4/blob/master/c/C.g4) 10 | * CLexer.py 由C.g4自动生成的词法分析代码 11 | * CParser.py 由C.g4自动生成的语法分析代码 12 | * CVistor.py 我们的语义分析基于ANTLR的Visitor模式进行 13 | * generator 14 | * generator.py 实现从C语言代码转成LLLVM IR代码 15 | * symbol_table.py 实现符号表 16 | * types.py 封装C语言中的基本类型,以及基本类型之间的转换 17 | * errors.py 实现语言异常类,以及对转换过程中的语法与语义错误进行监听 18 | * util.py 其他的常用函数 19 | * executor 20 | * executor.py LLVM IR代码的解释器 21 | * test 22 | * testcase.py 自动测试时所有需要执行的测试文件,具体如下 23 | ``` 24 | "arithmetic.c", # 四则运算测试 25 | "palindrome.c", # 回文测试 26 | "KMP.c", # KMP测试文件 27 | "AVLTree.c", # AVL树 28 | "linkedlist.c", # 链表 29 | "fibonacci.c", # 斐波那契数计算,需要通过命令交互得到结果,因此不会进行自动测试 30 | ``` 31 | * unit_test 在开发过程中,为了保证团队的代码不互相干扰,针对C语言的各个功能特性,编写了一系列的功能测试脚本,每个脚本以.c结尾,程序正确运行时的输出在.txt文件中。 32 | * testcase.py 所有的测试文件名字,以及负责测试的功能,具体如下 33 | ``` 34 | "function.c", # 函数测试 35 | "initialize.c", # 变量初始化测试 36 | "pointer.c", #指针测试 37 | "assignment_operator.c", # 赋值和运算符测试 38 | "loop.c", # 循环测试 39 | "select.c", # 选择分支测试 40 | "scope.c", # 作用域测试 41 | "struct.c", # 结构体和指针相关测试 42 | "array.c", # 数组测试 43 | "unaryop.c", # 一元运算符测试 44 | ``` 45 | * test.py 运行自动测试 46 | * main.py 编译C语言生成IR代码(但不运行) 47 | # 使用说明 48 | 0. 下述所有命令都必须在main.py同级目录下执行。 49 | 50 | 1. 编译代码 51 | ``` 52 | python main.py 输入的C文件 53 | ``` 54 | 例如 55 | ``` 56 | python main.py test/arithmetic.c 57 | ``` 58 | 59 | 注:如果想要合并编译和执行的步骤可以参考“3.测试”,运行以下命令 60 | ``` 61 | python test.py test/arithmetic.c 62 | ``` 63 | 64 | 2. 执行IR代码 65 | ``` 66 | python executor/executor.py test/arithmetic.ll 67 | ``` 68 | 69 | 3. 测试 70 | 71 | 运行test/testcase.py下的所有测试(不打印异常) 72 | ``` 73 | python test.py 74 | ``` 75 | 76 | 运行unit_test/testcase.py下的所有测试(不打印异常,需要在unit_test下提供相应的输出文件.txt,测试脚本会自动判断程序的输出是否正确) 77 | ``` 78 | python test.py unit 79 | ``` 80 | 81 | 对某个特定的C语言文件hello.c进行测试(打印异常) 82 | ``` 83 | python test.py test/arithmetic.c 84 | ``` 85 | # 功能实现与难点 86 | ## 符号表 87 | 为每个作用域维护一层符号表,根据变量名或者函数名进行查找时,首先从最深层的符号表进行查找。局部作用域包括函数体内部、循环内部以及选择分支内部。 88 | 当离开一个作用域时,会将该层对应的符号表删除。 89 | 具体实现见generator/symbol_table.py。 90 | 作用域相关的测试代码见unit_test/scope.c。 91 | ## 错误处理 92 | 包括两类错误, 93 | 语法错误SyntaxError,由CParser在进行语法分析时产生,TinyCErrorListener (generator/errors.py)会监听所有的SyntaxError。 94 | 语义错误SemanticError(generator/errors.py), 由generator/generator.py中进行语义分析时,调用raise SemanticError产生。而SemanticError的捕获是以语句块(blockItem或者externalDeclaration)为单位的。也就是说,编译器会在某行代码出现错误后跳过该行代码,继续编译下一行代码。在编译结束后,会打印出所有的语法和语义错误。 95 | 目前能够检测到的语义错误包括: 96 | * 变量名重定义 97 | * 变量名未定义 98 | * 函数定义和声明的类型(包括参数类型)不匹配 99 | * 数组声明的范围不合法(不是正整数) 100 | * break和continue出现在非循环语句块中 101 | * 不合法的运算符(比如浮点数取模等) 102 | * 不支持的类型转换 103 | ## 运算符及优先级 104 | * 支持所有的二元运算符, 105 | * 算术运算符(+, -, *, /, %) 106 | * 位运算符(&, |, ^, >>, <<) 107 | * 逻辑运算符(&&, ||(实现短路原则), !, ~) 108 | * 关系运算符(<, >, <=, >=, !=, ==)。 109 | * 支持三元运算符,即条件表达式“...?...:...”,采用分支和临时变量实现,即判断条件后执行对应的表达式求值,存放在临时变量中作为条件表达式的返回值。 110 | * 支持所有的赋值运算符,包括=, *=, /=, %=, +=, -=, <<=, >>=, &=, ^=, |=。 111 | * 优先级从低到高为:赋值运算符 < 三元运算符 < “||” < “&&” < “|” < “^” < “&” < “==, !=” < “<, >, <=, >=” < “<<, >>” < “+, -” < “*, /, %”。 112 | * 支持前加减、后加减 113 | ## 基本变量类型及其转换 114 | * 支持的变量类型包括int,short,char,bool,float,double和void。 115 | * 支持整数的扩展和截取、浮点数精度的调整、整数到布尔值的转换、整数和浮点数的相互转换、整数和指针的相互转换、不同指针类型的转换(由generator/types.py的cast_type实现)。 116 | * 在变量赋值时,如果变量类型与值不匹配,则会对值进行强制转换。 117 | * char的支持'3', '\n', '\0', 0等形式的赋值(由generator/types.py的get_const_from_str实现)。 118 | 119 | 注:为了能够调用malloc和free函数,需要实现unsigned类型,此处采用比较简单的策略——忽视所有的unsigned,当代码中出现unsigned int时,对应的依然是int类型。 120 | ## 选择结构程序设计 121 | * 支持if, if-else, switch-case语句。 122 | * 其中,switch-case语句支持default语句和break跳转,以及没有break时case语句从上而下依次执行,实现时将标签和语句块分开,一旦标签匹配上则从对应位置向下开始执行语句,直到break(或return)或语句块结束。 123 | ## 循环结构程序设计 124 | * 支持for、do-while、while三种循环。 125 | * 支持break和continue跳转。当进入一个新的循环块时,会同时维护旧的break、continue块和新的break、continue块,从而保证多层循环能够正确的跳转。 126 | * for循环与标准的C for循环基本一致,初始化条件可以是多条语句(以','分割) 127 | ## 数组 128 | 支持多维数组,初始化时采用嵌套的方式进行初始化(如下所示)。 129 | ``` 130 | int array[3][4] = { 131 | {1,2,3,4}, 132 | {5,6,7,8}, 133 | {9,11,12,13} 134 | }; 135 | ``` 136 | 可以通过char []定义任意长度的字符串 137 | ``` 138 | char c[] = "Hello world"; 139 | ``` 140 | ## 函数 141 | * 实现了函数的声明和定义。 142 | * 支持变长参数。通过识别'...'来判断函数是否变长。 143 | * 支持函数的递归调用。见测试test/fibonacci.c. 144 | * 通过声明库函数的方式可以调用库函数,例如printf,scanf,exit等。 145 | * 相关的测试代码见unit_test/function.c。 146 | ## 指针 147 | * 支持指针的定义。 148 | * 支持取地址运算符&。 149 | * 可以通过指针运算符*访问指针指向的对象。 150 | * 支持指针的嵌套,即int **p。 151 | * 支持字符串定义,如下所示。 152 | ``` 153 | char *c = "Hello world"; 154 | ``` 155 | ## 结构体 156 | * 支持结构体的声明和定义。 157 | * 支持.和->运算符用于获取结构体的成员。 158 | * 结构体内支持其他结构体类型、基本数据类型(包括指针类型)作为成员变量。 159 | * 结构体内支持指向自身结构体类型的指针,可实现链表及各种高级数据结构的定义。 160 | 161 | 测试见linkedlist.c和AVLTree.c,分别实现了基础的链表和AVL树。 162 | 在AVLTree.c中,实现了一颗简易版平衡二叉树,能够插入结点和打印树的结构,但是由于时间原因(以及数据结构课没学好)现在不能删除已经插入的结点。该文件的实现用到了c语言中大量语法特性,可以相对比较充分地展示我们的TinyCCompiler的功能。包括库函数(malloc、free、printf)调用,函数定义,结构体声明,结构体定义,结构体指针,指向结构体指针的指针,多层函数的递归调用,switch-case、if-else控制流语句等等。 163 | 164 | -------------------------------------------------------------------------------- /executor/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JunguangJiang/TinyCCompiler/fe612e12f294e0c29b46e6dbf2be314ab56f7309/executor/__init__.py -------------------------------------------------------------------------------- /executor/executor.py: -------------------------------------------------------------------------------- 1 | import llvmlite.binding as llvm 2 | import sys 3 | from ctypes import CFUNCTYPE, c_int 4 | 5 | def create_execution_engine(): 6 | """ 7 | Create an ExecutionEngine suitable for JIT code generation on 8 | the host CPU. The engine is reusable for an arbitrary number of 9 | modules. 10 | """ 11 | # Create a target machine representing the host 12 | target = llvm.Target.from_default_triple() 13 | target_machine = target.create_target_machine() 14 | # And an execution engine with an empty backing module 15 | backing_mod = llvm.parse_assembly("") 16 | engine = llvm.create_mcjit_compiler(backing_mod, target_machine) 17 | return engine 18 | 19 | 20 | def compile_ir(engine, llvm_ir): 21 | """ 22 | Compile the LLVM IR string with the given engine. 23 | The compiled module object is returned. 24 | """ 25 | # Create a LLVM module object from the IR 26 | mod = llvm.parse_assembly(llvm_ir) 27 | mod.verify() 28 | # Now add the module and make sure it is ready for execution 29 | engine.add_module(mod) 30 | engine.finalize_object() 31 | return mod 32 | 33 | 34 | def execute(ir_filename): 35 | """ 36 | 执行ir代码 37 | :param ir_filename:文件名 38 | :param 代码输出的文件,如果没有,则打印在屏幕上 39 | :return: 40 | """ 41 | # All these initializations are required for code generation! 42 | llvm.initialize() 43 | llvm.initialize_native_target() 44 | llvm.initialize_native_asmprinter() 45 | 46 | with open(ir_filename) as f: 47 | llvm_ir = f.read() 48 | engine = create_execution_engine() 49 | mod = compile_ir(engine, llvm_ir) 50 | 51 | main_type = CFUNCTYPE(c_int) 52 | main_func = main_type(engine.get_function_address("main")) 53 | ret = main_func() 54 | 55 | return ret 56 | 57 | 58 | if __name__ == '__main__': 59 | if len(sys.argv) < 2: 60 | print("IR filename required. Usage: python executor.py IR_filename") 61 | exit(-1) 62 | 63 | ret = execute(sys.argv[1]) 64 | if ret is not None: 65 | print("Program exits with code ", ret) -------------------------------------------------------------------------------- /generator/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JunguangJiang/TinyCCompiler/fe612e12f294e0c29b46e6dbf2be314ab56f7309/generator/__init__.py -------------------------------------------------------------------------------- /generator/errors.py: -------------------------------------------------------------------------------- 1 | from antlr4.error.ErrorListener import ErrorListener 2 | 3 | 4 | class SemanticError(Exception): 5 | """语义错误基类""" 6 | def __init__(self, msg, ctx=None): 7 | super().__init__() 8 | if ctx: 9 | self.line = ctx.start.line #错误出现位置 10 | self.column = ctx.start.column 11 | else: 12 | self.line = 0 13 | self.column = 0 14 | self.msg = msg 15 | 16 | def __str__(self): 17 | return "SemanticError: " + str(self.line) + ":" + str(self.column) + " " + self.msg 18 | 19 | 20 | class TinyCErrorListener(ErrorListener): 21 | """错误监听器""" 22 | def __init__(self): 23 | super().__init__() 24 | self.errors = [] 25 | 26 | def syntaxError(self, recognizer, offendingSymbol, line, column, msg, e): 27 | """进行语法分析时,若出现语法错误自动调用该函数""" 28 | exception = "Syntax Error: " + str(line) + ":" + str(column) + " " + msg 29 | self.errors.append(exception) 30 | 31 | def register_semantic_error(self, error): 32 | """在进行语义分析时,在结束语义错误异常时,需手动调用该函数,error是错误异常类""" 33 | self.errors.append(str(error)) 34 | 35 | def print_errors(self): 36 | """打印错误""" 37 | for err in self.errors: 38 | print(err) 39 | print(len(self.errors), "errors generated.") 40 | # TODO 8错误报告打印的美化?使得打印出的错误类似于gcc的错误报告(彩色、有错误位置箭头等) 41 | 42 | -------------------------------------------------------------------------------- /generator/symbol_table.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | 4 | class RedefinitionError(Exception): 5 | """重定义错误""" 6 | def __init__(self, name): 7 | """ 8 | :param name: 重定义的变量名 9 | """ 10 | self.name = name 11 | 12 | 13 | class SymbolTable: 14 | """符号表""" 15 | def __init__(self): 16 | self.__tables = [{},] 17 | self.__level = 0 # 当前的嵌套层数 18 | 19 | def __getitem__(self, item): 20 | for l in range(self.__level, -1, -1): 21 | if item in self.__tables[l]: 22 | return self.__tables[l][item] 23 | return None 24 | 25 | def __setitem__(self, key, value): 26 | if key in self.__tables[self.__level]: 27 | raise RedefinitionError(key) 28 | self.__tables[self.__level][key] = value 29 | 30 | def __contains__(self, item): 31 | for l in range(self.__level, -1, -1): 32 | if item in self.__tables[l]: 33 | return True 34 | return False 35 | 36 | def enter_scope(self): 37 | """进入一个新的作用域""" 38 | self.__level += 1 39 | self.__tables.append({}) 40 | 41 | def exit_scope(self): 42 | """退出一个作用域""" 43 | if self.__level == 0: 44 | return 45 | self.__tables.pop(-1) 46 | self.__level -= 1 47 | 48 | 49 | class SymbolTableTest(unittest.TestCase): 50 | """符号表单元测试""" 51 | def setUp(self): 52 | self.symbol_table = SymbolTable() 53 | 54 | def tearDown(self): 55 | pass 56 | 57 | def test_1(self): 58 | """内层变量覆盖外层同名变量""" 59 | self.symbol_table["abc"] = 123 60 | self.symbol_table.enter_scope() 61 | self.assertEqual(self.symbol_table["abc"],123) 62 | self.symbol_table["abc"] = 333 63 | self.assertEqual(self.symbol_table["abc"], 333) 64 | self.symbol_table.exit_scope() 65 | self.assertEqual(self.symbol_table["abc"], 123) 66 | 67 | def test_2(self): 68 | """离开当前作用域后需要删除临时变量""" 69 | self.symbol_table.enter_scope() 70 | self.symbol_table["abc"] = 333 71 | self.assertEqual(self.symbol_table["abc"], 333) 72 | self.symbol_table.exit_scope() 73 | self.assertIsNone(self.symbol_table["abc"]) 74 | 75 | 76 | if __name__ == '__main__': 77 | unittest.main() -------------------------------------------------------------------------------- /generator/types.py: -------------------------------------------------------------------------------- 1 | import llvmlite.ir as ir 2 | from generator.util import parse_escape 3 | from generator.errors import SemanticError 4 | 5 | 6 | class TinyCTypes(object): 7 | int = ir.IntType(32) 8 | short = ir.IntType(16) 9 | char = ir.IntType(8) 10 | bool = ir.IntType(1) 11 | float = ir.DoubleType() 12 | double = ir.DoubleType() 13 | void = ir. VoidType() 14 | # 字符串到C变量类型映射表 15 | str2type = { 16 | "int": int, 17 | "short": short, 18 | "char": char, 19 | "long": int, 20 | "bool": bool, 21 | "float": float, 22 | "double": double, 23 | "void": void 24 | } 25 | # ASCII 转义表 26 | ascii_mapping = { 27 | '\\a': 7, 28 | '\\b': 8, 29 | '\\f': 12, 30 | '\\n': 10, 31 | '\\r': 13, 32 | '\\t': 9, 33 | '\\v': 11, 34 | '\\\\': 92, 35 | '\\?': 63, 36 | "\\'": 39, 37 | '\\"': 34, 38 | '\\0': 0, 39 | } 40 | 41 | @classmethod 42 | def get_const_from_str(cls, ctype, const_value, ctx): 43 | """ 44 | 从字符串获得常数类型 45 | :param ctype: 类型,接受char,float,double,short,int,ir.ArrayType 46 | :param const_value: 值,是一个字符串 47 | :return: 48 | """ 49 | if type(const_value) is str: 50 | if ctype == cls.char: 51 | if len(const_value) == 3: # 若const_value形如'3', 52 | return cls.char(ord(str(const_value[1:-1]))) # 则将ASCII字符转成对应的整数存储 53 | elif len(const_value) == 1: # 若const_value形如44 54 | return cls.char(int(const_value)) #则已经是整数了 55 | else: # 若const_value是转移字符,例如'\n' 56 | value = const_value[1:-1] 57 | if value in cls.ascii_mapping: 58 | return cls.char(cls.ascii_mapping[value]) 59 | else: 60 | raise SemanticError(ctx=ctx, msg="Unknown char value: %s"% value) 61 | elif ctype in [cls.float, cls.double]: 62 | return ctype(float(const_value)) 63 | elif ctype in [cls.short, cls.int]: 64 | return ctype(int(const_value)) 65 | elif isinstance(ctype, ir.ArrayType) and ctype.element == cls.char: 66 | # string 67 | str_val = parse_escape(const_value[1:-1]) + '\0' 68 | return ir.Constant(ctype, bytearray(str_val, 'ascii')) 69 | else: 70 | # TODO 71 | raise SemanticError(msg="No known conversion: '%s' to '%s'" % (const_value, ctype)) 72 | else: 73 | raise SyntaxError(ctx=ctx, msg="get_const_from_str doesn't support const_value which is a " + str(type(const_value))) 74 | 75 | @classmethod 76 | def is_int(cls, type): 77 | """判断某个类型是否为整数类型""" 78 | return type in [cls.int, cls.short, cls.char] 79 | 80 | @classmethod 81 | def is_float(cls, type): 82 | """判断某个类型是否为浮点数类型""" 83 | return type in [cls.float, cls.double] 84 | 85 | @classmethod 86 | def cast_type(cls, builder, target_type, value, ctx): 87 | """ 88 | 强制类型转换 89 | :param builder: 90 | :param target_type:目标类型 91 | :param value: 92 | :return:转换后的数字 93 | """ 94 | if value.type == target_type: #如果转换前后类型相同, 95 | return value #则不转换,直接返回 96 | 97 | if cls.is_int(value.type) or value.type == cls.bool: #从整数或者布尔值 98 | if cls.is_int(target_type): #转成整数 99 | if value.type.width < target_type.width: # 扩展整数位数 100 | return builder.sext(value, target_type) 101 | else: # 减少整数位数 102 | return builder.trunc(value, target_type) 103 | elif cls.is_float(target_type): #转成浮点数 104 | return builder.sitofp(value, target_type) 105 | elif target_type == cls.bool: 106 | return builder.icmp_unsigned('!=', value, cls.bool(0)) 107 | elif type(target_type) == ir.PointerType: #转成指针 108 | return builder.inttoptr(value, target_type) 109 | 110 | elif cls.is_float(value.type): #从浮点数 111 | if cls.is_float(target_type): #转成浮点数 112 | if value.type == cls.float: # 增加浮点数精度 113 | return builder.fpext(value, cls.double) 114 | else: # 降低浮点数精度 115 | return builder.fptrunc(value, cls.float) 116 | elif cls.is_int(target_type): #转成整数 117 | return builder.fptosi(value, target_type) 118 | elif type(value.type) == ir.PointerType and type(target_type) == ir.IntType: 119 | # 指针转int 120 | return builder.ptrtoint(value, target_type) 121 | elif type(value.type) == ir.ArrayType and type(target_type) == ir.PointerType \ 122 | and value.type.element == target_type.pointee: #数组类型转成指针类型 123 | zero = ir.Constant(cls.int, 0) 124 | tmp = builder.alloca(value.type) 125 | builder.store(value, tmp) 126 | return builder.gep(tmp, [zero, zero]) 127 | elif isinstance(value.type, ir.ArrayType) and isinstance(target_type, ir.ArrayType) \ 128 | and value.type.element == target_type.element: 129 | return builder.bitcast(value, target_type) 130 | elif isinstance(value.type, ir.PointerType) and isinstance(target_type, ir.PointerType): # 指针之间的类型转换 131 | return builder.bitcast(value, target_type) 132 | raise SemanticError(ctx=ctx, msg="No known conversion from '%s' to '%s'" % (value.type, target_type)) -------------------------------------------------------------------------------- /generator/util.py: -------------------------------------------------------------------------------- 1 | import codecs 2 | 3 | 4 | def parse_escape(s): 5 | return codecs.escape_decode(bytes(s, "ascii"))[0].decode("ascii") 6 | 7 | 8 | def match_rule(ctx, rule): 9 | """判断ctx.getRuleIndex()==rule是否成立.若ctx无getRuleIndex()则返回False.""" 10 | if hasattr(ctx, 'getRuleIndex'): 11 | return ctx.getRuleIndex() == rule 12 | else: 13 | return False 14 | 15 | 16 | def match_texts(ctx, texts): 17 | """判断ctx.getText() in texts是否成立.若ctx无getText()则返回False. texts是一个字符串列表""" 18 | if hasattr(ctx, 'getText'): 19 | return ctx.getText() in texts 20 | else: 21 | return False 22 | 23 | 24 | def match_text(ctx, text): 25 | """判断ctx.getText() == text是否成立.若ctx无getText()则返回False""" 26 | return match_texts(ctx, [text]) -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | from generator.generator import generate 2 | import sys 3 | 4 | if __name__ == '__main__': 5 | if len(sys.argv) >= 2: 6 | input_filename = sys.argv[1] 7 | output_filename = input_filename.strip(".")+".ll" 8 | generate(input_filename, output_filename) 9 | else: 10 | print("Usage: python main.py (input_filename)") 11 | -------------------------------------------------------------------------------- /parser_/C.g4: -------------------------------------------------------------------------------- 1 | /* 2 | [The "BSD licence"] 3 | Copyright (c) 2013 Sam Harwell 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 1. Redistributions of source code must retain the above copyright 10 | notice, this list of conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in the 13 | documentation and/or other materials provided with the distribution. 14 | 3. The name of the author may not be used to endorse or promote products 15 | derived from this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | /** C 2011 grammar built from the C11 Spec */ 30 | grammar C; 31 | 32 | primaryExpression 33 | : Identifier 34 | | Constant 35 | | StringLiteral+ 36 | | '(' expression ')' 37 | | genericSelection 38 | | '__extension__'? '(' compoundStatement ')' // Blocks (GCC extension) 39 | | '__builtin_va_arg' '(' unaryExpression ',' typeName ')' 40 | | '__builtin_offsetof' '(' typeName ',' unaryExpression ')' 41 | ; 42 | 43 | genericSelection 44 | : '_Generic' '(' assignmentExpression ',' genericAssocList ')' 45 | ; 46 | 47 | genericAssocList 48 | : genericAssociation 49 | | genericAssocList ',' genericAssociation 50 | ; 51 | 52 | genericAssociation 53 | : typeName ':' assignmentExpression 54 | | 'default' ':' assignmentExpression 55 | ; 56 | 57 | postfixExpression 58 | : primaryExpression 59 | | postfixExpression '[' expression ']' 60 | | postfixExpression '(' argumentExpressionList? ')' 61 | | postfixExpression '.' Identifier 62 | | postfixExpression '->' Identifier 63 | | postfixExpression '++' 64 | | postfixExpression '--' 65 | | '(' typeName ')' '{' initializerList '}' 66 | | '(' typeName ')' '{' initializerList ',' '}' 67 | | '__extension__' '(' typeName ')' '{' initializerList '}' 68 | | '__extension__' '(' typeName ')' '{' initializerList ',' '}' 69 | ; 70 | 71 | argumentExpressionList 72 | : assignmentExpression 73 | | argumentExpressionList ',' assignmentExpression 74 | ; 75 | 76 | unaryExpression 77 | : postfixExpression 78 | | '++' unaryExpression 79 | | '--' unaryExpression 80 | | unaryOperator castExpression 81 | | 'sizeof' unaryExpression 82 | | 'sizeof' '(' typeName ')' 83 | | '_Alignof' '(' typeName ')' 84 | | '&&' Identifier // GCC extension address of label 85 | ; 86 | 87 | unaryOperator 88 | : '&' | '*' | '+' | '-' | '~' | '!' 89 | ; 90 | 91 | castExpression 92 | : '(' typeName ')' castExpression 93 | | '__extension__' '(' typeName ')' castExpression 94 | | unaryExpression 95 | | DigitSequence // for 96 | ; 97 | 98 | multiplicativeExpression 99 | : castExpression 100 | | multiplicativeExpression '*' castExpression 101 | | multiplicativeExpression '/' castExpression 102 | | multiplicativeExpression '%' castExpression 103 | ; 104 | 105 | additiveExpression 106 | : multiplicativeExpression 107 | | additiveExpression '+' multiplicativeExpression 108 | | additiveExpression '-' multiplicativeExpression 109 | ; 110 | 111 | shiftExpression 112 | : additiveExpression 113 | | shiftExpression '<<' additiveExpression 114 | | shiftExpression '>>' additiveExpression 115 | ; 116 | 117 | relationalExpression 118 | : shiftExpression 119 | | relationalExpression '<' shiftExpression 120 | | relationalExpression '>' shiftExpression 121 | | relationalExpression '<=' shiftExpression 122 | | relationalExpression '>=' shiftExpression 123 | ; 124 | 125 | equalityExpression 126 | : relationalExpression 127 | | equalityExpression '==' relationalExpression 128 | | equalityExpression '!=' relationalExpression 129 | ; 130 | 131 | andExpression 132 | : equalityExpression 133 | | andExpression '&' equalityExpression 134 | ; 135 | 136 | exclusiveOrExpression 137 | : andExpression 138 | | exclusiveOrExpression '^' andExpression 139 | ; 140 | 141 | inclusiveOrExpression 142 | : exclusiveOrExpression 143 | | inclusiveOrExpression '|' exclusiveOrExpression 144 | ; 145 | 146 | logicalAndExpression 147 | : inclusiveOrExpression 148 | | logicalAndExpression '&&' inclusiveOrExpression 149 | ; 150 | 151 | logicalOrExpression 152 | : logicalAndExpression 153 | | logicalOrExpression '||' logicalAndExpression 154 | ; 155 | 156 | conditionalExpression 157 | : logicalOrExpression ('?' expression ':' conditionalExpression)? 158 | ; 159 | 160 | assignmentExpression 161 | : conditionalExpression 162 | | unaryExpression assignmentOperator assignmentExpression 163 | | DigitSequence // for 164 | ; 165 | 166 | assignmentOperator 167 | : '=' | '*=' | '/=' | '%=' | '+=' | '-=' | '<<=' | '>>=' | '&=' | '^=' | '|=' 168 | ; 169 | 170 | expression 171 | : assignmentExpression 172 | | expression ',' assignmentExpression 173 | ; 174 | 175 | constantExpression 176 | : conditionalExpression 177 | ; 178 | 179 | declaration 180 | : declarationSpecifiers initDeclaratorList ';' 181 | | declarationSpecifiers ';' 182 | | staticAssertDeclaration 183 | ; 184 | 185 | declarationSpecifiers 186 | : declarationSpecifier+ 187 | ; 188 | 189 | declarationSpecifiers2 190 | : declarationSpecifier+ 191 | ; 192 | 193 | declarationSpecifier 194 | : storageClassSpecifier 195 | | typeSpecifier 196 | | typeQualifier 197 | | functionSpecifier 198 | | alignmentSpecifier 199 | ; 200 | 201 | initDeclaratorList 202 | : initDeclarator 203 | | initDeclaratorList ',' initDeclarator 204 | ; 205 | 206 | initDeclarator 207 | : declarator 208 | | declarator '=' initializer 209 | ; 210 | 211 | storageClassSpecifier 212 | : 'typedef' 213 | | 'extern' 214 | | 'static' 215 | | '_Thread_local' 216 | | 'auto' 217 | | 'register' 218 | ; 219 | 220 | typeSpecifier 221 | : ('void' 222 | | 'char' 223 | | 'short' 224 | | 'int' 225 | | 'long' 226 | | 'float' 227 | | 'double' 228 | | 'signed' 229 | | 'unsigned' 230 | | '_Bool' 231 | | '_Complex' 232 | | '__m128' 233 | | '__m128d' 234 | | '__m128i') 235 | | '__extension__' '(' ('__m128' | '__m128d' | '__m128i') ')' 236 | | atomicTypeSpecifier 237 | | structOrUnionSpecifier 238 | | enumSpecifier 239 | | typedefName 240 | | '__typeof__' '(' constantExpression ')' // GCC extension 241 | | typeSpecifier pointer 242 | ; 243 | 244 | structOrUnionSpecifier 245 | : structOrUnion Identifier? '{' structDeclarationList '}' 246 | | structOrUnion Identifier 247 | ; 248 | 249 | structOrUnion 250 | : 'struct' 251 | | 'union' 252 | ; 253 | 254 | structDeclarationList 255 | : structDeclaration 256 | | structDeclarationList structDeclaration 257 | ; 258 | 259 | structDeclaration 260 | : specifierQualifierList structDeclaratorList? ';' 261 | | staticAssertDeclaration 262 | ; 263 | 264 | specifierQualifierList 265 | : typeSpecifier specifierQualifierList? 266 | | typeQualifier specifierQualifierList? 267 | ; 268 | 269 | structDeclaratorList 270 | : structDeclarator 271 | | structDeclaratorList ',' structDeclarator 272 | ; 273 | 274 | structDeclarator 275 | : declarator 276 | | declarator? ':' constantExpression 277 | ; 278 | 279 | enumSpecifier 280 | : 'enum' Identifier? '{' enumeratorList '}' 281 | | 'enum' Identifier? '{' enumeratorList ',' '}' 282 | | 'enum' Identifier 283 | ; 284 | 285 | enumeratorList 286 | : enumerator 287 | | enumeratorList ',' enumerator 288 | ; 289 | 290 | enumerator 291 | : enumerationConstant 292 | | enumerationConstant '=' constantExpression 293 | ; 294 | 295 | enumerationConstant 296 | : Identifier 297 | ; 298 | 299 | atomicTypeSpecifier 300 | : '_Atomic' '(' typeName ')' 301 | ; 302 | 303 | typeQualifier 304 | : 'const' 305 | | 'restrict' 306 | | 'volatile' 307 | | '_Atomic' 308 | ; 309 | 310 | functionSpecifier 311 | : ('inline' 312 | | '_Noreturn' 313 | | '__inline__' // GCC extension 314 | | '__stdcall') 315 | | gccAttributeSpecifier 316 | | '__declspec' '(' Identifier ')' 317 | ; 318 | 319 | alignmentSpecifier 320 | : '_Alignas' '(' typeName ')' 321 | | '_Alignas' '(' constantExpression ')' 322 | ; 323 | 324 | declarator 325 | : pointer? directDeclarator gccDeclaratorExtension* 326 | ; 327 | 328 | directDeclarator 329 | : Identifier 330 | | '(' declarator ')' 331 | | directDeclarator '[' typeQualifierList? assignmentExpression? ']' 332 | | directDeclarator '[' 'static' typeQualifierList? assignmentExpression ']' 333 | | directDeclarator '[' typeQualifierList 'static' assignmentExpression ']' 334 | | directDeclarator '[' typeQualifierList? '*' ']' 335 | | directDeclarator '(' parameterTypeList ')' 336 | | directDeclarator '(' identifierList? ')' 337 | | Identifier ':' DigitSequence // bit field 338 | // | '(' typeSpecifier? pointer directDeclarator ')' // function pointer like: (__cdecl *f) 339 | ; 340 | 341 | gccDeclaratorExtension 342 | : '__asm' '(' StringLiteral+ ')' 343 | | gccAttributeSpecifier 344 | ; 345 | 346 | gccAttributeSpecifier 347 | : '__attribute__' '(' '(' gccAttributeList ')' ')' 348 | ; 349 | 350 | gccAttributeList 351 | : gccAttribute (',' gccAttribute)* 352 | | // empty 353 | ; 354 | 355 | gccAttribute 356 | : ~(',' | '(' | ')') // relaxed def for "identifier or reserved word" 357 | ('(' argumentExpressionList? ')')? 358 | | // empty 359 | ; 360 | 361 | nestedParenthesesBlock 362 | : ( ~('(' | ')') 363 | | '(' nestedParenthesesBlock ')' 364 | )* 365 | ; 366 | 367 | pointer 368 | : '*' typeQualifierList? 369 | | '*' typeQualifierList? pointer 370 | | '^' typeQualifierList? // Blocks language extension 371 | | '^' typeQualifierList? pointer // Blocks language extension 372 | ; 373 | 374 | typeQualifierList 375 | : typeQualifier 376 | | typeQualifierList typeQualifier 377 | ; 378 | 379 | parameterTypeList 380 | : parameterList 381 | | parameterList ',' '...' 382 | ; 383 | 384 | parameterList 385 | : parameterDeclaration 386 | | parameterList ',' parameterDeclaration 387 | ; 388 | 389 | parameterDeclaration 390 | : declarationSpecifiers declarator 391 | | declarationSpecifiers2 abstractDeclarator? 392 | ; 393 | 394 | identifierList 395 | : Identifier 396 | | identifierList ',' Identifier 397 | ; 398 | 399 | typeName 400 | : specifierQualifierList abstractDeclarator? 401 | ; 402 | 403 | abstractDeclarator 404 | : pointer 405 | | pointer? directAbstractDeclarator gccDeclaratorExtension* 406 | ; 407 | 408 | directAbstractDeclarator 409 | : '(' abstractDeclarator ')' gccDeclaratorExtension* 410 | | '[' typeQualifierList? assignmentExpression? ']' 411 | | '[' 'static' typeQualifierList? assignmentExpression ']' 412 | | '[' typeQualifierList 'static' assignmentExpression ']' 413 | | '[' '*' ']' 414 | | '(' parameterTypeList? ')' gccDeclaratorExtension* 415 | | directAbstractDeclarator '[' typeQualifierList? assignmentExpression? ']' 416 | | directAbstractDeclarator '[' 'static' typeQualifierList? assignmentExpression ']' 417 | | directAbstractDeclarator '[' typeQualifierList 'static' assignmentExpression ']' 418 | | directAbstractDeclarator '[' '*' ']' 419 | | directAbstractDeclarator '(' parameterTypeList? ')' gccDeclaratorExtension* 420 | ; 421 | 422 | typedefName 423 | : Identifier 424 | ; 425 | 426 | initializer 427 | : assignmentExpression 428 | | '{' initializerList '}' 429 | | '{' initializerList ',' '}' 430 | ; 431 | 432 | initializerList 433 | : designation? initializer 434 | | initializerList ',' designation? initializer 435 | ; 436 | 437 | designation 438 | : designatorList '=' 439 | ; 440 | 441 | designatorList 442 | : designator 443 | | designatorList designator 444 | ; 445 | 446 | designator 447 | : '[' constantExpression ']' 448 | | '.' Identifier 449 | ; 450 | 451 | staticAssertDeclaration 452 | : '_Static_assert' '(' constantExpression ',' StringLiteral+ ')' ';' 453 | ; 454 | 455 | statement 456 | : labeledStatement 457 | | compoundStatement 458 | | expressionStatement 459 | | selectionStatement 460 | | iterationStatement 461 | | jumpStatement 462 | | ('__asm' | '__asm__') ('volatile' | '__volatile__') '(' (logicalOrExpression (',' logicalOrExpression)*)? (':' (logicalOrExpression (',' logicalOrExpression)*)?)* ')' ';' 463 | ; 464 | 465 | labeledStatement 466 | : Identifier ':' statement 467 | | 'case' constantExpression ':' statement 468 | | 'default' ':' statement 469 | ; 470 | 471 | compoundStatement 472 | : '{' blockItemList? '}' 473 | ; 474 | 475 | blockItemList 476 | : blockItem 477 | | blockItemList blockItem 478 | ; 479 | 480 | blockItem 481 | : statement 482 | | declaration 483 | ; 484 | 485 | expressionStatement 486 | : expression? ';' 487 | ; 488 | 489 | selectionStatement 490 | : 'if' '(' expression ')' statement ('else' statement)? 491 | | 'switch' '(' expression ')' statement 492 | ; 493 | 494 | iterationStatement 495 | : While '(' expression ')' statement 496 | | Do statement While '(' expression ')' ';' 497 | | For '(' forCondition ')' statement 498 | ; 499 | 500 | // | 'for' '(' expression? ';' expression? ';' forUpdate? ')' statement 501 | // | For '(' declaration expression? ';' expression? ')' statement 502 | 503 | forCondition 504 | : forDeclaration ';' forExpression? ';' forExpression? 505 | | expression? ';' forExpression? ';' forExpression? 506 | ; 507 | 508 | forDeclaration 509 | : declarationSpecifiers initDeclaratorList 510 | | declarationSpecifiers 511 | ; 512 | 513 | forExpression 514 | : assignmentExpression 515 | | forExpression ',' assignmentExpression 516 | ; 517 | 518 | jumpStatement 519 | : 'goto' Identifier ';' 520 | | 'continue' ';' 521 | | 'break' ';' 522 | | 'return' expression? ';' 523 | | 'goto' unaryExpression ';' // GCC extension 524 | ; 525 | 526 | compilationUnit 527 | : translationUnit? EOF 528 | ; 529 | 530 | translationUnit 531 | : externalDeclaration 532 | | translationUnit externalDeclaration 533 | ; 534 | 535 | externalDeclaration 536 | : functionDefinition 537 | | declaration 538 | | ';' // stray ; 539 | ; 540 | 541 | functionDefinition 542 | : declarationSpecifiers? declarator declarationList? compoundStatement 543 | ; 544 | 545 | declarationList 546 | : declaration 547 | | declarationList declaration 548 | ; 549 | 550 | Auto : 'auto'; 551 | Break : 'break'; 552 | Case : 'case'; 553 | Char : 'char'; 554 | Const : 'const'; 555 | Continue : 'continue'; 556 | Default : 'default'; 557 | Do : 'do'; 558 | Double : 'double'; 559 | Else : 'else'; 560 | Enum : 'enum'; 561 | Extern : 'extern'; 562 | Float : 'float'; 563 | For : 'for'; 564 | Goto : 'goto'; 565 | If : 'if'; 566 | Inline : 'inline'; 567 | Int : 'int'; 568 | Long : 'long'; 569 | Register : 'register'; 570 | Restrict : 'restrict'; 571 | Return : 'return'; 572 | Short : 'short'; 573 | Signed : 'signed'; 574 | Sizeof : 'sizeof'; 575 | Static : 'static'; 576 | Struct : 'struct'; 577 | Switch : 'switch'; 578 | Typedef : 'typedef'; 579 | Union : 'union'; 580 | Unsigned : 'unsigned'; 581 | Void : 'void'; 582 | Volatile : 'volatile'; 583 | While : 'while'; 584 | 585 | Alignas : '_Alignas'; 586 | Alignof : '_Alignof'; 587 | Atomic : '_Atomic'; 588 | Bool : '_Bool'; 589 | Complex : '_Complex'; 590 | Generic : '_Generic'; 591 | Imaginary : '_Imaginary'; 592 | Noreturn : '_Noreturn'; 593 | StaticAssert : '_Static_assert'; 594 | ThreadLocal : '_Thread_local'; 595 | 596 | LeftParen : '('; 597 | RightParen : ')'; 598 | LeftBracket : '['; 599 | RightBracket : ']'; 600 | LeftBrace : '{'; 601 | RightBrace : '}'; 602 | 603 | Less : '<'; 604 | LessEqual : '<='; 605 | Greater : '>'; 606 | GreaterEqual : '>='; 607 | LeftShift : '<<'; 608 | RightShift : '>>'; 609 | 610 | Plus : '+'; 611 | PlusPlus : '++'; 612 | Minus : '-'; 613 | MinusMinus : '--'; 614 | Star : '*'; 615 | Div : '/'; 616 | Mod : '%'; 617 | 618 | And : '&'; 619 | Or : '|'; 620 | AndAnd : '&&'; 621 | OrOr : '||'; 622 | Caret : '^'; 623 | Not : '!'; 624 | Tilde : '~'; 625 | 626 | Question : '?'; 627 | Colon : ':'; 628 | Semi : ';'; 629 | Comma : ','; 630 | 631 | Assign : '='; 632 | // '*=' | '/=' | '%=' | '+=' | '-=' | '<<=' | '>>=' | '&=' | '^=' | '|=' 633 | StarAssign : '*='; 634 | DivAssign : '/='; 635 | ModAssign : '%='; 636 | PlusAssign : '+='; 637 | MinusAssign : '-='; 638 | LeftShiftAssign : '<<='; 639 | RightShiftAssign : '>>='; 640 | AndAssign : '&='; 641 | XorAssign : '^='; 642 | OrAssign : '|='; 643 | 644 | Equal : '=='; 645 | NotEqual : '!='; 646 | 647 | Arrow : '->'; 648 | Dot : '.'; 649 | Ellipsis : '...'; 650 | 651 | Identifier 652 | : IdentifierNondigit 653 | ( IdentifierNondigit 654 | | Digit 655 | )* 656 | ; 657 | 658 | fragment 659 | IdentifierNondigit 660 | : Nondigit 661 | | UniversalCharacterName 662 | //| // other implementation-defined characters... 663 | ; 664 | 665 | fragment 666 | Nondigit 667 | : [a-zA-Z_] 668 | ; 669 | 670 | fragment 671 | Digit 672 | : [0-9] 673 | ; 674 | 675 | fragment 676 | UniversalCharacterName 677 | : '\\u' HexQuad 678 | | '\\U' HexQuad HexQuad 679 | ; 680 | 681 | fragment 682 | HexQuad 683 | : HexadecimalDigit HexadecimalDigit HexadecimalDigit HexadecimalDigit 684 | ; 685 | 686 | Constant 687 | : IntegerConstant 688 | | FloatingConstant 689 | //| EnumerationConstant 690 | | CharacterConstant 691 | ; 692 | 693 | fragment 694 | IntegerConstant 695 | : DecimalConstant IntegerSuffix? 696 | | OctalConstant IntegerSuffix? 697 | | HexadecimalConstant IntegerSuffix? 698 | | BinaryConstant 699 | ; 700 | 701 | fragment 702 | BinaryConstant 703 | : '0' [bB] [0-1]+ 704 | ; 705 | 706 | fragment 707 | DecimalConstant 708 | : NonzeroDigit Digit* 709 | ; 710 | 711 | fragment 712 | OctalConstant 713 | : '0' OctalDigit* 714 | ; 715 | 716 | fragment 717 | HexadecimalConstant 718 | : HexadecimalPrefix HexadecimalDigit+ 719 | ; 720 | 721 | fragment 722 | HexadecimalPrefix 723 | : '0' [xX] 724 | ; 725 | 726 | fragment 727 | NonzeroDigit 728 | : [1-9] 729 | ; 730 | 731 | fragment 732 | OctalDigit 733 | : [0-7] 734 | ; 735 | 736 | fragment 737 | HexadecimalDigit 738 | : [0-9a-fA-F] 739 | ; 740 | 741 | fragment 742 | IntegerSuffix 743 | : UnsignedSuffix LongSuffix? 744 | | UnsignedSuffix LongLongSuffix 745 | | LongSuffix UnsignedSuffix? 746 | | LongLongSuffix UnsignedSuffix? 747 | ; 748 | 749 | fragment 750 | UnsignedSuffix 751 | : [uU] 752 | ; 753 | 754 | fragment 755 | LongSuffix 756 | : [lL] 757 | ; 758 | 759 | fragment 760 | LongLongSuffix 761 | : 'll' | 'LL' 762 | ; 763 | 764 | fragment 765 | FloatingConstant 766 | : DecimalFloatingConstant 767 | | HexadecimalFloatingConstant 768 | ; 769 | 770 | fragment 771 | DecimalFloatingConstant 772 | : FractionalConstant ExponentPart? FloatingSuffix? 773 | | DigitSequence ExponentPart FloatingSuffix? 774 | ; 775 | 776 | fragment 777 | HexadecimalFloatingConstant 778 | : HexadecimalPrefix HexadecimalFractionalConstant BinaryExponentPart FloatingSuffix? 779 | | HexadecimalPrefix HexadecimalDigitSequence BinaryExponentPart FloatingSuffix? 780 | ; 781 | 782 | fragment 783 | FractionalConstant 784 | : DigitSequence? '.' DigitSequence 785 | | DigitSequence '.' 786 | ; 787 | 788 | fragment 789 | ExponentPart 790 | : 'e' Sign? DigitSequence 791 | | 'E' Sign? DigitSequence 792 | ; 793 | 794 | fragment 795 | Sign 796 | : '+' | '-' 797 | ; 798 | 799 | DigitSequence 800 | : Digit+ 801 | ; 802 | 803 | fragment 804 | HexadecimalFractionalConstant 805 | : HexadecimalDigitSequence? '.' HexadecimalDigitSequence 806 | | HexadecimalDigitSequence '.' 807 | ; 808 | 809 | fragment 810 | BinaryExponentPart 811 | : 'p' Sign? DigitSequence 812 | | 'P' Sign? DigitSequence 813 | ; 814 | 815 | fragment 816 | HexadecimalDigitSequence 817 | : HexadecimalDigit+ 818 | ; 819 | 820 | fragment 821 | FloatingSuffix 822 | : 'f' | 'l' | 'F' | 'L' 823 | ; 824 | 825 | fragment 826 | CharacterConstant 827 | : '\'' CCharSequence '\'' 828 | | 'L\'' CCharSequence '\'' 829 | | 'u\'' CCharSequence '\'' 830 | | 'U\'' CCharSequence '\'' 831 | ; 832 | 833 | fragment 834 | CCharSequence 835 | : CChar+ 836 | ; 837 | 838 | fragment 839 | CChar 840 | : ~['\\\r\n] 841 | | EscapeSequence 842 | ; 843 | 844 | fragment 845 | EscapeSequence 846 | : SimpleEscapeSequence 847 | | OctalEscapeSequence 848 | | HexadecimalEscapeSequence 849 | | UniversalCharacterName 850 | ; 851 | 852 | fragment 853 | SimpleEscapeSequence 854 | : '\\' ['"?abfnrtv\\] 855 | ; 856 | 857 | fragment 858 | OctalEscapeSequence 859 | : '\\' OctalDigit 860 | | '\\' OctalDigit OctalDigit 861 | | '\\' OctalDigit OctalDigit OctalDigit 862 | ; 863 | 864 | fragment 865 | HexadecimalEscapeSequence 866 | : '\\x' HexadecimalDigit+ 867 | ; 868 | 869 | StringLiteral 870 | : EncodingPrefix? '"' SCharSequence? '"' 871 | ; 872 | 873 | fragment 874 | EncodingPrefix 875 | : 'u8' 876 | | 'u' 877 | | 'U' 878 | | 'L' 879 | ; 880 | 881 | fragment 882 | SCharSequence 883 | : SChar+ 884 | ; 885 | 886 | fragment 887 | SChar 888 | : ~["\\\r\n] 889 | | EscapeSequence 890 | | '\\\n' // Added line 891 | | '\\\r\n' // Added line 892 | ; 893 | 894 | ComplexDefine 895 | : '#' Whitespace? 'define' ~[#]* 896 | -> skip 897 | ; 898 | 899 | Include 900 | : '#include' Whitespace* ~[\r\n]* 901 | -> skip 902 | ; 903 | 904 | // ignore the following asm blocks: 905 | /* 906 | asm 907 | { 908 | mfspr x, 286; 909 | } 910 | */ 911 | AsmBlock 912 | : 'asm' ~'{'* '{' ~'}'* '}' 913 | -> skip 914 | ; 915 | 916 | // ignore the lines generated by c preprocessor 917 | // sample line : '#line 1 "/home/dm/files/dk1.h" 1' 918 | LineAfterPreprocessing 919 | : '#line' Whitespace* ~[\r\n]* 920 | -> skip 921 | ; 922 | 923 | LineDirective 924 | : '#' Whitespace? DecimalConstant Whitespace? StringLiteral ~[\r\n]* 925 | -> skip 926 | ; 927 | 928 | PragmaDirective 929 | : '#' Whitespace? 'pragma' Whitespace ~[\r\n]* 930 | -> skip 931 | ; 932 | 933 | Whitespace 934 | : [ \t]+ 935 | -> skip 936 | ; 937 | 938 | Newline 939 | : ( '\r' '\n'? 940 | | '\n' 941 | ) 942 | -> skip 943 | ; 944 | 945 | BlockComment 946 | : '/*' .*? '*/' 947 | -> skip 948 | ; 949 | 950 | LineComment 951 | : '//' ~[\r\n]* 952 | -> skip 953 | ; 954 | -------------------------------------------------------------------------------- /parser_/C.tokens: -------------------------------------------------------------------------------- 1 | T__0=1 2 | T__1=2 3 | T__2=3 4 | T__3=4 5 | T__4=5 6 | T__5=6 7 | T__6=7 8 | T__7=8 9 | T__8=9 10 | T__9=10 11 | T__10=11 12 | T__11=12 13 | T__12=13 14 | T__13=14 15 | Auto=15 16 | Break=16 17 | Case=17 18 | Char=18 19 | Const=19 20 | Continue=20 21 | Default=21 22 | Do=22 23 | Double=23 24 | Else=24 25 | Enum=25 26 | Extern=26 27 | Float=27 28 | For=28 29 | Goto=29 30 | If=30 31 | Inline=31 32 | Int=32 33 | Long=33 34 | Register=34 35 | Restrict=35 36 | Return=36 37 | Short=37 38 | Signed=38 39 | Sizeof=39 40 | Static=40 41 | Struct=41 42 | Switch=42 43 | Typedef=43 44 | Union=44 45 | Unsigned=45 46 | Void=46 47 | Volatile=47 48 | While=48 49 | Alignas=49 50 | Alignof=50 51 | Atomic=51 52 | Bool=52 53 | Complex=53 54 | Generic=54 55 | Imaginary=55 56 | Noreturn=56 57 | StaticAssert=57 58 | ThreadLocal=58 59 | LeftParen=59 60 | RightParen=60 61 | LeftBracket=61 62 | RightBracket=62 63 | LeftBrace=63 64 | RightBrace=64 65 | Less=65 66 | LessEqual=66 67 | Greater=67 68 | GreaterEqual=68 69 | LeftShift=69 70 | RightShift=70 71 | Plus=71 72 | PlusPlus=72 73 | Minus=73 74 | MinusMinus=74 75 | Star=75 76 | Div=76 77 | Mod=77 78 | And=78 79 | Or=79 80 | AndAnd=80 81 | OrOr=81 82 | Caret=82 83 | Not=83 84 | Tilde=84 85 | Question=85 86 | Colon=86 87 | Semi=87 88 | Comma=88 89 | Assign=89 90 | StarAssign=90 91 | DivAssign=91 92 | ModAssign=92 93 | PlusAssign=93 94 | MinusAssign=94 95 | LeftShiftAssign=95 96 | RightShiftAssign=96 97 | AndAssign=97 98 | XorAssign=98 99 | OrAssign=99 100 | Equal=100 101 | NotEqual=101 102 | Arrow=102 103 | Dot=103 104 | Ellipsis=104 105 | Identifier=105 106 | Constant=106 107 | DigitSequence=107 108 | StringLiteral=108 109 | ComplexDefine=109 110 | Include=110 111 | AsmBlock=111 112 | LineAfterPreprocessing=112 113 | LineDirective=113 114 | PragmaDirective=114 115 | Whitespace=115 116 | Newline=116 117 | BlockComment=117 118 | LineComment=118 119 | '__extension__'=1 120 | '__builtin_va_arg'=2 121 | '__builtin_offsetof'=3 122 | '__m128'=4 123 | '__m128d'=5 124 | '__m128i'=6 125 | '__typeof__'=7 126 | '__inline__'=8 127 | '__stdcall'=9 128 | '__declspec'=10 129 | '__asm'=11 130 | '__attribute__'=12 131 | '__asm__'=13 132 | '__volatile__'=14 133 | 'auto'=15 134 | 'break'=16 135 | 'case'=17 136 | 'char'=18 137 | 'const'=19 138 | 'continue'=20 139 | 'default'=21 140 | 'do'=22 141 | 'double'=23 142 | 'else'=24 143 | 'enum'=25 144 | 'extern'=26 145 | 'float'=27 146 | 'for'=28 147 | 'goto'=29 148 | 'if'=30 149 | 'inline'=31 150 | 'int'=32 151 | 'long'=33 152 | 'register'=34 153 | 'restrict'=35 154 | 'return'=36 155 | 'short'=37 156 | 'signed'=38 157 | 'sizeof'=39 158 | 'static'=40 159 | 'struct'=41 160 | 'switch'=42 161 | 'typedef'=43 162 | 'union'=44 163 | 'unsigned'=45 164 | 'void'=46 165 | 'volatile'=47 166 | 'while'=48 167 | '_Alignas'=49 168 | '_Alignof'=50 169 | '_Atomic'=51 170 | '_Bool'=52 171 | '_Complex'=53 172 | '_Generic'=54 173 | '_Imaginary'=55 174 | '_Noreturn'=56 175 | '_Static_assert'=57 176 | '_Thread_local'=58 177 | '('=59 178 | ')'=60 179 | '['=61 180 | ']'=62 181 | '{'=63 182 | '}'=64 183 | '<'=65 184 | '<='=66 185 | '>'=67 186 | '>='=68 187 | '<<'=69 188 | '>>'=70 189 | '+'=71 190 | '++'=72 191 | '-'=73 192 | '--'=74 193 | '*'=75 194 | '/'=76 195 | '%'=77 196 | '&'=78 197 | '|'=79 198 | '&&'=80 199 | '||'=81 200 | '^'=82 201 | '!'=83 202 | '~'=84 203 | '?'=85 204 | ':'=86 205 | ';'=87 206 | ','=88 207 | '='=89 208 | '*='=90 209 | '/='=91 210 | '%='=92 211 | '+='=93 212 | '-='=94 213 | '<<='=95 214 | '>>='=96 215 | '&='=97 216 | '^='=98 217 | '|='=99 218 | '=='=100 219 | '!='=101 220 | '->'=102 221 | '.'=103 222 | '...'=104 223 | -------------------------------------------------------------------------------- /parser_/CLexer.py: -------------------------------------------------------------------------------- 1 | # Generated from D:/TinyCCompiler/parser_\C.g4 by ANTLR 4.7.2 2 | from antlr4 import * 3 | from io import StringIO 4 | from typing.io import TextIO 5 | import sys 6 | 7 | 8 | 9 | def serializedATN(): 10 | with StringIO() as buf: 11 | buf.write("\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2x") 12 | buf.write("\u0551\b\1\4\2\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7") 13 | buf.write("\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13\t\13\4\f\t\f\4\r\t\r") 14 | buf.write("\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22\4\23") 15 | buf.write("\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30") 16 | buf.write("\4\31\t\31\4\32\t\32\4\33\t\33\4\34\t\34\4\35\t\35\4\36") 17 | buf.write("\t\36\4\37\t\37\4 \t \4!\t!\4\"\t\"\4#\t#\4$\t$\4%\t%") 18 | buf.write("\4&\t&\4\'\t\'\4(\t(\4)\t)\4*\t*\4+\t+\4,\t,\4-\t-\4.") 19 | buf.write("\t.\4/\t/\4\60\t\60\4\61\t\61\4\62\t\62\4\63\t\63\4\64") 20 | buf.write("\t\64\4\65\t\65\4\66\t\66\4\67\t\67\48\t8\49\t9\4:\t:") 21 | buf.write("\4;\t;\4<\t<\4=\t=\4>\t>\4?\t?\4@\t@\4A\tA\4B\tB\4C\t") 22 | buf.write("C\4D\tD\4E\tE\4F\tF\4G\tG\4H\tH\4I\tI\4J\tJ\4K\tK\4L\t") 23 | buf.write("L\4M\tM\4N\tN\4O\tO\4P\tP\4Q\tQ\4R\tR\4S\tS\4T\tT\4U\t") 24 | buf.write("U\4V\tV\4W\tW\4X\tX\4Y\tY\4Z\tZ\4[\t[\4\\\t\\\4]\t]\4") 25 | buf.write("^\t^\4_\t_\4`\t`\4a\ta\4b\tb\4c\tc\4d\td\4e\te\4f\tf\4") 26 | buf.write("g\tg\4h\th\4i\ti\4j\tj\4k\tk\4l\tl\4m\tm\4n\tn\4o\to\4") 27 | buf.write("p\tp\4q\tq\4r\tr\4s\ts\4t\tt\4u\tu\4v\tv\4w\tw\4x\tx\4") 28 | buf.write("y\ty\4z\tz\4{\t{\4|\t|\4}\t}\4~\t~\4\177\t\177\4\u0080") 29 | buf.write("\t\u0080\4\u0081\t\u0081\4\u0082\t\u0082\4\u0083\t\u0083") 30 | buf.write("\4\u0084\t\u0084\4\u0085\t\u0085\4\u0086\t\u0086\4\u0087") 31 | buf.write("\t\u0087\4\u0088\t\u0088\4\u0089\t\u0089\4\u008a\t\u008a") 32 | buf.write("\4\u008b\t\u008b\4\u008c\t\u008c\4\u008d\t\u008d\4\u008e") 33 | buf.write("\t\u008e\4\u008f\t\u008f\4\u0090\t\u0090\4\u0091\t\u0091") 34 | buf.write("\4\u0092\t\u0092\4\u0093\t\u0093\4\u0094\t\u0094\4\u0095") 35 | buf.write("\t\u0095\4\u0096\t\u0096\4\u0097\t\u0097\4\u0098\t\u0098") 36 | buf.write("\4\u0099\t\u0099\4\u009a\t\u009a\4\u009b\t\u009b\4\u009c") 37 | buf.write("\t\u009c\4\u009d\t\u009d\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3") 38 | buf.write("\2\3\2\3\2\3\2\3\2\3\2\3\2\3\3\3\3\3\3\3\3\3\3\3\3\3\3") 39 | buf.write("\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\4\3\4\3\4\3") 40 | buf.write("\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4") 41 | buf.write("\3\4\3\4\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\6\3\6\3\6\3\6\3") 42 | buf.write("\6\3\6\3\6\3\6\3\7\3\7\3\7\3\7\3\7\3\7\3\7\3\7\3\b\3\b") 43 | buf.write("\3\b\3\b\3\b\3\b\3\b\3\b\3\b\3\b\3\b\3\t\3\t\3\t\3\t\3") 44 | buf.write("\t\3\t\3\t\3\t\3\t\3\t\3\t\3\n\3\n\3\n\3\n\3\n\3\n\3\n") 45 | buf.write("\3\n\3\n\3\n\3\13\3\13\3\13\3\13\3\13\3\13\3\13\3\13\3") 46 | buf.write("\13\3\13\3\13\3\f\3\f\3\f\3\f\3\f\3\f\3\r\3\r\3\r\3\r") 47 | buf.write("\3\r\3\r\3\r\3\r\3\r\3\r\3\r\3\r\3\r\3\r\3\16\3\16\3\16") 48 | buf.write("\3\16\3\16\3\16\3\16\3\16\3\17\3\17\3\17\3\17\3\17\3\17") 49 | buf.write("\3\17\3\17\3\17\3\17\3\17\3\17\3\17\3\20\3\20\3\20\3\20") 50 | buf.write("\3\20\3\21\3\21\3\21\3\21\3\21\3\21\3\22\3\22\3\22\3\22") 51 | buf.write("\3\22\3\23\3\23\3\23\3\23\3\23\3\24\3\24\3\24\3\24\3\24") 52 | buf.write("\3\24\3\25\3\25\3\25\3\25\3\25\3\25\3\25\3\25\3\25\3\26") 53 | buf.write("\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\27\3\27\3\27\3\30") 54 | buf.write("\3\30\3\30\3\30\3\30\3\30\3\30\3\31\3\31\3\31\3\31\3\31") 55 | buf.write("\3\32\3\32\3\32\3\32\3\32\3\33\3\33\3\33\3\33\3\33\3\33") 56 | buf.write("\3\33\3\34\3\34\3\34\3\34\3\34\3\34\3\35\3\35\3\35\3\35") 57 | buf.write("\3\36\3\36\3\36\3\36\3\36\3\37\3\37\3\37\3 \3 \3 \3 \3") 58 | buf.write(" \3 \3 \3!\3!\3!\3!\3\"\3\"\3\"\3\"\3\"\3#\3#\3#\3#\3") 59 | buf.write("#\3#\3#\3#\3#\3$\3$\3$\3$\3$\3$\3$\3$\3$\3%\3%\3%\3%\3") 60 | buf.write("%\3%\3%\3&\3&\3&\3&\3&\3&\3\'\3\'\3\'\3\'\3\'\3\'\3\'") 61 | buf.write("\3(\3(\3(\3(\3(\3(\3(\3)\3)\3)\3)\3)\3)\3)\3*\3*\3*\3") 62 | buf.write("*\3*\3*\3*\3+\3+\3+\3+\3+\3+\3+\3,\3,\3,\3,\3,\3,\3,\3") 63 | buf.write(",\3-\3-\3-\3-\3-\3-\3.\3.\3.\3.\3.\3.\3.\3.\3.\3/\3/\3") 64 | buf.write("/\3/\3/\3\60\3\60\3\60\3\60\3\60\3\60\3\60\3\60\3\60\3") 65 | buf.write("\61\3\61\3\61\3\61\3\61\3\61\3\62\3\62\3\62\3\62\3\62") 66 | buf.write("\3\62\3\62\3\62\3\62\3\63\3\63\3\63\3\63\3\63\3\63\3\63") 67 | buf.write("\3\63\3\63\3\64\3\64\3\64\3\64\3\64\3\64\3\64\3\64\3\65") 68 | buf.write("\3\65\3\65\3\65\3\65\3\65\3\66\3\66\3\66\3\66\3\66\3\66") 69 | buf.write("\3\66\3\66\3\66\3\67\3\67\3\67\3\67\3\67\3\67\3\67\3\67") 70 | buf.write("\3\67\38\38\38\38\38\38\38\38\38\38\38\39\39\39\39\39") 71 | buf.write("\39\39\39\39\39\3:\3:\3:\3:\3:\3:\3:\3:\3:\3:\3:\3:\3") 72 | buf.write(":\3:\3:\3;\3;\3;\3;\3;\3;\3;\3;\3;\3;\3;\3;\3;\3;\3<\3") 73 | buf.write("<\3=\3=\3>\3>\3?\3?\3@\3@\3A\3A\3B\3B\3C\3C\3C\3D\3D\3") 74 | buf.write("E\3E\3E\3F\3F\3F\3G\3G\3G\3H\3H\3I\3I\3I\3J\3J\3K\3K\3") 75 | buf.write("K\3L\3L\3M\3M\3N\3N\3O\3O\3P\3P\3Q\3Q\3Q\3R\3R\3R\3S\3") 76 | buf.write("S\3T\3T\3U\3U\3V\3V\3W\3W\3X\3X\3Y\3Y\3Z\3Z\3[\3[\3[\3") 77 | buf.write("\\\3\\\3\\\3]\3]\3]\3^\3^\3^\3_\3_\3_\3`\3`\3`\3`\3a\3") 78 | buf.write("a\3a\3a\3b\3b\3b\3c\3c\3c\3d\3d\3d\3e\3e\3e\3f\3f\3f\3") 79 | buf.write("g\3g\3g\3h\3h\3i\3i\3i\3i\3j\3j\3j\7j\u038b\nj\fj\16j") 80 | buf.write("\u038e\13j\3k\3k\5k\u0392\nk\3l\3l\3m\3m\3n\3n\3n\3n\3") 81 | buf.write("n\3n\3n\3n\3n\3n\5n\u03a2\nn\3o\3o\3o\3o\3o\3p\3p\3p\5") 82 | buf.write("p\u03ac\np\3q\3q\5q\u03b0\nq\3q\3q\5q\u03b4\nq\3q\3q\5") 83 | buf.write("q\u03b8\nq\3q\5q\u03bb\nq\3r\3r\3r\6r\u03c0\nr\rr\16r") 84 | buf.write("\u03c1\3s\3s\7s\u03c6\ns\fs\16s\u03c9\13s\3t\3t\7t\u03cd") 85 | buf.write("\nt\ft\16t\u03d0\13t\3u\3u\6u\u03d4\nu\ru\16u\u03d5\3") 86 | buf.write("v\3v\3v\3w\3w\3x\3x\3y\3y\3z\3z\5z\u03e3\nz\3z\3z\3z\3") 87 | buf.write("z\3z\5z\u03ea\nz\3z\3z\5z\u03ee\nz\5z\u03f0\nz\3{\3{\3") 88 | buf.write("|\3|\3}\3}\3}\3}\5}\u03fa\n}\3~\3~\5~\u03fe\n~\3\177\3") 89 | buf.write("\177\5\177\u0402\n\177\3\177\5\177\u0405\n\177\3\177\3") 90 | buf.write("\177\3\177\5\177\u040a\n\177\5\177\u040c\n\177\3\u0080") 91 | buf.write("\3\u0080\3\u0080\3\u0080\5\u0080\u0412\n\u0080\3\u0080") 92 | buf.write("\3\u0080\3\u0080\3\u0080\5\u0080\u0418\n\u0080\5\u0080") 93 | buf.write("\u041a\n\u0080\3\u0081\5\u0081\u041d\n\u0081\3\u0081\3") 94 | buf.write("\u0081\3\u0081\3\u0081\3\u0081\5\u0081\u0424\n\u0081\3") 95 | buf.write("\u0082\3\u0082\5\u0082\u0428\n\u0082\3\u0082\3\u0082\3") 96 | buf.write("\u0082\5\u0082\u042d\n\u0082\3\u0082\5\u0082\u0430\n\u0082") 97 | buf.write("\3\u0083\3\u0083\3\u0084\6\u0084\u0435\n\u0084\r\u0084") 98 | buf.write("\16\u0084\u0436\3\u0085\5\u0085\u043a\n\u0085\3\u0085") 99 | buf.write("\3\u0085\3\u0085\3\u0085\3\u0085\5\u0085\u0441\n\u0085") 100 | buf.write("\3\u0086\3\u0086\5\u0086\u0445\n\u0086\3\u0086\3\u0086") 101 | buf.write("\3\u0086\5\u0086\u044a\n\u0086\3\u0086\5\u0086\u044d\n") 102 | buf.write("\u0086\3\u0087\6\u0087\u0450\n\u0087\r\u0087\16\u0087") 103 | buf.write("\u0451\3\u0088\3\u0088\3\u0089\3\u0089\3\u0089\3\u0089") 104 | buf.write("\3\u0089\3\u0089\3\u0089\3\u0089\3\u0089\3\u0089\3\u0089") 105 | buf.write("\3\u0089\3\u0089\3\u0089\3\u0089\3\u0089\3\u0089\3\u0089") 106 | buf.write("\3\u0089\3\u0089\3\u0089\3\u0089\5\u0089\u046c\n\u0089") 107 | buf.write("\3\u008a\6\u008a\u046f\n\u008a\r\u008a\16\u008a\u0470") 108 | buf.write("\3\u008b\3\u008b\5\u008b\u0475\n\u008b\3\u008c\3\u008c") 109 | buf.write("\3\u008c\3\u008c\5\u008c\u047b\n\u008c\3\u008d\3\u008d") 110 | buf.write("\3\u008d\3\u008e\3\u008e\3\u008e\3\u008e\3\u008e\3\u008e") 111 | buf.write("\3\u008e\3\u008e\3\u008e\3\u008e\3\u008e\5\u008e\u048b") 112 | buf.write("\n\u008e\3\u008f\3\u008f\3\u008f\3\u008f\6\u008f\u0491") 113 | buf.write("\n\u008f\r\u008f\16\u008f\u0492\3\u0090\5\u0090\u0496") 114 | buf.write("\n\u0090\3\u0090\3\u0090\5\u0090\u049a\n\u0090\3\u0090") 115 | buf.write("\3\u0090\3\u0091\3\u0091\3\u0091\5\u0091\u04a1\n\u0091") 116 | buf.write("\3\u0092\6\u0092\u04a4\n\u0092\r\u0092\16\u0092\u04a5") 117 | buf.write("\3\u0093\3\u0093\3\u0093\3\u0093\3\u0093\3\u0093\3\u0093") 118 | buf.write("\5\u0093\u04af\n\u0093\3\u0094\3\u0094\5\u0094\u04b3\n") 119 | buf.write("\u0094\3\u0094\3\u0094\3\u0094\3\u0094\3\u0094\3\u0094") 120 | buf.write("\3\u0094\3\u0094\7\u0094\u04bd\n\u0094\f\u0094\16\u0094") 121 | buf.write("\u04c0\13\u0094\3\u0094\3\u0094\3\u0095\3\u0095\3\u0095") 122 | buf.write("\3\u0095\3\u0095\3\u0095\3\u0095\3\u0095\3\u0095\3\u0095") 123 | buf.write("\7\u0095\u04ce\n\u0095\f\u0095\16\u0095\u04d1\13\u0095") 124 | buf.write("\3\u0095\7\u0095\u04d4\n\u0095\f\u0095\16\u0095\u04d7") 125 | buf.write("\13\u0095\3\u0095\3\u0095\3\u0096\3\u0096\3\u0096\3\u0096") 126 | buf.write("\3\u0096\7\u0096\u04e0\n\u0096\f\u0096\16\u0096\u04e3") 127 | buf.write("\13\u0096\3\u0096\3\u0096\7\u0096\u04e7\n\u0096\f\u0096") 128 | buf.write("\16\u0096\u04ea\13\u0096\3\u0096\3\u0096\3\u0096\3\u0096") 129 | buf.write("\3\u0097\3\u0097\3\u0097\3\u0097\3\u0097\3\u0097\3\u0097") 130 | buf.write("\7\u0097\u04f7\n\u0097\f\u0097\16\u0097\u04fa\13\u0097") 131 | buf.write("\3\u0097\7\u0097\u04fd\n\u0097\f\u0097\16\u0097\u0500") 132 | buf.write("\13\u0097\3\u0097\3\u0097\3\u0098\3\u0098\5\u0098\u0506") 133 | buf.write("\n\u0098\3\u0098\3\u0098\5\u0098\u050a\n\u0098\3\u0098") 134 | buf.write("\3\u0098\7\u0098\u050e\n\u0098\f\u0098\16\u0098\u0511") 135 | buf.write("\13\u0098\3\u0098\3\u0098\3\u0099\3\u0099\5\u0099\u0517") 136 | buf.write("\n\u0099\3\u0099\3\u0099\3\u0099\3\u0099\3\u0099\3\u0099") 137 | buf.write("\3\u0099\3\u0099\3\u0099\7\u0099\u0522\n\u0099\f\u0099") 138 | buf.write("\16\u0099\u0525\13\u0099\3\u0099\3\u0099\3\u009a\6\u009a") 139 | buf.write("\u052a\n\u009a\r\u009a\16\u009a\u052b\3\u009a\3\u009a") 140 | buf.write("\3\u009b\3\u009b\5\u009b\u0532\n\u009b\3\u009b\5\u009b") 141 | buf.write("\u0535\n\u009b\3\u009b\3\u009b\3\u009c\3\u009c\3\u009c") 142 | buf.write("\3\u009c\7\u009c\u053d\n\u009c\f\u009c\16\u009c\u0540") 143 | buf.write("\13\u009c\3\u009c\3\u009c\3\u009c\3\u009c\3\u009c\3\u009d") 144 | buf.write("\3\u009d\3\u009d\3\u009d\7\u009d\u054b\n\u009d\f\u009d") 145 | buf.write("\16\u009d\u054e\13\u009d\3\u009d\3\u009d\3\u053e\2\u009e") 146 | buf.write("\3\3\5\4\7\5\t\6\13\7\r\b\17\t\21\n\23\13\25\f\27\r\31") 147 | buf.write("\16\33\17\35\20\37\21!\22#\23%\24\'\25)\26+\27-\30/\31") 148 | buf.write("\61\32\63\33\65\34\67\359\36;\37= ?!A\"C#E$G%I&K\'M(O") 149 | buf.write(")Q*S+U,W-Y.[/]\60_\61a\62c\63e\64g\65i\66k\67m8o9q:s;") 150 | buf.write("u{?}@\177A\u0081B\u0083C\u0085D\u0087E\u0089F\u008b") 151 | buf.write("G\u008dH\u008fI\u0091J\u0093K\u0095L\u0097M\u0099N\u009b") 152 | buf.write("O\u009dP\u009fQ\u00a1R\u00a3S\u00a5T\u00a7U\u00a9V\u00ab") 153 | buf.write("W\u00adX\u00afY\u00b1Z\u00b3[\u00b5\\\u00b7]\u00b9^\u00bb") 154 | buf.write("_\u00bd`\u00bfa\u00c1b\u00c3c\u00c5d\u00c7e\u00c9f\u00cb") 155 | buf.write("g\u00cdh\u00cfi\u00d1j\u00d3k\u00d5\2\u00d7\2\u00d9\2") 156 | buf.write("\u00db\2\u00dd\2\u00dfl\u00e1\2\u00e3\2\u00e5\2\u00e7") 157 | buf.write("\2\u00e9\2\u00eb\2\u00ed\2\u00ef\2\u00f1\2\u00f3\2\u00f5") 158 | buf.write("\2\u00f7\2\u00f9\2\u00fb\2\u00fd\2\u00ff\2\u0101\2\u0103") 159 | buf.write("\2\u0105\2\u0107m\u0109\2\u010b\2\u010d\2\u010f\2\u0111") 160 | buf.write("\2\u0113\2\u0115\2\u0117\2\u0119\2\u011b\2\u011d\2\u011f") 161 | buf.write("n\u0121\2\u0123\2\u0125\2\u0127o\u0129p\u012bq\u012dr") 162 | buf.write("\u012fs\u0131t\u0133u\u0135v\u0137w\u0139x\3\2\27\5\2") 163 | buf.write("C\\aac|\3\2\62;\4\2DDdd\3\2\62\63\4\2ZZzz\3\2\63;\3\2") 164 | buf.write("\629\5\2\62;CHch\4\2WWww\4\2NNnn\4\2--//\6\2HHNNhhnn\6") 165 | buf.write("\2\f\f\17\17))^^\f\2$$))AA^^cdhhppttvvxx\5\2NNWWww\6\2") 166 | buf.write("\f\f\17\17$$^^\3\2%%\4\2\f\f\17\17\3\2}}\3\2\177\177\4") 167 | buf.write("\2\13\13\"\"\2\u0579\2\3\3\2\2\2\2\5\3\2\2\2\2\7\3\2\2") 168 | buf.write("\2\2\t\3\2\2\2\2\13\3\2\2\2\2\r\3\2\2\2\2\17\3\2\2\2\2") 169 | buf.write("\21\3\2\2\2\2\23\3\2\2\2\2\25\3\2\2\2\2\27\3\2\2\2\2\31") 170 | buf.write("\3\2\2\2\2\33\3\2\2\2\2\35\3\2\2\2\2\37\3\2\2\2\2!\3\2") 171 | buf.write("\2\2\2#\3\2\2\2\2%\3\2\2\2\2\'\3\2\2\2\2)\3\2\2\2\2+\3") 172 | buf.write("\2\2\2\2-\3\2\2\2\2/\3\2\2\2\2\61\3\2\2\2\2\63\3\2\2\2") 173 | buf.write("\2\65\3\2\2\2\2\67\3\2\2\2\29\3\2\2\2\2;\3\2\2\2\2=\3") 174 | buf.write("\2\2\2\2?\3\2\2\2\2A\3\2\2\2\2C\3\2\2\2\2E\3\2\2\2\2G") 175 | buf.write("\3\2\2\2\2I\3\2\2\2\2K\3\2\2\2\2M\3\2\2\2\2O\3\2\2\2\2") 176 | buf.write("Q\3\2\2\2\2S\3\2\2\2\2U\3\2\2\2\2W\3\2\2\2\2Y\3\2\2\2") 177 | buf.write("\2[\3\2\2\2\2]\3\2\2\2\2_\3\2\2\2\2a\3\2\2\2\2c\3\2\2") 178 | buf.write("\2\2e\3\2\2\2\2g\3\2\2\2\2i\3\2\2\2\2k\3\2\2\2\2m\3\2") 179 | buf.write("\2\2\2o\3\2\2\2\2q\3\2\2\2\2s\3\2\2\2\2u\3\2\2\2\2w\3") 180 | buf.write("\2\2\2\2y\3\2\2\2\2{\3\2\2\2\2}\3\2\2\2\2\177\3\2\2\2") 181 | buf.write("\2\u0081\3\2\2\2\2\u0083\3\2\2\2\2\u0085\3\2\2\2\2\u0087") 182 | buf.write("\3\2\2\2\2\u0089\3\2\2\2\2\u008b\3\2\2\2\2\u008d\3\2\2") 183 | buf.write("\2\2\u008f\3\2\2\2\2\u0091\3\2\2\2\2\u0093\3\2\2\2\2\u0095") 184 | buf.write("\3\2\2\2\2\u0097\3\2\2\2\2\u0099\3\2\2\2\2\u009b\3\2\2") 185 | buf.write("\2\2\u009d\3\2\2\2\2\u009f\3\2\2\2\2\u00a1\3\2\2\2\2\u00a3") 186 | buf.write("\3\2\2\2\2\u00a5\3\2\2\2\2\u00a7\3\2\2\2\2\u00a9\3\2\2") 187 | buf.write("\2\2\u00ab\3\2\2\2\2\u00ad\3\2\2\2\2\u00af\3\2\2\2\2\u00b1") 188 | buf.write("\3\2\2\2\2\u00b3\3\2\2\2\2\u00b5\3\2\2\2\2\u00b7\3\2\2") 189 | buf.write("\2\2\u00b9\3\2\2\2\2\u00bb\3\2\2\2\2\u00bd\3\2\2\2\2\u00bf") 190 | buf.write("\3\2\2\2\2\u00c1\3\2\2\2\2\u00c3\3\2\2\2\2\u00c5\3\2\2") 191 | buf.write("\2\2\u00c7\3\2\2\2\2\u00c9\3\2\2\2\2\u00cb\3\2\2\2\2\u00cd") 192 | buf.write("\3\2\2\2\2\u00cf\3\2\2\2\2\u00d1\3\2\2\2\2\u00d3\3\2\2") 193 | buf.write("\2\2\u00df\3\2\2\2\2\u0107\3\2\2\2\2\u011f\3\2\2\2\2\u0127") 194 | buf.write("\3\2\2\2\2\u0129\3\2\2\2\2\u012b\3\2\2\2\2\u012d\3\2\2") 195 | buf.write("\2\2\u012f\3\2\2\2\2\u0131\3\2\2\2\2\u0133\3\2\2\2\2\u0135") 196 | buf.write("\3\2\2\2\2\u0137\3\2\2\2\2\u0139\3\2\2\2\3\u013b\3\2\2") 197 | buf.write("\2\5\u0149\3\2\2\2\7\u015a\3\2\2\2\t\u016d\3\2\2\2\13") 198 | buf.write("\u0174\3\2\2\2\r\u017c\3\2\2\2\17\u0184\3\2\2\2\21\u018f") 199 | buf.write("\3\2\2\2\23\u019a\3\2\2\2\25\u01a4\3\2\2\2\27\u01af\3") 200 | buf.write("\2\2\2\31\u01b5\3\2\2\2\33\u01c3\3\2\2\2\35\u01cb\3\2") 201 | buf.write("\2\2\37\u01d8\3\2\2\2!\u01dd\3\2\2\2#\u01e3\3\2\2\2%\u01e8") 202 | buf.write("\3\2\2\2\'\u01ed\3\2\2\2)\u01f3\3\2\2\2+\u01fc\3\2\2\2") 203 | buf.write("-\u0204\3\2\2\2/\u0207\3\2\2\2\61\u020e\3\2\2\2\63\u0213") 204 | buf.write("\3\2\2\2\65\u0218\3\2\2\2\67\u021f\3\2\2\29\u0225\3\2") 205 | buf.write("\2\2;\u0229\3\2\2\2=\u022e\3\2\2\2?\u0231\3\2\2\2A\u0238") 206 | buf.write("\3\2\2\2C\u023c\3\2\2\2E\u0241\3\2\2\2G\u024a\3\2\2\2") 207 | buf.write("I\u0253\3\2\2\2K\u025a\3\2\2\2M\u0260\3\2\2\2O\u0267\3") 208 | buf.write("\2\2\2Q\u026e\3\2\2\2S\u0275\3\2\2\2U\u027c\3\2\2\2W\u0283") 209 | buf.write("\3\2\2\2Y\u028b\3\2\2\2[\u0291\3\2\2\2]\u029a\3\2\2\2") 210 | buf.write("_\u029f\3\2\2\2a\u02a8\3\2\2\2c\u02ae\3\2\2\2e\u02b7\3") 211 | buf.write("\2\2\2g\u02c0\3\2\2\2i\u02c8\3\2\2\2k\u02ce\3\2\2\2m\u02d7") 212 | buf.write("\3\2\2\2o\u02e0\3\2\2\2q\u02eb\3\2\2\2s\u02f5\3\2\2\2") 213 | buf.write("u\u0304\3\2\2\2w\u0312\3\2\2\2y\u0314\3\2\2\2{\u0316\3") 214 | buf.write("\2\2\2}\u0318\3\2\2\2\177\u031a\3\2\2\2\u0081\u031c\3") 215 | buf.write("\2\2\2\u0083\u031e\3\2\2\2\u0085\u0320\3\2\2\2\u0087\u0323") 216 | buf.write("\3\2\2\2\u0089\u0325\3\2\2\2\u008b\u0328\3\2\2\2\u008d") 217 | buf.write("\u032b\3\2\2\2\u008f\u032e\3\2\2\2\u0091\u0330\3\2\2\2") 218 | buf.write("\u0093\u0333\3\2\2\2\u0095\u0335\3\2\2\2\u0097\u0338\3") 219 | buf.write("\2\2\2\u0099\u033a\3\2\2\2\u009b\u033c\3\2\2\2\u009d\u033e") 220 | buf.write("\3\2\2\2\u009f\u0340\3\2\2\2\u00a1\u0342\3\2\2\2\u00a3") 221 | buf.write("\u0345\3\2\2\2\u00a5\u0348\3\2\2\2\u00a7\u034a\3\2\2\2") 222 | buf.write("\u00a9\u034c\3\2\2\2\u00ab\u034e\3\2\2\2\u00ad\u0350\3") 223 | buf.write("\2\2\2\u00af\u0352\3\2\2\2\u00b1\u0354\3\2\2\2\u00b3\u0356") 224 | buf.write("\3\2\2\2\u00b5\u0358\3\2\2\2\u00b7\u035b\3\2\2\2\u00b9") 225 | buf.write("\u035e\3\2\2\2\u00bb\u0361\3\2\2\2\u00bd\u0364\3\2\2\2") 226 | buf.write("\u00bf\u0367\3\2\2\2\u00c1\u036b\3\2\2\2\u00c3\u036f\3") 227 | buf.write("\2\2\2\u00c5\u0372\3\2\2\2\u00c7\u0375\3\2\2\2\u00c9\u0378") 228 | buf.write("\3\2\2\2\u00cb\u037b\3\2\2\2\u00cd\u037e\3\2\2\2\u00cf") 229 | buf.write("\u0381\3\2\2\2\u00d1\u0383\3\2\2\2\u00d3\u0387\3\2\2\2") 230 | buf.write("\u00d5\u0391\3\2\2\2\u00d7\u0393\3\2\2\2\u00d9\u0395\3") 231 | buf.write("\2\2\2\u00db\u03a1\3\2\2\2\u00dd\u03a3\3\2\2\2\u00df\u03ab") 232 | buf.write("\3\2\2\2\u00e1\u03ba\3\2\2\2\u00e3\u03bc\3\2\2\2\u00e5") 233 | buf.write("\u03c3\3\2\2\2\u00e7\u03ca\3\2\2\2\u00e9\u03d1\3\2\2\2") 234 | buf.write("\u00eb\u03d7\3\2\2\2\u00ed\u03da\3\2\2\2\u00ef\u03dc\3") 235 | buf.write("\2\2\2\u00f1\u03de\3\2\2\2\u00f3\u03ef\3\2\2\2\u00f5\u03f1") 236 | buf.write("\3\2\2\2\u00f7\u03f3\3\2\2\2\u00f9\u03f9\3\2\2\2\u00fb") 237 | buf.write("\u03fd\3\2\2\2\u00fd\u040b\3\2\2\2\u00ff\u0419\3\2\2\2") 238 | buf.write("\u0101\u0423\3\2\2\2\u0103\u042f\3\2\2\2\u0105\u0431\3") 239 | buf.write("\2\2\2\u0107\u0434\3\2\2\2\u0109\u0440\3\2\2\2\u010b\u044c") 240 | buf.write("\3\2\2\2\u010d\u044f\3\2\2\2\u010f\u0453\3\2\2\2\u0111") 241 | buf.write("\u046b\3\2\2\2\u0113\u046e\3\2\2\2\u0115\u0474\3\2\2\2") 242 | buf.write("\u0117\u047a\3\2\2\2\u0119\u047c\3\2\2\2\u011b\u048a\3") 243 | buf.write("\2\2\2\u011d\u048c\3\2\2\2\u011f\u0495\3\2\2\2\u0121\u04a0") 244 | buf.write("\3\2\2\2\u0123\u04a3\3\2\2\2\u0125\u04ae\3\2\2\2\u0127") 245 | buf.write("\u04b0\3\2\2\2\u0129\u04c3\3\2\2\2\u012b\u04da\3\2\2\2") 246 | buf.write("\u012d\u04ef\3\2\2\2\u012f\u0503\3\2\2\2\u0131\u0514\3") 247 | buf.write("\2\2\2\u0133\u0529\3\2\2\2\u0135\u0534\3\2\2\2\u0137\u0538") 248 | buf.write("\3\2\2\2\u0139\u0546\3\2\2\2\u013b\u013c\7a\2\2\u013c") 249 | buf.write("\u013d\7a\2\2\u013d\u013e\7g\2\2\u013e\u013f\7z\2\2\u013f") 250 | buf.write("\u0140\7v\2\2\u0140\u0141\7g\2\2\u0141\u0142\7p\2\2\u0142") 251 | buf.write("\u0143\7u\2\2\u0143\u0144\7k\2\2\u0144\u0145\7q\2\2\u0145") 252 | buf.write("\u0146\7p\2\2\u0146\u0147\7a\2\2\u0147\u0148\7a\2\2\u0148") 253 | buf.write("\4\3\2\2\2\u0149\u014a\7a\2\2\u014a\u014b\7a\2\2\u014b") 254 | buf.write("\u014c\7d\2\2\u014c\u014d\7w\2\2\u014d\u014e\7k\2\2\u014e") 255 | buf.write("\u014f\7n\2\2\u014f\u0150\7v\2\2\u0150\u0151\7k\2\2\u0151") 256 | buf.write("\u0152\7p\2\2\u0152\u0153\7a\2\2\u0153\u0154\7x\2\2\u0154") 257 | buf.write("\u0155\7c\2\2\u0155\u0156\7a\2\2\u0156\u0157\7c\2\2\u0157") 258 | buf.write("\u0158\7t\2\2\u0158\u0159\7i\2\2\u0159\6\3\2\2\2\u015a") 259 | buf.write("\u015b\7a\2\2\u015b\u015c\7a\2\2\u015c\u015d\7d\2\2\u015d") 260 | buf.write("\u015e\7w\2\2\u015e\u015f\7k\2\2\u015f\u0160\7n\2\2\u0160") 261 | buf.write("\u0161\7v\2\2\u0161\u0162\7k\2\2\u0162\u0163\7p\2\2\u0163") 262 | buf.write("\u0164\7a\2\2\u0164\u0165\7q\2\2\u0165\u0166\7h\2\2\u0166") 263 | buf.write("\u0167\7h\2\2\u0167\u0168\7u\2\2\u0168\u0169\7g\2\2\u0169") 264 | buf.write("\u016a\7v\2\2\u016a\u016b\7q\2\2\u016b\u016c\7h\2\2\u016c") 265 | buf.write("\b\3\2\2\2\u016d\u016e\7a\2\2\u016e\u016f\7a\2\2\u016f") 266 | buf.write("\u0170\7o\2\2\u0170\u0171\7\63\2\2\u0171\u0172\7\64\2") 267 | buf.write("\2\u0172\u0173\7:\2\2\u0173\n\3\2\2\2\u0174\u0175\7a\2") 268 | buf.write("\2\u0175\u0176\7a\2\2\u0176\u0177\7o\2\2\u0177\u0178\7") 269 | buf.write("\63\2\2\u0178\u0179\7\64\2\2\u0179\u017a\7:\2\2\u017a") 270 | buf.write("\u017b\7f\2\2\u017b\f\3\2\2\2\u017c\u017d\7a\2\2\u017d") 271 | buf.write("\u017e\7a\2\2\u017e\u017f\7o\2\2\u017f\u0180\7\63\2\2") 272 | buf.write("\u0180\u0181\7\64\2\2\u0181\u0182\7:\2\2\u0182\u0183\7") 273 | buf.write("k\2\2\u0183\16\3\2\2\2\u0184\u0185\7a\2\2\u0185\u0186") 274 | buf.write("\7a\2\2\u0186\u0187\7v\2\2\u0187\u0188\7{\2\2\u0188\u0189") 275 | buf.write("\7r\2\2\u0189\u018a\7g\2\2\u018a\u018b\7q\2\2\u018b\u018c") 276 | buf.write("\7h\2\2\u018c\u018d\7a\2\2\u018d\u018e\7a\2\2\u018e\20") 277 | buf.write("\3\2\2\2\u018f\u0190\7a\2\2\u0190\u0191\7a\2\2\u0191\u0192") 278 | buf.write("\7k\2\2\u0192\u0193\7p\2\2\u0193\u0194\7n\2\2\u0194\u0195") 279 | buf.write("\7k\2\2\u0195\u0196\7p\2\2\u0196\u0197\7g\2\2\u0197\u0198") 280 | buf.write("\7a\2\2\u0198\u0199\7a\2\2\u0199\22\3\2\2\2\u019a\u019b") 281 | buf.write("\7a\2\2\u019b\u019c\7a\2\2\u019c\u019d\7u\2\2\u019d\u019e") 282 | buf.write("\7v\2\2\u019e\u019f\7f\2\2\u019f\u01a0\7e\2\2\u01a0\u01a1") 283 | buf.write("\7c\2\2\u01a1\u01a2\7n\2\2\u01a2\u01a3\7n\2\2\u01a3\24") 284 | buf.write("\3\2\2\2\u01a4\u01a5\7a\2\2\u01a5\u01a6\7a\2\2\u01a6\u01a7") 285 | buf.write("\7f\2\2\u01a7\u01a8\7g\2\2\u01a8\u01a9\7e\2\2\u01a9\u01aa") 286 | buf.write("\7n\2\2\u01aa\u01ab\7u\2\2\u01ab\u01ac\7r\2\2\u01ac\u01ad") 287 | buf.write("\7g\2\2\u01ad\u01ae\7e\2\2\u01ae\26\3\2\2\2\u01af\u01b0") 288 | buf.write("\7a\2\2\u01b0\u01b1\7a\2\2\u01b1\u01b2\7c\2\2\u01b2\u01b3") 289 | buf.write("\7u\2\2\u01b3\u01b4\7o\2\2\u01b4\30\3\2\2\2\u01b5\u01b6") 290 | buf.write("\7a\2\2\u01b6\u01b7\7a\2\2\u01b7\u01b8\7c\2\2\u01b8\u01b9") 291 | buf.write("\7v\2\2\u01b9\u01ba\7v\2\2\u01ba\u01bb\7t\2\2\u01bb\u01bc") 292 | buf.write("\7k\2\2\u01bc\u01bd\7d\2\2\u01bd\u01be\7w\2\2\u01be\u01bf") 293 | buf.write("\7v\2\2\u01bf\u01c0\7g\2\2\u01c0\u01c1\7a\2\2\u01c1\u01c2") 294 | buf.write("\7a\2\2\u01c2\32\3\2\2\2\u01c3\u01c4\7a\2\2\u01c4\u01c5") 295 | buf.write("\7a\2\2\u01c5\u01c6\7c\2\2\u01c6\u01c7\7u\2\2\u01c7\u01c8") 296 | buf.write("\7o\2\2\u01c8\u01c9\7a\2\2\u01c9\u01ca\7a\2\2\u01ca\34") 297 | buf.write("\3\2\2\2\u01cb\u01cc\7a\2\2\u01cc\u01cd\7a\2\2\u01cd\u01ce") 298 | buf.write("\7x\2\2\u01ce\u01cf\7q\2\2\u01cf\u01d0\7n\2\2\u01d0\u01d1") 299 | buf.write("\7c\2\2\u01d1\u01d2\7v\2\2\u01d2\u01d3\7k\2\2\u01d3\u01d4") 300 | buf.write("\7n\2\2\u01d4\u01d5\7g\2\2\u01d5\u01d6\7a\2\2\u01d6\u01d7") 301 | buf.write("\7a\2\2\u01d7\36\3\2\2\2\u01d8\u01d9\7c\2\2\u01d9\u01da") 302 | buf.write("\7w\2\2\u01da\u01db\7v\2\2\u01db\u01dc\7q\2\2\u01dc \3") 303 | buf.write("\2\2\2\u01dd\u01de\7d\2\2\u01de\u01df\7t\2\2\u01df\u01e0") 304 | buf.write("\7g\2\2\u01e0\u01e1\7c\2\2\u01e1\u01e2\7m\2\2\u01e2\"") 305 | buf.write("\3\2\2\2\u01e3\u01e4\7e\2\2\u01e4\u01e5\7c\2\2\u01e5\u01e6") 306 | buf.write("\7u\2\2\u01e6\u01e7\7g\2\2\u01e7$\3\2\2\2\u01e8\u01e9") 307 | buf.write("\7e\2\2\u01e9\u01ea\7j\2\2\u01ea\u01eb\7c\2\2\u01eb\u01ec") 308 | buf.write("\7t\2\2\u01ec&\3\2\2\2\u01ed\u01ee\7e\2\2\u01ee\u01ef") 309 | buf.write("\7q\2\2\u01ef\u01f0\7p\2\2\u01f0\u01f1\7u\2\2\u01f1\u01f2") 310 | buf.write("\7v\2\2\u01f2(\3\2\2\2\u01f3\u01f4\7e\2\2\u01f4\u01f5") 311 | buf.write("\7q\2\2\u01f5\u01f6\7p\2\2\u01f6\u01f7\7v\2\2\u01f7\u01f8") 312 | buf.write("\7k\2\2\u01f8\u01f9\7p\2\2\u01f9\u01fa\7w\2\2\u01fa\u01fb") 313 | buf.write("\7g\2\2\u01fb*\3\2\2\2\u01fc\u01fd\7f\2\2\u01fd\u01fe") 314 | buf.write("\7g\2\2\u01fe\u01ff\7h\2\2\u01ff\u0200\7c\2\2\u0200\u0201") 315 | buf.write("\7w\2\2\u0201\u0202\7n\2\2\u0202\u0203\7v\2\2\u0203,\3") 316 | buf.write("\2\2\2\u0204\u0205\7f\2\2\u0205\u0206\7q\2\2\u0206.\3") 317 | buf.write("\2\2\2\u0207\u0208\7f\2\2\u0208\u0209\7q\2\2\u0209\u020a") 318 | buf.write("\7w\2\2\u020a\u020b\7d\2\2\u020b\u020c\7n\2\2\u020c\u020d") 319 | buf.write("\7g\2\2\u020d\60\3\2\2\2\u020e\u020f\7g\2\2\u020f\u0210") 320 | buf.write("\7n\2\2\u0210\u0211\7u\2\2\u0211\u0212\7g\2\2\u0212\62") 321 | buf.write("\3\2\2\2\u0213\u0214\7g\2\2\u0214\u0215\7p\2\2\u0215\u0216") 322 | buf.write("\7w\2\2\u0216\u0217\7o\2\2\u0217\64\3\2\2\2\u0218\u0219") 323 | buf.write("\7g\2\2\u0219\u021a\7z\2\2\u021a\u021b\7v\2\2\u021b\u021c") 324 | buf.write("\7g\2\2\u021c\u021d\7t\2\2\u021d\u021e\7p\2\2\u021e\66") 325 | buf.write("\3\2\2\2\u021f\u0220\7h\2\2\u0220\u0221\7n\2\2\u0221\u0222") 326 | buf.write("\7q\2\2\u0222\u0223\7c\2\2\u0223\u0224\7v\2\2\u02248\3") 327 | buf.write("\2\2\2\u0225\u0226\7h\2\2\u0226\u0227\7q\2\2\u0227\u0228") 328 | buf.write("\7t\2\2\u0228:\3\2\2\2\u0229\u022a\7i\2\2\u022a\u022b") 329 | buf.write("\7q\2\2\u022b\u022c\7v\2\2\u022c\u022d\7q\2\2\u022d<\3") 330 | buf.write("\2\2\2\u022e\u022f\7k\2\2\u022f\u0230\7h\2\2\u0230>\3") 331 | buf.write("\2\2\2\u0231\u0232\7k\2\2\u0232\u0233\7p\2\2\u0233\u0234") 332 | buf.write("\7n\2\2\u0234\u0235\7k\2\2\u0235\u0236\7p\2\2\u0236\u0237") 333 | buf.write("\7g\2\2\u0237@\3\2\2\2\u0238\u0239\7k\2\2\u0239\u023a") 334 | buf.write("\7p\2\2\u023a\u023b\7v\2\2\u023bB\3\2\2\2\u023c\u023d") 335 | buf.write("\7n\2\2\u023d\u023e\7q\2\2\u023e\u023f\7p\2\2\u023f\u0240") 336 | buf.write("\7i\2\2\u0240D\3\2\2\2\u0241\u0242\7t\2\2\u0242\u0243") 337 | buf.write("\7g\2\2\u0243\u0244\7i\2\2\u0244\u0245\7k\2\2\u0245\u0246") 338 | buf.write("\7u\2\2\u0246\u0247\7v\2\2\u0247\u0248\7g\2\2\u0248\u0249") 339 | buf.write("\7t\2\2\u0249F\3\2\2\2\u024a\u024b\7t\2\2\u024b\u024c") 340 | buf.write("\7g\2\2\u024c\u024d\7u\2\2\u024d\u024e\7v\2\2\u024e\u024f") 341 | buf.write("\7t\2\2\u024f\u0250\7k\2\2\u0250\u0251\7e\2\2\u0251\u0252") 342 | buf.write("\7v\2\2\u0252H\3\2\2\2\u0253\u0254\7t\2\2\u0254\u0255") 343 | buf.write("\7g\2\2\u0255\u0256\7v\2\2\u0256\u0257\7w\2\2\u0257\u0258") 344 | buf.write("\7t\2\2\u0258\u0259\7p\2\2\u0259J\3\2\2\2\u025a\u025b") 345 | buf.write("\7u\2\2\u025b\u025c\7j\2\2\u025c\u025d\7q\2\2\u025d\u025e") 346 | buf.write("\7t\2\2\u025e\u025f\7v\2\2\u025fL\3\2\2\2\u0260\u0261") 347 | buf.write("\7u\2\2\u0261\u0262\7k\2\2\u0262\u0263\7i\2\2\u0263\u0264") 348 | buf.write("\7p\2\2\u0264\u0265\7g\2\2\u0265\u0266\7f\2\2\u0266N\3") 349 | buf.write("\2\2\2\u0267\u0268\7u\2\2\u0268\u0269\7k\2\2\u0269\u026a") 350 | buf.write("\7|\2\2\u026a\u026b\7g\2\2\u026b\u026c\7q\2\2\u026c\u026d") 351 | buf.write("\7h\2\2\u026dP\3\2\2\2\u026e\u026f\7u\2\2\u026f\u0270") 352 | buf.write("\7v\2\2\u0270\u0271\7c\2\2\u0271\u0272\7v\2\2\u0272\u0273") 353 | buf.write("\7k\2\2\u0273\u0274\7e\2\2\u0274R\3\2\2\2\u0275\u0276") 354 | buf.write("\7u\2\2\u0276\u0277\7v\2\2\u0277\u0278\7t\2\2\u0278\u0279") 355 | buf.write("\7w\2\2\u0279\u027a\7e\2\2\u027a\u027b\7v\2\2\u027bT\3") 356 | buf.write("\2\2\2\u027c\u027d\7u\2\2\u027d\u027e\7y\2\2\u027e\u027f") 357 | buf.write("\7k\2\2\u027f\u0280\7v\2\2\u0280\u0281\7e\2\2\u0281\u0282") 358 | buf.write("\7j\2\2\u0282V\3\2\2\2\u0283\u0284\7v\2\2\u0284\u0285") 359 | buf.write("\7{\2\2\u0285\u0286\7r\2\2\u0286\u0287\7g\2\2\u0287\u0288") 360 | buf.write("\7f\2\2\u0288\u0289\7g\2\2\u0289\u028a\7h\2\2\u028aX\3") 361 | buf.write("\2\2\2\u028b\u028c\7w\2\2\u028c\u028d\7p\2\2\u028d\u028e") 362 | buf.write("\7k\2\2\u028e\u028f\7q\2\2\u028f\u0290\7p\2\2\u0290Z\3") 363 | buf.write("\2\2\2\u0291\u0292\7w\2\2\u0292\u0293\7p\2\2\u0293\u0294") 364 | buf.write("\7u\2\2\u0294\u0295\7k\2\2\u0295\u0296\7i\2\2\u0296\u0297") 365 | buf.write("\7p\2\2\u0297\u0298\7g\2\2\u0298\u0299\7f\2\2\u0299\\") 366 | buf.write("\3\2\2\2\u029a\u029b\7x\2\2\u029b\u029c\7q\2\2\u029c\u029d") 367 | buf.write("\7k\2\2\u029d\u029e\7f\2\2\u029e^\3\2\2\2\u029f\u02a0") 368 | buf.write("\7x\2\2\u02a0\u02a1\7q\2\2\u02a1\u02a2\7n\2\2\u02a2\u02a3") 369 | buf.write("\7c\2\2\u02a3\u02a4\7v\2\2\u02a4\u02a5\7k\2\2\u02a5\u02a6") 370 | buf.write("\7n\2\2\u02a6\u02a7\7g\2\2\u02a7`\3\2\2\2\u02a8\u02a9") 371 | buf.write("\7y\2\2\u02a9\u02aa\7j\2\2\u02aa\u02ab\7k\2\2\u02ab\u02ac") 372 | buf.write("\7n\2\2\u02ac\u02ad\7g\2\2\u02adb\3\2\2\2\u02ae\u02af") 373 | buf.write("\7a\2\2\u02af\u02b0\7C\2\2\u02b0\u02b1\7n\2\2\u02b1\u02b2") 374 | buf.write("\7k\2\2\u02b2\u02b3\7i\2\2\u02b3\u02b4\7p\2\2\u02b4\u02b5") 375 | buf.write("\7c\2\2\u02b5\u02b6\7u\2\2\u02b6d\3\2\2\2\u02b7\u02b8") 376 | buf.write("\7a\2\2\u02b8\u02b9\7C\2\2\u02b9\u02ba\7n\2\2\u02ba\u02bb") 377 | buf.write("\7k\2\2\u02bb\u02bc\7i\2\2\u02bc\u02bd\7p\2\2\u02bd\u02be") 378 | buf.write("\7q\2\2\u02be\u02bf\7h\2\2\u02bff\3\2\2\2\u02c0\u02c1") 379 | buf.write("\7a\2\2\u02c1\u02c2\7C\2\2\u02c2\u02c3\7v\2\2\u02c3\u02c4") 380 | buf.write("\7q\2\2\u02c4\u02c5\7o\2\2\u02c5\u02c6\7k\2\2\u02c6\u02c7") 381 | buf.write("\7e\2\2\u02c7h\3\2\2\2\u02c8\u02c9\7a\2\2\u02c9\u02ca") 382 | buf.write("\7D\2\2\u02ca\u02cb\7q\2\2\u02cb\u02cc\7q\2\2\u02cc\u02cd") 383 | buf.write("\7n\2\2\u02cdj\3\2\2\2\u02ce\u02cf\7a\2\2\u02cf\u02d0") 384 | buf.write("\7E\2\2\u02d0\u02d1\7q\2\2\u02d1\u02d2\7o\2\2\u02d2\u02d3") 385 | buf.write("\7r\2\2\u02d3\u02d4\7n\2\2\u02d4\u02d5\7g\2\2\u02d5\u02d6") 386 | buf.write("\7z\2\2\u02d6l\3\2\2\2\u02d7\u02d8\7a\2\2\u02d8\u02d9") 387 | buf.write("\7I\2\2\u02d9\u02da\7g\2\2\u02da\u02db\7p\2\2\u02db\u02dc") 388 | buf.write("\7g\2\2\u02dc\u02dd\7t\2\2\u02dd\u02de\7k\2\2\u02de\u02df") 389 | buf.write("\7e\2\2\u02dfn\3\2\2\2\u02e0\u02e1\7a\2\2\u02e1\u02e2") 390 | buf.write("\7K\2\2\u02e2\u02e3\7o\2\2\u02e3\u02e4\7c\2\2\u02e4\u02e5") 391 | buf.write("\7i\2\2\u02e5\u02e6\7k\2\2\u02e6\u02e7\7p\2\2\u02e7\u02e8") 392 | buf.write("\7c\2\2\u02e8\u02e9\7t\2\2\u02e9\u02ea\7{\2\2\u02eap\3") 393 | buf.write("\2\2\2\u02eb\u02ec\7a\2\2\u02ec\u02ed\7P\2\2\u02ed\u02ee") 394 | buf.write("\7q\2\2\u02ee\u02ef\7t\2\2\u02ef\u02f0\7g\2\2\u02f0\u02f1") 395 | buf.write("\7v\2\2\u02f1\u02f2\7w\2\2\u02f2\u02f3\7t\2\2\u02f3\u02f4") 396 | buf.write("\7p\2\2\u02f4r\3\2\2\2\u02f5\u02f6\7a\2\2\u02f6\u02f7") 397 | buf.write("\7U\2\2\u02f7\u02f8\7v\2\2\u02f8\u02f9\7c\2\2\u02f9\u02fa") 398 | buf.write("\7v\2\2\u02fa\u02fb\7k\2\2\u02fb\u02fc\7e\2\2\u02fc\u02fd") 399 | buf.write("\7a\2\2\u02fd\u02fe\7c\2\2\u02fe\u02ff\7u\2\2\u02ff\u0300") 400 | buf.write("\7u\2\2\u0300\u0301\7g\2\2\u0301\u0302\7t\2\2\u0302\u0303") 401 | buf.write("\7v\2\2\u0303t\3\2\2\2\u0304\u0305\7a\2\2\u0305\u0306") 402 | buf.write("\7V\2\2\u0306\u0307\7j\2\2\u0307\u0308\7t\2\2\u0308\u0309") 403 | buf.write("\7g\2\2\u0309\u030a\7c\2\2\u030a\u030b\7f\2\2\u030b\u030c") 404 | buf.write("\7a\2\2\u030c\u030d\7n\2\2\u030d\u030e\7q\2\2\u030e\u030f") 405 | buf.write("\7e\2\2\u030f\u0310\7c\2\2\u0310\u0311\7n\2\2\u0311v\3") 406 | buf.write("\2\2\2\u0312\u0313\7*\2\2\u0313x\3\2\2\2\u0314\u0315\7") 407 | buf.write("+\2\2\u0315z\3\2\2\2\u0316\u0317\7]\2\2\u0317|\3\2\2\2") 408 | buf.write("\u0318\u0319\7_\2\2\u0319~\3\2\2\2\u031a\u031b\7}\2\2") 409 | buf.write("\u031b\u0080\3\2\2\2\u031c\u031d\7\177\2\2\u031d\u0082") 410 | buf.write("\3\2\2\2\u031e\u031f\7>\2\2\u031f\u0084\3\2\2\2\u0320") 411 | buf.write("\u0321\7>\2\2\u0321\u0322\7?\2\2\u0322\u0086\3\2\2\2\u0323") 412 | buf.write("\u0324\7@\2\2\u0324\u0088\3\2\2\2\u0325\u0326\7@\2\2\u0326") 413 | buf.write("\u0327\7?\2\2\u0327\u008a\3\2\2\2\u0328\u0329\7>\2\2\u0329") 414 | buf.write("\u032a\7>\2\2\u032a\u008c\3\2\2\2\u032b\u032c\7@\2\2\u032c") 415 | buf.write("\u032d\7@\2\2\u032d\u008e\3\2\2\2\u032e\u032f\7-\2\2\u032f") 416 | buf.write("\u0090\3\2\2\2\u0330\u0331\7-\2\2\u0331\u0332\7-\2\2\u0332") 417 | buf.write("\u0092\3\2\2\2\u0333\u0334\7/\2\2\u0334\u0094\3\2\2\2") 418 | buf.write("\u0335\u0336\7/\2\2\u0336\u0337\7/\2\2\u0337\u0096\3\2") 419 | buf.write("\2\2\u0338\u0339\7,\2\2\u0339\u0098\3\2\2\2\u033a\u033b") 420 | buf.write("\7\61\2\2\u033b\u009a\3\2\2\2\u033c\u033d\7\'\2\2\u033d") 421 | buf.write("\u009c\3\2\2\2\u033e\u033f\7(\2\2\u033f\u009e\3\2\2\2") 422 | buf.write("\u0340\u0341\7~\2\2\u0341\u00a0\3\2\2\2\u0342\u0343\7") 423 | buf.write("(\2\2\u0343\u0344\7(\2\2\u0344\u00a2\3\2\2\2\u0345\u0346") 424 | buf.write("\7~\2\2\u0346\u0347\7~\2\2\u0347\u00a4\3\2\2\2\u0348\u0349") 425 | buf.write("\7`\2\2\u0349\u00a6\3\2\2\2\u034a\u034b\7#\2\2\u034b\u00a8") 426 | buf.write("\3\2\2\2\u034c\u034d\7\u0080\2\2\u034d\u00aa\3\2\2\2\u034e") 427 | buf.write("\u034f\7A\2\2\u034f\u00ac\3\2\2\2\u0350\u0351\7<\2\2\u0351") 428 | buf.write("\u00ae\3\2\2\2\u0352\u0353\7=\2\2\u0353\u00b0\3\2\2\2") 429 | buf.write("\u0354\u0355\7.\2\2\u0355\u00b2\3\2\2\2\u0356\u0357\7") 430 | buf.write("?\2\2\u0357\u00b4\3\2\2\2\u0358\u0359\7,\2\2\u0359\u035a") 431 | buf.write("\7?\2\2\u035a\u00b6\3\2\2\2\u035b\u035c\7\61\2\2\u035c") 432 | buf.write("\u035d\7?\2\2\u035d\u00b8\3\2\2\2\u035e\u035f\7\'\2\2") 433 | buf.write("\u035f\u0360\7?\2\2\u0360\u00ba\3\2\2\2\u0361\u0362\7") 434 | buf.write("-\2\2\u0362\u0363\7?\2\2\u0363\u00bc\3\2\2\2\u0364\u0365") 435 | buf.write("\7/\2\2\u0365\u0366\7?\2\2\u0366\u00be\3\2\2\2\u0367\u0368") 436 | buf.write("\7>\2\2\u0368\u0369\7>\2\2\u0369\u036a\7?\2\2\u036a\u00c0") 437 | buf.write("\3\2\2\2\u036b\u036c\7@\2\2\u036c\u036d\7@\2\2\u036d\u036e") 438 | buf.write("\7?\2\2\u036e\u00c2\3\2\2\2\u036f\u0370\7(\2\2\u0370\u0371") 439 | buf.write("\7?\2\2\u0371\u00c4\3\2\2\2\u0372\u0373\7`\2\2\u0373\u0374") 440 | buf.write("\7?\2\2\u0374\u00c6\3\2\2\2\u0375\u0376\7~\2\2\u0376\u0377") 441 | buf.write("\7?\2\2\u0377\u00c8\3\2\2\2\u0378\u0379\7?\2\2\u0379\u037a") 442 | buf.write("\7?\2\2\u037a\u00ca\3\2\2\2\u037b\u037c\7#\2\2\u037c\u037d") 443 | buf.write("\7?\2\2\u037d\u00cc\3\2\2\2\u037e\u037f\7/\2\2\u037f\u0380") 444 | buf.write("\7@\2\2\u0380\u00ce\3\2\2\2\u0381\u0382\7\60\2\2\u0382") 445 | buf.write("\u00d0\3\2\2\2\u0383\u0384\7\60\2\2\u0384\u0385\7\60\2") 446 | buf.write("\2\u0385\u0386\7\60\2\2\u0386\u00d2\3\2\2\2\u0387\u038c") 447 | buf.write("\5\u00d5k\2\u0388\u038b\5\u00d5k\2\u0389\u038b\5\u00d9") 448 | buf.write("m\2\u038a\u0388\3\2\2\2\u038a\u0389\3\2\2\2\u038b\u038e") 449 | buf.write("\3\2\2\2\u038c\u038a\3\2\2\2\u038c\u038d\3\2\2\2\u038d") 450 | buf.write("\u00d4\3\2\2\2\u038e\u038c\3\2\2\2\u038f\u0392\5\u00d7") 451 | buf.write("l\2\u0390\u0392\5\u00dbn\2\u0391\u038f\3\2\2\2\u0391\u0390") 452 | buf.write("\3\2\2\2\u0392\u00d6\3\2\2\2\u0393\u0394\t\2\2\2\u0394") 453 | buf.write("\u00d8\3\2\2\2\u0395\u0396\t\3\2\2\u0396\u00da\3\2\2\2") 454 | buf.write("\u0397\u0398\7^\2\2\u0398\u0399\7w\2\2\u0399\u039a\3\2") 455 | buf.write("\2\2\u039a\u03a2\5\u00ddo\2\u039b\u039c\7^\2\2\u039c\u039d") 456 | buf.write("\7W\2\2\u039d\u039e\3\2\2\2\u039e\u039f\5\u00ddo\2\u039f") 457 | buf.write("\u03a0\5\u00ddo\2\u03a0\u03a2\3\2\2\2\u03a1\u0397\3\2") 458 | buf.write("\2\2\u03a1\u039b\3\2\2\2\u03a2\u00dc\3\2\2\2\u03a3\u03a4") 459 | buf.write("\5\u00f1y\2\u03a4\u03a5\5\u00f1y\2\u03a5\u03a6\5\u00f1") 460 | buf.write("y\2\u03a6\u03a7\5\u00f1y\2\u03a7\u00de\3\2\2\2\u03a8\u03ac") 461 | buf.write("\5\u00e1q\2\u03a9\u03ac\5\u00fb~\2\u03aa\u03ac\5\u0111") 462 | buf.write("\u0089\2\u03ab\u03a8\3\2\2\2\u03ab\u03a9\3\2\2\2\u03ab") 463 | buf.write("\u03aa\3\2\2\2\u03ac\u00e0\3\2\2\2\u03ad\u03af\5\u00e5") 464 | buf.write("s\2\u03ae\u03b0\5\u00f3z\2\u03af\u03ae\3\2\2\2\u03af\u03b0") 465 | buf.write("\3\2\2\2\u03b0\u03bb\3\2\2\2\u03b1\u03b3\5\u00e7t\2\u03b2") 466 | buf.write("\u03b4\5\u00f3z\2\u03b3\u03b2\3\2\2\2\u03b3\u03b4\3\2") 467 | buf.write("\2\2\u03b4\u03bb\3\2\2\2\u03b5\u03b7\5\u00e9u\2\u03b6") 468 | buf.write("\u03b8\5\u00f3z\2\u03b7\u03b6\3\2\2\2\u03b7\u03b8\3\2") 469 | buf.write("\2\2\u03b8\u03bb\3\2\2\2\u03b9\u03bb\5\u00e3r\2\u03ba") 470 | buf.write("\u03ad\3\2\2\2\u03ba\u03b1\3\2\2\2\u03ba\u03b5\3\2\2\2") 471 | buf.write("\u03ba\u03b9\3\2\2\2\u03bb\u00e2\3\2\2\2\u03bc\u03bd\7") 472 | buf.write("\62\2\2\u03bd\u03bf\t\4\2\2\u03be\u03c0\t\5\2\2\u03bf") 473 | buf.write("\u03be\3\2\2\2\u03c0\u03c1\3\2\2\2\u03c1\u03bf\3\2\2\2") 474 | buf.write("\u03c1\u03c2\3\2\2\2\u03c2\u00e4\3\2\2\2\u03c3\u03c7\5") 475 | buf.write("\u00edw\2\u03c4\u03c6\5\u00d9m\2\u03c5\u03c4\3\2\2\2\u03c6") 476 | buf.write("\u03c9\3\2\2\2\u03c7\u03c5\3\2\2\2\u03c7\u03c8\3\2\2\2") 477 | buf.write("\u03c8\u00e6\3\2\2\2\u03c9\u03c7\3\2\2\2\u03ca\u03ce\7") 478 | buf.write("\62\2\2\u03cb\u03cd\5\u00efx\2\u03cc\u03cb\3\2\2\2\u03cd") 479 | buf.write("\u03d0\3\2\2\2\u03ce\u03cc\3\2\2\2\u03ce\u03cf\3\2\2\2") 480 | buf.write("\u03cf\u00e8\3\2\2\2\u03d0\u03ce\3\2\2\2\u03d1\u03d3\5") 481 | buf.write("\u00ebv\2\u03d2\u03d4\5\u00f1y\2\u03d3\u03d2\3\2\2\2\u03d4") 482 | buf.write("\u03d5\3\2\2\2\u03d5\u03d3\3\2\2\2\u03d5\u03d6\3\2\2\2") 483 | buf.write("\u03d6\u00ea\3\2\2\2\u03d7\u03d8\7\62\2\2\u03d8\u03d9") 484 | buf.write("\t\6\2\2\u03d9\u00ec\3\2\2\2\u03da\u03db\t\7\2\2\u03db") 485 | buf.write("\u00ee\3\2\2\2\u03dc\u03dd\t\b\2\2\u03dd\u00f0\3\2\2\2") 486 | buf.write("\u03de\u03df\t\t\2\2\u03df\u00f2\3\2\2\2\u03e0\u03e2\5") 487 | buf.write("\u00f5{\2\u03e1\u03e3\5\u00f7|\2\u03e2\u03e1\3\2\2\2\u03e2") 488 | buf.write("\u03e3\3\2\2\2\u03e3\u03f0\3\2\2\2\u03e4\u03e5\5\u00f5") 489 | buf.write("{\2\u03e5\u03e6\5\u00f9}\2\u03e6\u03f0\3\2\2\2\u03e7\u03e9") 490 | buf.write("\5\u00f7|\2\u03e8\u03ea\5\u00f5{\2\u03e9\u03e8\3\2\2\2") 491 | buf.write("\u03e9\u03ea\3\2\2\2\u03ea\u03f0\3\2\2\2\u03eb\u03ed\5") 492 | buf.write("\u00f9}\2\u03ec\u03ee\5\u00f5{\2\u03ed\u03ec\3\2\2\2\u03ed") 493 | buf.write("\u03ee\3\2\2\2\u03ee\u03f0\3\2\2\2\u03ef\u03e0\3\2\2\2") 494 | buf.write("\u03ef\u03e4\3\2\2\2\u03ef\u03e7\3\2\2\2\u03ef\u03eb\3") 495 | buf.write("\2\2\2\u03f0\u00f4\3\2\2\2\u03f1\u03f2\t\n\2\2\u03f2\u00f6") 496 | buf.write("\3\2\2\2\u03f3\u03f4\t\13\2\2\u03f4\u00f8\3\2\2\2\u03f5") 497 | buf.write("\u03f6\7n\2\2\u03f6\u03fa\7n\2\2\u03f7\u03f8\7N\2\2\u03f8") 498 | buf.write("\u03fa\7N\2\2\u03f9\u03f5\3\2\2\2\u03f9\u03f7\3\2\2\2") 499 | buf.write("\u03fa\u00fa\3\2\2\2\u03fb\u03fe\5\u00fd\177\2\u03fc\u03fe") 500 | buf.write("\5\u00ff\u0080\2\u03fd\u03fb\3\2\2\2\u03fd\u03fc\3\2\2") 501 | buf.write("\2\u03fe\u00fc\3\2\2\2\u03ff\u0401\5\u0101\u0081\2\u0400") 502 | buf.write("\u0402\5\u0103\u0082\2\u0401\u0400\3\2\2\2\u0401\u0402") 503 | buf.write("\3\2\2\2\u0402\u0404\3\2\2\2\u0403\u0405\5\u010f\u0088") 504 | buf.write("\2\u0404\u0403\3\2\2\2\u0404\u0405\3\2\2\2\u0405\u040c") 505 | buf.write("\3\2\2\2\u0406\u0407\5\u0107\u0084\2\u0407\u0409\5\u0103") 506 | buf.write("\u0082\2\u0408\u040a\5\u010f\u0088\2\u0409\u0408\3\2\2") 507 | buf.write("\2\u0409\u040a\3\2\2\2\u040a\u040c\3\2\2\2\u040b\u03ff") 508 | buf.write("\3\2\2\2\u040b\u0406\3\2\2\2\u040c\u00fe\3\2\2\2\u040d") 509 | buf.write("\u040e\5\u00ebv\2\u040e\u040f\5\u0109\u0085\2\u040f\u0411") 510 | buf.write("\5\u010b\u0086\2\u0410\u0412\5\u010f\u0088\2\u0411\u0410") 511 | buf.write("\3\2\2\2\u0411\u0412\3\2\2\2\u0412\u041a\3\2\2\2\u0413") 512 | buf.write("\u0414\5\u00ebv\2\u0414\u0415\5\u010d\u0087\2\u0415\u0417") 513 | buf.write("\5\u010b\u0086\2\u0416\u0418\5\u010f\u0088\2\u0417\u0416") 514 | buf.write("\3\2\2\2\u0417\u0418\3\2\2\2\u0418\u041a\3\2\2\2\u0419") 515 | buf.write("\u040d\3\2\2\2\u0419\u0413\3\2\2\2\u041a\u0100\3\2\2\2") 516 | buf.write("\u041b\u041d\5\u0107\u0084\2\u041c\u041b\3\2\2\2\u041c") 517 | buf.write("\u041d\3\2\2\2\u041d\u041e\3\2\2\2\u041e\u041f\7\60\2") 518 | buf.write("\2\u041f\u0424\5\u0107\u0084\2\u0420\u0421\5\u0107\u0084") 519 | buf.write("\2\u0421\u0422\7\60\2\2\u0422\u0424\3\2\2\2\u0423\u041c") 520 | buf.write("\3\2\2\2\u0423\u0420\3\2\2\2\u0424\u0102\3\2\2\2\u0425") 521 | buf.write("\u0427\7g\2\2\u0426\u0428\5\u0105\u0083\2\u0427\u0426") 522 | buf.write("\3\2\2\2\u0427\u0428\3\2\2\2\u0428\u0429\3\2\2\2\u0429") 523 | buf.write("\u0430\5\u0107\u0084\2\u042a\u042c\7G\2\2\u042b\u042d") 524 | buf.write("\5\u0105\u0083\2\u042c\u042b\3\2\2\2\u042c\u042d\3\2\2") 525 | buf.write("\2\u042d\u042e\3\2\2\2\u042e\u0430\5\u0107\u0084\2\u042f") 526 | buf.write("\u0425\3\2\2\2\u042f\u042a\3\2\2\2\u0430\u0104\3\2\2\2") 527 | buf.write("\u0431\u0432\t\f\2\2\u0432\u0106\3\2\2\2\u0433\u0435\5") 528 | buf.write("\u00d9m\2\u0434\u0433\3\2\2\2\u0435\u0436\3\2\2\2\u0436") 529 | buf.write("\u0434\3\2\2\2\u0436\u0437\3\2\2\2\u0437\u0108\3\2\2\2") 530 | buf.write("\u0438\u043a\5\u010d\u0087\2\u0439\u0438\3\2\2\2\u0439") 531 | buf.write("\u043a\3\2\2\2\u043a\u043b\3\2\2\2\u043b\u043c\7\60\2") 532 | buf.write("\2\u043c\u0441\5\u010d\u0087\2\u043d\u043e\5\u010d\u0087") 533 | buf.write("\2\u043e\u043f\7\60\2\2\u043f\u0441\3\2\2\2\u0440\u0439") 534 | buf.write("\3\2\2\2\u0440\u043d\3\2\2\2\u0441\u010a\3\2\2\2\u0442") 535 | buf.write("\u0444\7r\2\2\u0443\u0445\5\u0105\u0083\2\u0444\u0443") 536 | buf.write("\3\2\2\2\u0444\u0445\3\2\2\2\u0445\u0446\3\2\2\2\u0446") 537 | buf.write("\u044d\5\u0107\u0084\2\u0447\u0449\7R\2\2\u0448\u044a") 538 | buf.write("\5\u0105\u0083\2\u0449\u0448\3\2\2\2\u0449\u044a\3\2\2") 539 | buf.write("\2\u044a\u044b\3\2\2\2\u044b\u044d\5\u0107\u0084\2\u044c") 540 | buf.write("\u0442\3\2\2\2\u044c\u0447\3\2\2\2\u044d\u010c\3\2\2\2") 541 | buf.write("\u044e\u0450\5\u00f1y\2\u044f\u044e\3\2\2\2\u0450\u0451") 542 | buf.write("\3\2\2\2\u0451\u044f\3\2\2\2\u0451\u0452\3\2\2\2\u0452") 543 | buf.write("\u010e\3\2\2\2\u0453\u0454\t\r\2\2\u0454\u0110\3\2\2\2") 544 | buf.write("\u0455\u0456\7)\2\2\u0456\u0457\5\u0113\u008a\2\u0457") 545 | buf.write("\u0458\7)\2\2\u0458\u046c\3\2\2\2\u0459\u045a\7N\2\2\u045a") 546 | buf.write("\u045b\7)\2\2\u045b\u045c\3\2\2\2\u045c\u045d\5\u0113") 547 | buf.write("\u008a\2\u045d\u045e\7)\2\2\u045e\u046c\3\2\2\2\u045f") 548 | buf.write("\u0460\7w\2\2\u0460\u0461\7)\2\2\u0461\u0462\3\2\2\2\u0462") 549 | buf.write("\u0463\5\u0113\u008a\2\u0463\u0464\7)\2\2\u0464\u046c") 550 | buf.write("\3\2\2\2\u0465\u0466\7W\2\2\u0466\u0467\7)\2\2\u0467\u0468") 551 | buf.write("\3\2\2\2\u0468\u0469\5\u0113\u008a\2\u0469\u046a\7)\2") 552 | buf.write("\2\u046a\u046c\3\2\2\2\u046b\u0455\3\2\2\2\u046b\u0459") 553 | buf.write("\3\2\2\2\u046b\u045f\3\2\2\2\u046b\u0465\3\2\2\2\u046c") 554 | buf.write("\u0112\3\2\2\2\u046d\u046f\5\u0115\u008b\2\u046e\u046d") 555 | buf.write("\3\2\2\2\u046f\u0470\3\2\2\2\u0470\u046e\3\2\2\2\u0470") 556 | buf.write("\u0471\3\2\2\2\u0471\u0114\3\2\2\2\u0472\u0475\n\16\2") 557 | buf.write("\2\u0473\u0475\5\u0117\u008c\2\u0474\u0472\3\2\2\2\u0474") 558 | buf.write("\u0473\3\2\2\2\u0475\u0116\3\2\2\2\u0476\u047b\5\u0119") 559 | buf.write("\u008d\2\u0477\u047b\5\u011b\u008e\2\u0478\u047b\5\u011d") 560 | buf.write("\u008f\2\u0479\u047b\5\u00dbn\2\u047a\u0476\3\2\2\2\u047a") 561 | buf.write("\u0477\3\2\2\2\u047a\u0478\3\2\2\2\u047a\u0479\3\2\2\2") 562 | buf.write("\u047b\u0118\3\2\2\2\u047c\u047d\7^\2\2\u047d\u047e\t") 563 | buf.write("\17\2\2\u047e\u011a\3\2\2\2\u047f\u0480\7^\2\2\u0480\u048b") 564 | buf.write("\5\u00efx\2\u0481\u0482\7^\2\2\u0482\u0483\5\u00efx\2") 565 | buf.write("\u0483\u0484\5\u00efx\2\u0484\u048b\3\2\2\2\u0485\u0486") 566 | buf.write("\7^\2\2\u0486\u0487\5\u00efx\2\u0487\u0488\5\u00efx\2") 567 | buf.write("\u0488\u0489\5\u00efx\2\u0489\u048b\3\2\2\2\u048a\u047f") 568 | buf.write("\3\2\2\2\u048a\u0481\3\2\2\2\u048a\u0485\3\2\2\2\u048b") 569 | buf.write("\u011c\3\2\2\2\u048c\u048d\7^\2\2\u048d\u048e\7z\2\2\u048e") 570 | buf.write("\u0490\3\2\2\2\u048f\u0491\5\u00f1y\2\u0490\u048f\3\2") 571 | buf.write("\2\2\u0491\u0492\3\2\2\2\u0492\u0490\3\2\2\2\u0492\u0493") 572 | buf.write("\3\2\2\2\u0493\u011e\3\2\2\2\u0494\u0496\5\u0121\u0091") 573 | buf.write("\2\u0495\u0494\3\2\2\2\u0495\u0496\3\2\2\2\u0496\u0497") 574 | buf.write("\3\2\2\2\u0497\u0499\7$\2\2\u0498\u049a\5\u0123\u0092") 575 | buf.write("\2\u0499\u0498\3\2\2\2\u0499\u049a\3\2\2\2\u049a\u049b") 576 | buf.write("\3\2\2\2\u049b\u049c\7$\2\2\u049c\u0120\3\2\2\2\u049d") 577 | buf.write("\u049e\7w\2\2\u049e\u04a1\7:\2\2\u049f\u04a1\t\20\2\2") 578 | buf.write("\u04a0\u049d\3\2\2\2\u04a0\u049f\3\2\2\2\u04a1\u0122\3") 579 | buf.write("\2\2\2\u04a2\u04a4\5\u0125\u0093\2\u04a3\u04a2\3\2\2\2") 580 | buf.write("\u04a4\u04a5\3\2\2\2\u04a5\u04a3\3\2\2\2\u04a5\u04a6\3") 581 | buf.write("\2\2\2\u04a6\u0124\3\2\2\2\u04a7\u04af\n\21\2\2\u04a8") 582 | buf.write("\u04af\5\u0117\u008c\2\u04a9\u04aa\7^\2\2\u04aa\u04af") 583 | buf.write("\7\f\2\2\u04ab\u04ac\7^\2\2\u04ac\u04ad\7\17\2\2\u04ad") 584 | buf.write("\u04af\7\f\2\2\u04ae\u04a7\3\2\2\2\u04ae\u04a8\3\2\2\2") 585 | buf.write("\u04ae\u04a9\3\2\2\2\u04ae\u04ab\3\2\2\2\u04af\u0126\3") 586 | buf.write("\2\2\2\u04b0\u04b2\7%\2\2\u04b1\u04b3\5\u0133\u009a\2") 587 | buf.write("\u04b2\u04b1\3\2\2\2\u04b2\u04b3\3\2\2\2\u04b3\u04b4\3") 588 | buf.write("\2\2\2\u04b4\u04b5\7f\2\2\u04b5\u04b6\7g\2\2\u04b6\u04b7") 589 | buf.write("\7h\2\2\u04b7\u04b8\7k\2\2\u04b8\u04b9\7p\2\2\u04b9\u04ba") 590 | buf.write("\7g\2\2\u04ba\u04be\3\2\2\2\u04bb\u04bd\n\22\2\2\u04bc") 591 | buf.write("\u04bb\3\2\2\2\u04bd\u04c0\3\2\2\2\u04be\u04bc\3\2\2\2") 592 | buf.write("\u04be\u04bf\3\2\2\2\u04bf\u04c1\3\2\2\2\u04c0\u04be\3") 593 | buf.write("\2\2\2\u04c1\u04c2\b\u0094\2\2\u04c2\u0128\3\2\2\2\u04c3") 594 | buf.write("\u04c4\7%\2\2\u04c4\u04c5\7k\2\2\u04c5\u04c6\7p\2\2\u04c6") 595 | buf.write("\u04c7\7e\2\2\u04c7\u04c8\7n\2\2\u04c8\u04c9\7w\2\2\u04c9") 596 | buf.write("\u04ca\7f\2\2\u04ca\u04cb\7g\2\2\u04cb\u04cf\3\2\2\2\u04cc") 597 | buf.write("\u04ce\5\u0133\u009a\2\u04cd\u04cc\3\2\2\2\u04ce\u04d1") 598 | buf.write("\3\2\2\2\u04cf\u04cd\3\2\2\2\u04cf\u04d0\3\2\2\2\u04d0") 599 | buf.write("\u04d5\3\2\2\2\u04d1\u04cf\3\2\2\2\u04d2\u04d4\n\23\2") 600 | buf.write("\2\u04d3\u04d2\3\2\2\2\u04d4\u04d7\3\2\2\2\u04d5\u04d3") 601 | buf.write("\3\2\2\2\u04d5\u04d6\3\2\2\2\u04d6\u04d8\3\2\2\2\u04d7") 602 | buf.write("\u04d5\3\2\2\2\u04d8\u04d9\b\u0095\2\2\u04d9\u012a\3\2") 603 | buf.write("\2\2\u04da\u04db\7c\2\2\u04db\u04dc\7u\2\2\u04dc\u04dd") 604 | buf.write("\7o\2\2\u04dd\u04e1\3\2\2\2\u04de\u04e0\n\24\2\2\u04df") 605 | buf.write("\u04de\3\2\2\2\u04e0\u04e3\3\2\2\2\u04e1\u04df\3\2\2\2") 606 | buf.write("\u04e1\u04e2\3\2\2\2\u04e2\u04e4\3\2\2\2\u04e3\u04e1\3") 607 | buf.write("\2\2\2\u04e4\u04e8\7}\2\2\u04e5\u04e7\n\25\2\2\u04e6\u04e5") 608 | buf.write("\3\2\2\2\u04e7\u04ea\3\2\2\2\u04e8\u04e6\3\2\2\2\u04e8") 609 | buf.write("\u04e9\3\2\2\2\u04e9\u04eb\3\2\2\2\u04ea\u04e8\3\2\2\2") 610 | buf.write("\u04eb\u04ec\7\177\2\2\u04ec\u04ed\3\2\2\2\u04ed\u04ee") 611 | buf.write("\b\u0096\2\2\u04ee\u012c\3\2\2\2\u04ef\u04f0\7%\2\2\u04f0") 612 | buf.write("\u04f1\7n\2\2\u04f1\u04f2\7k\2\2\u04f2\u04f3\7p\2\2\u04f3") 613 | buf.write("\u04f4\7g\2\2\u04f4\u04f8\3\2\2\2\u04f5\u04f7\5\u0133") 614 | buf.write("\u009a\2\u04f6\u04f5\3\2\2\2\u04f7\u04fa\3\2\2\2\u04f8") 615 | buf.write("\u04f6\3\2\2\2\u04f8\u04f9\3\2\2\2\u04f9\u04fe\3\2\2\2") 616 | buf.write("\u04fa\u04f8\3\2\2\2\u04fb\u04fd\n\23\2\2\u04fc\u04fb") 617 | buf.write("\3\2\2\2\u04fd\u0500\3\2\2\2\u04fe\u04fc\3\2\2\2\u04fe") 618 | buf.write("\u04ff\3\2\2\2\u04ff\u0501\3\2\2\2\u0500\u04fe\3\2\2\2") 619 | buf.write("\u0501\u0502\b\u0097\2\2\u0502\u012e\3\2\2\2\u0503\u0505") 620 | buf.write("\7%\2\2\u0504\u0506\5\u0133\u009a\2\u0505\u0504\3\2\2") 621 | buf.write("\2\u0505\u0506\3\2\2\2\u0506\u0507\3\2\2\2\u0507\u0509") 622 | buf.write("\5\u00e5s\2\u0508\u050a\5\u0133\u009a\2\u0509\u0508\3") 623 | buf.write("\2\2\2\u0509\u050a\3\2\2\2\u050a\u050b\3\2\2\2\u050b\u050f") 624 | buf.write("\5\u011f\u0090\2\u050c\u050e\n\23\2\2\u050d\u050c\3\2") 625 | buf.write("\2\2\u050e\u0511\3\2\2\2\u050f\u050d\3\2\2\2\u050f\u0510") 626 | buf.write("\3\2\2\2\u0510\u0512\3\2\2\2\u0511\u050f\3\2\2\2\u0512") 627 | buf.write("\u0513\b\u0098\2\2\u0513\u0130\3\2\2\2\u0514\u0516\7%") 628 | buf.write("\2\2\u0515\u0517\5\u0133\u009a\2\u0516\u0515\3\2\2\2\u0516") 629 | buf.write("\u0517\3\2\2\2\u0517\u0518\3\2\2\2\u0518\u0519\7r\2\2") 630 | buf.write("\u0519\u051a\7t\2\2\u051a\u051b\7c\2\2\u051b\u051c\7i") 631 | buf.write("\2\2\u051c\u051d\7o\2\2\u051d\u051e\7c\2\2\u051e\u051f") 632 | buf.write("\3\2\2\2\u051f\u0523\5\u0133\u009a\2\u0520\u0522\n\23") 633 | buf.write("\2\2\u0521\u0520\3\2\2\2\u0522\u0525\3\2\2\2\u0523\u0521") 634 | buf.write("\3\2\2\2\u0523\u0524\3\2\2\2\u0524\u0526\3\2\2\2\u0525") 635 | buf.write("\u0523\3\2\2\2\u0526\u0527\b\u0099\2\2\u0527\u0132\3\2") 636 | buf.write("\2\2\u0528\u052a\t\26\2\2\u0529\u0528\3\2\2\2\u052a\u052b") 637 | buf.write("\3\2\2\2\u052b\u0529\3\2\2\2\u052b\u052c\3\2\2\2\u052c") 638 | buf.write("\u052d\3\2\2\2\u052d\u052e\b\u009a\2\2\u052e\u0134\3\2") 639 | buf.write("\2\2\u052f\u0531\7\17\2\2\u0530\u0532\7\f\2\2\u0531\u0530") 640 | buf.write("\3\2\2\2\u0531\u0532\3\2\2\2\u0532\u0535\3\2\2\2\u0533") 641 | buf.write("\u0535\7\f\2\2\u0534\u052f\3\2\2\2\u0534\u0533\3\2\2\2") 642 | buf.write("\u0535\u0536\3\2\2\2\u0536\u0537\b\u009b\2\2\u0537\u0136") 643 | buf.write("\3\2\2\2\u0538\u0539\7\61\2\2\u0539\u053a\7,\2\2\u053a") 644 | buf.write("\u053e\3\2\2\2\u053b\u053d\13\2\2\2\u053c\u053b\3\2\2") 645 | buf.write("\2\u053d\u0540\3\2\2\2\u053e\u053f\3\2\2\2\u053e\u053c") 646 | buf.write("\3\2\2\2\u053f\u0541\3\2\2\2\u0540\u053e\3\2\2\2\u0541") 647 | buf.write("\u0542\7,\2\2\u0542\u0543\7\61\2\2\u0543\u0544\3\2\2\2") 648 | buf.write("\u0544\u0545\b\u009c\2\2\u0545\u0138\3\2\2\2\u0546\u0547") 649 | buf.write("\7\61\2\2\u0547\u0548\7\61\2\2\u0548\u054c\3\2\2\2\u0549") 650 | buf.write("\u054b\n\23\2\2\u054a\u0549\3\2\2\2\u054b\u054e\3\2\2") 651 | buf.write("\2\u054c\u054a\3\2\2\2\u054c\u054d\3\2\2\2\u054d\u054f") 652 | buf.write("\3\2\2\2\u054e\u054c\3\2\2\2\u054f\u0550\b\u009d\2\2\u0550") 653 | buf.write("\u013a\3\2\2\2F\2\u038a\u038c\u0391\u03a1\u03ab\u03af") 654 | buf.write("\u03b3\u03b7\u03ba\u03c1\u03c7\u03ce\u03d5\u03e2\u03e9") 655 | buf.write("\u03ed\u03ef\u03f9\u03fd\u0401\u0404\u0409\u040b\u0411") 656 | buf.write("\u0417\u0419\u041c\u0423\u0427\u042c\u042f\u0436\u0439") 657 | buf.write("\u0440\u0444\u0449\u044c\u0451\u046b\u0470\u0474\u047a") 658 | buf.write("\u048a\u0492\u0495\u0499\u04a0\u04a5\u04ae\u04b2\u04be") 659 | buf.write("\u04cf\u04d5\u04e1\u04e8\u04f8\u04fe\u0505\u0509\u050f") 660 | buf.write("\u0516\u0523\u052b\u0531\u0534\u053e\u054c\3\b\2\2") 661 | return buf.getvalue() 662 | 663 | 664 | class CLexer(Lexer): 665 | 666 | atn = ATNDeserializer().deserialize(serializedATN()) 667 | 668 | decisionsToDFA = [ DFA(ds, i) for i, ds in enumerate(atn.decisionToState) ] 669 | 670 | T__0 = 1 671 | T__1 = 2 672 | T__2 = 3 673 | T__3 = 4 674 | T__4 = 5 675 | T__5 = 6 676 | T__6 = 7 677 | T__7 = 8 678 | T__8 = 9 679 | T__9 = 10 680 | T__10 = 11 681 | T__11 = 12 682 | T__12 = 13 683 | T__13 = 14 684 | Auto = 15 685 | Break = 16 686 | Case = 17 687 | Char = 18 688 | Const = 19 689 | Continue = 20 690 | Default = 21 691 | Do = 22 692 | Double = 23 693 | Else = 24 694 | Enum = 25 695 | Extern = 26 696 | Float = 27 697 | For = 28 698 | Goto = 29 699 | If = 30 700 | Inline = 31 701 | Int = 32 702 | Long = 33 703 | Register = 34 704 | Restrict = 35 705 | Return = 36 706 | Short = 37 707 | Signed = 38 708 | Sizeof = 39 709 | Static = 40 710 | Struct = 41 711 | Switch = 42 712 | Typedef = 43 713 | Union = 44 714 | Unsigned = 45 715 | Void = 46 716 | Volatile = 47 717 | While = 48 718 | Alignas = 49 719 | Alignof = 50 720 | Atomic = 51 721 | Bool = 52 722 | Complex = 53 723 | Generic = 54 724 | Imaginary = 55 725 | Noreturn = 56 726 | StaticAssert = 57 727 | ThreadLocal = 58 728 | LeftParen = 59 729 | RightParen = 60 730 | LeftBracket = 61 731 | RightBracket = 62 732 | LeftBrace = 63 733 | RightBrace = 64 734 | Less = 65 735 | LessEqual = 66 736 | Greater = 67 737 | GreaterEqual = 68 738 | LeftShift = 69 739 | RightShift = 70 740 | Plus = 71 741 | PlusPlus = 72 742 | Minus = 73 743 | MinusMinus = 74 744 | Star = 75 745 | Div = 76 746 | Mod = 77 747 | And = 78 748 | Or = 79 749 | AndAnd = 80 750 | OrOr = 81 751 | Caret = 82 752 | Not = 83 753 | Tilde = 84 754 | Question = 85 755 | Colon = 86 756 | Semi = 87 757 | Comma = 88 758 | Assign = 89 759 | StarAssign = 90 760 | DivAssign = 91 761 | ModAssign = 92 762 | PlusAssign = 93 763 | MinusAssign = 94 764 | LeftShiftAssign = 95 765 | RightShiftAssign = 96 766 | AndAssign = 97 767 | XorAssign = 98 768 | OrAssign = 99 769 | Equal = 100 770 | NotEqual = 101 771 | Arrow = 102 772 | Dot = 103 773 | Ellipsis = 104 774 | Identifier = 105 775 | Constant = 106 776 | DigitSequence = 107 777 | StringLiteral = 108 778 | ComplexDefine = 109 779 | Include = 110 780 | AsmBlock = 111 781 | LineAfterPreprocessing = 112 782 | LineDirective = 113 783 | PragmaDirective = 114 784 | Whitespace = 115 785 | Newline = 116 786 | BlockComment = 117 787 | LineComment = 118 788 | 789 | channelNames = [ u"DEFAULT_TOKEN_CHANNEL", u"HIDDEN" ] 790 | 791 | modeNames = [ "DEFAULT_MODE" ] 792 | 793 | literalNames = [ "", 794 | "'__extension__'", "'__builtin_va_arg'", "'__builtin_offsetof'", 795 | "'__m128'", "'__m128d'", "'__m128i'", "'__typeof__'", "'__inline__'", 796 | "'__stdcall'", "'__declspec'", "'__asm'", "'__attribute__'", 797 | "'__asm__'", "'__volatile__'", "'auto'", "'break'", "'case'", 798 | "'char'", "'const'", "'continue'", "'default'", "'do'", "'double'", 799 | "'else'", "'enum'", "'extern'", "'float'", "'for'", "'goto'", 800 | "'if'", "'inline'", "'int'", "'long'", "'register'", "'restrict'", 801 | "'return'", "'short'", "'signed'", "'sizeof'", "'static'", "'struct'", 802 | "'switch'", "'typedef'", "'union'", "'unsigned'", "'void'", 803 | "'volatile'", "'while'", "'_Alignas'", "'_Alignof'", "'_Atomic'", 804 | "'_Bool'", "'_Complex'", "'_Generic'", "'_Imaginary'", "'_Noreturn'", 805 | "'_Static_assert'", "'_Thread_local'", "'('", "')'", "'['", 806 | "']'", "'{'", "'}'", "'<'", "'<='", "'>'", "'>='", "'<<'", "'>>'", 807 | "'+'", "'++'", "'-'", "'--'", "'*'", "'/'", "'%'", "'&'", "'|'", 808 | "'&&'", "'||'", "'^'", "'!'", "'~'", "'?'", "':'", "';'", "','", 809 | "'='", "'*='", "'/='", "'%='", "'+='", "'-='", "'<<='", "'>>='", 810 | "'&='", "'^='", "'|='", "'=='", "'!='", "'->'", "'.'", "'...'" ] 811 | 812 | symbolicNames = [ "", 813 | "Auto", "Break", "Case", "Char", "Const", "Continue", "Default", 814 | "Do", "Double", "Else", "Enum", "Extern", "Float", "For", "Goto", 815 | "If", "Inline", "Int", "Long", "Register", "Restrict", "Return", 816 | "Short", "Signed", "Sizeof", "Static", "Struct", "Switch", "Typedef", 817 | "Union", "Unsigned", "Void", "Volatile", "While", "Alignas", 818 | "Alignof", "Atomic", "Bool", "Complex", "Generic", "Imaginary", 819 | "Noreturn", "StaticAssert", "ThreadLocal", "LeftParen", "RightParen", 820 | "LeftBracket", "RightBracket", "LeftBrace", "RightBrace", "Less", 821 | "LessEqual", "Greater", "GreaterEqual", "LeftShift", "RightShift", 822 | "Plus", "PlusPlus", "Minus", "MinusMinus", "Star", "Div", "Mod", 823 | "And", "Or", "AndAnd", "OrOr", "Caret", "Not", "Tilde", "Question", 824 | "Colon", "Semi", "Comma", "Assign", "StarAssign", "DivAssign", 825 | "ModAssign", "PlusAssign", "MinusAssign", "LeftShiftAssign", 826 | "RightShiftAssign", "AndAssign", "XorAssign", "OrAssign", "Equal", 827 | "NotEqual", "Arrow", "Dot", "Ellipsis", "Identifier", "Constant", 828 | "DigitSequence", "StringLiteral", "ComplexDefine", "Include", 829 | "AsmBlock", "LineAfterPreprocessing", "LineDirective", "PragmaDirective", 830 | "Whitespace", "Newline", "BlockComment", "LineComment" ] 831 | 832 | ruleNames = [ "T__0", "T__1", "T__2", "T__3", "T__4", "T__5", "T__6", 833 | "T__7", "T__8", "T__9", "T__10", "T__11", "T__12", "T__13", 834 | "Auto", "Break", "Case", "Char", "Const", "Continue", 835 | "Default", "Do", "Double", "Else", "Enum", "Extern", "Float", 836 | "For", "Goto", "If", "Inline", "Int", "Long", "Register", 837 | "Restrict", "Return", "Short", "Signed", "Sizeof", "Static", 838 | "Struct", "Switch", "Typedef", "Union", "Unsigned", "Void", 839 | "Volatile", "While", "Alignas", "Alignof", "Atomic", "Bool", 840 | "Complex", "Generic", "Imaginary", "Noreturn", "StaticAssert", 841 | "ThreadLocal", "LeftParen", "RightParen", "LeftBracket", 842 | "RightBracket", "LeftBrace", "RightBrace", "Less", "LessEqual", 843 | "Greater", "GreaterEqual", "LeftShift", "RightShift", 844 | "Plus", "PlusPlus", "Minus", "MinusMinus", "Star", "Div", 845 | "Mod", "And", "Or", "AndAnd", "OrOr", "Caret", "Not", 846 | "Tilde", "Question", "Colon", "Semi", "Comma", "Assign", 847 | "StarAssign", "DivAssign", "ModAssign", "PlusAssign", 848 | "MinusAssign", "LeftShiftAssign", "RightShiftAssign", 849 | "AndAssign", "XorAssign", "OrAssign", "Equal", "NotEqual", 850 | "Arrow", "Dot", "Ellipsis", "Identifier", "IdentifierNondigit", 851 | "Nondigit", "Digit", "UniversalCharacterName", "HexQuad", 852 | "Constant", "IntegerConstant", "BinaryConstant", "DecimalConstant", 853 | "OctalConstant", "HexadecimalConstant", "HexadecimalPrefix", 854 | "NonzeroDigit", "OctalDigit", "HexadecimalDigit", "IntegerSuffix", 855 | "UnsignedSuffix", "LongSuffix", "LongLongSuffix", "FloatingConstant", 856 | "DecimalFloatingConstant", "HexadecimalFloatingConstant", 857 | "FractionalConstant", "ExponentPart", "Sign", "DigitSequence", 858 | "HexadecimalFractionalConstant", "BinaryExponentPart", 859 | "HexadecimalDigitSequence", "FloatingSuffix", "CharacterConstant", 860 | "CCharSequence", "CChar", "EscapeSequence", "SimpleEscapeSequence", 861 | "OctalEscapeSequence", "HexadecimalEscapeSequence", "StringLiteral", 862 | "EncodingPrefix", "SCharSequence", "SChar", "ComplexDefine", 863 | "Include", "AsmBlock", "LineAfterPreprocessing", "LineDirective", 864 | "PragmaDirective", "Whitespace", "Newline", "BlockComment", 865 | "LineComment" ] 866 | 867 | grammarFileName = "C.g4" 868 | 869 | def __init__(self, input=None, output:TextIO = sys.stdout): 870 | super().__init__(input, output) 871 | self.checkVersion("4.7.2") 872 | self._interp = LexerATNSimulator(self, self.atn, self.decisionsToDFA, PredictionContextCache()) 873 | self._actions = None 874 | self._predicates = None 875 | 876 | 877 | -------------------------------------------------------------------------------- /parser_/CLexer.tokens: -------------------------------------------------------------------------------- 1 | T__0=1 2 | T__1=2 3 | T__2=3 4 | T__3=4 5 | T__4=5 6 | T__5=6 7 | T__6=7 8 | T__7=8 9 | T__8=9 10 | T__9=10 11 | T__10=11 12 | T__11=12 13 | T__12=13 14 | T__13=14 15 | Auto=15 16 | Break=16 17 | Case=17 18 | Char=18 19 | Const=19 20 | Continue=20 21 | Default=21 22 | Do=22 23 | Double=23 24 | Else=24 25 | Enum=25 26 | Extern=26 27 | Float=27 28 | For=28 29 | Goto=29 30 | If=30 31 | Inline=31 32 | Int=32 33 | Long=33 34 | Register=34 35 | Restrict=35 36 | Return=36 37 | Short=37 38 | Signed=38 39 | Sizeof=39 40 | Static=40 41 | Struct=41 42 | Switch=42 43 | Typedef=43 44 | Union=44 45 | Unsigned=45 46 | Void=46 47 | Volatile=47 48 | While=48 49 | Alignas=49 50 | Alignof=50 51 | Atomic=51 52 | Bool=52 53 | Complex=53 54 | Generic=54 55 | Imaginary=55 56 | Noreturn=56 57 | StaticAssert=57 58 | ThreadLocal=58 59 | LeftParen=59 60 | RightParen=60 61 | LeftBracket=61 62 | RightBracket=62 63 | LeftBrace=63 64 | RightBrace=64 65 | Less=65 66 | LessEqual=66 67 | Greater=67 68 | GreaterEqual=68 69 | LeftShift=69 70 | RightShift=70 71 | Plus=71 72 | PlusPlus=72 73 | Minus=73 74 | MinusMinus=74 75 | Star=75 76 | Div=76 77 | Mod=77 78 | And=78 79 | Or=79 80 | AndAnd=80 81 | OrOr=81 82 | Caret=82 83 | Not=83 84 | Tilde=84 85 | Question=85 86 | Colon=86 87 | Semi=87 88 | Comma=88 89 | Assign=89 90 | StarAssign=90 91 | DivAssign=91 92 | ModAssign=92 93 | PlusAssign=93 94 | MinusAssign=94 95 | LeftShiftAssign=95 96 | RightShiftAssign=96 97 | AndAssign=97 98 | XorAssign=98 99 | OrAssign=99 100 | Equal=100 101 | NotEqual=101 102 | Arrow=102 103 | Dot=103 104 | Ellipsis=104 105 | Identifier=105 106 | Constant=106 107 | DigitSequence=107 108 | StringLiteral=108 109 | ComplexDefine=109 110 | Include=110 111 | AsmBlock=111 112 | LineAfterPreprocessing=112 113 | LineDirective=113 114 | PragmaDirective=114 115 | Whitespace=115 116 | Newline=116 117 | BlockComment=117 118 | LineComment=118 119 | '__extension__'=1 120 | '__builtin_va_arg'=2 121 | '__builtin_offsetof'=3 122 | '__m128'=4 123 | '__m128d'=5 124 | '__m128i'=6 125 | '__typeof__'=7 126 | '__inline__'=8 127 | '__stdcall'=9 128 | '__declspec'=10 129 | '__asm'=11 130 | '__attribute__'=12 131 | '__asm__'=13 132 | '__volatile__'=14 133 | 'auto'=15 134 | 'break'=16 135 | 'case'=17 136 | 'char'=18 137 | 'const'=19 138 | 'continue'=20 139 | 'default'=21 140 | 'do'=22 141 | 'double'=23 142 | 'else'=24 143 | 'enum'=25 144 | 'extern'=26 145 | 'float'=27 146 | 'for'=28 147 | 'goto'=29 148 | 'if'=30 149 | 'inline'=31 150 | 'int'=32 151 | 'long'=33 152 | 'register'=34 153 | 'restrict'=35 154 | 'return'=36 155 | 'short'=37 156 | 'signed'=38 157 | 'sizeof'=39 158 | 'static'=40 159 | 'struct'=41 160 | 'switch'=42 161 | 'typedef'=43 162 | 'union'=44 163 | 'unsigned'=45 164 | 'void'=46 165 | 'volatile'=47 166 | 'while'=48 167 | '_Alignas'=49 168 | '_Alignof'=50 169 | '_Atomic'=51 170 | '_Bool'=52 171 | '_Complex'=53 172 | '_Generic'=54 173 | '_Imaginary'=55 174 | '_Noreturn'=56 175 | '_Static_assert'=57 176 | '_Thread_local'=58 177 | '('=59 178 | ')'=60 179 | '['=61 180 | ']'=62 181 | '{'=63 182 | '}'=64 183 | '<'=65 184 | '<='=66 185 | '>'=67 186 | '>='=68 187 | '<<'=69 188 | '>>'=70 189 | '+'=71 190 | '++'=72 191 | '-'=73 192 | '--'=74 193 | '*'=75 194 | '/'=76 195 | '%'=77 196 | '&'=78 197 | '|'=79 198 | '&&'=80 199 | '||'=81 200 | '^'=82 201 | '!'=83 202 | '~'=84 203 | '?'=85 204 | ':'=86 205 | ';'=87 206 | ','=88 207 | '='=89 208 | '*='=90 209 | '/='=91 210 | '%='=92 211 | '+='=93 212 | '-='=94 213 | '<<='=95 214 | '>>='=96 215 | '&='=97 216 | '^='=98 217 | '|='=99 218 | '=='=100 219 | '!='=101 220 | '->'=102 221 | '.'=103 222 | '...'=104 223 | -------------------------------------------------------------------------------- /parser_/CListener.py: -------------------------------------------------------------------------------- 1 | # Generated from D:/TinyCCompiler/parser_\C.g4 by ANTLR 4.7.2 2 | from antlr4 import * 3 | if __name__ is not None and "." in __name__: 4 | from .CParser import CParser 5 | else: 6 | from CParser import CParser 7 | 8 | # This class defines a complete listener for a parse tree produced by CParser. 9 | class CListener(ParseTreeListener): 10 | 11 | # Enter a parse tree produced by CParser#primaryExpression. 12 | def enterPrimaryExpression(self, ctx:CParser.PrimaryExpressionContext): 13 | pass 14 | 15 | # Exit a parse tree produced by CParser#primaryExpression. 16 | def exitPrimaryExpression(self, ctx:CParser.PrimaryExpressionContext): 17 | pass 18 | 19 | 20 | # Enter a parse tree produced by CParser#genericSelection. 21 | def enterGenericSelection(self, ctx:CParser.GenericSelectionContext): 22 | pass 23 | 24 | # Exit a parse tree produced by CParser#genericSelection. 25 | def exitGenericSelection(self, ctx:CParser.GenericSelectionContext): 26 | pass 27 | 28 | 29 | # Enter a parse tree produced by CParser#genericAssocList. 30 | def enterGenericAssocList(self, ctx:CParser.GenericAssocListContext): 31 | pass 32 | 33 | # Exit a parse tree produced by CParser#genericAssocList. 34 | def exitGenericAssocList(self, ctx:CParser.GenericAssocListContext): 35 | pass 36 | 37 | 38 | # Enter a parse tree produced by CParser#genericAssociation. 39 | def enterGenericAssociation(self, ctx:CParser.GenericAssociationContext): 40 | pass 41 | 42 | # Exit a parse tree produced by CParser#genericAssociation. 43 | def exitGenericAssociation(self, ctx:CParser.GenericAssociationContext): 44 | pass 45 | 46 | 47 | # Enter a parse tree produced by CParser#postfixExpression. 48 | def enterPostfixExpression(self, ctx:CParser.PostfixExpressionContext): 49 | pass 50 | 51 | # Exit a parse tree produced by CParser#postfixExpression. 52 | def exitPostfixExpression(self, ctx:CParser.PostfixExpressionContext): 53 | pass 54 | 55 | 56 | # Enter a parse tree produced by CParser#argumentExpressionList. 57 | def enterArgumentExpressionList(self, ctx:CParser.ArgumentExpressionListContext): 58 | pass 59 | 60 | # Exit a parse tree produced by CParser#argumentExpressionList. 61 | def exitArgumentExpressionList(self, ctx:CParser.ArgumentExpressionListContext): 62 | pass 63 | 64 | 65 | # Enter a parse tree produced by CParser#unaryExpression. 66 | def enterUnaryExpression(self, ctx:CParser.UnaryExpressionContext): 67 | pass 68 | 69 | # Exit a parse tree produced by CParser#unaryExpression. 70 | def exitUnaryExpression(self, ctx:CParser.UnaryExpressionContext): 71 | pass 72 | 73 | 74 | # Enter a parse tree produced by CParser#unaryOperator. 75 | def enterUnaryOperator(self, ctx:CParser.UnaryOperatorContext): 76 | pass 77 | 78 | # Exit a parse tree produced by CParser#unaryOperator. 79 | def exitUnaryOperator(self, ctx:CParser.UnaryOperatorContext): 80 | pass 81 | 82 | 83 | # Enter a parse tree produced by CParser#castExpression. 84 | def enterCastExpression(self, ctx:CParser.CastExpressionContext): 85 | pass 86 | 87 | # Exit a parse tree produced by CParser#castExpression. 88 | def exitCastExpression(self, ctx:CParser.CastExpressionContext): 89 | pass 90 | 91 | 92 | # Enter a parse tree produced by CParser#multiplicativeExpression. 93 | def enterMultiplicativeExpression(self, ctx:CParser.MultiplicativeExpressionContext): 94 | pass 95 | 96 | # Exit a parse tree produced by CParser#multiplicativeExpression. 97 | def exitMultiplicativeExpression(self, ctx:CParser.MultiplicativeExpressionContext): 98 | pass 99 | 100 | 101 | # Enter a parse tree produced by CParser#additiveExpression. 102 | def enterAdditiveExpression(self, ctx:CParser.AdditiveExpressionContext): 103 | pass 104 | 105 | # Exit a parse tree produced by CParser#additiveExpression. 106 | def exitAdditiveExpression(self, ctx:CParser.AdditiveExpressionContext): 107 | pass 108 | 109 | 110 | # Enter a parse tree produced by CParser#shiftExpression. 111 | def enterShiftExpression(self, ctx:CParser.ShiftExpressionContext): 112 | pass 113 | 114 | # Exit a parse tree produced by CParser#shiftExpression. 115 | def exitShiftExpression(self, ctx:CParser.ShiftExpressionContext): 116 | pass 117 | 118 | 119 | # Enter a parse tree produced by CParser#relationalExpression. 120 | def enterRelationalExpression(self, ctx:CParser.RelationalExpressionContext): 121 | pass 122 | 123 | # Exit a parse tree produced by CParser#relationalExpression. 124 | def exitRelationalExpression(self, ctx:CParser.RelationalExpressionContext): 125 | pass 126 | 127 | 128 | # Enter a parse tree produced by CParser#equalityExpression. 129 | def enterEqualityExpression(self, ctx:CParser.EqualityExpressionContext): 130 | pass 131 | 132 | # Exit a parse tree produced by CParser#equalityExpression. 133 | def exitEqualityExpression(self, ctx:CParser.EqualityExpressionContext): 134 | pass 135 | 136 | 137 | # Enter a parse tree produced by CParser#andExpression. 138 | def enterAndExpression(self, ctx:CParser.AndExpressionContext): 139 | pass 140 | 141 | # Exit a parse tree produced by CParser#andExpression. 142 | def exitAndExpression(self, ctx:CParser.AndExpressionContext): 143 | pass 144 | 145 | 146 | # Enter a parse tree produced by CParser#exclusiveOrExpression. 147 | def enterExclusiveOrExpression(self, ctx:CParser.ExclusiveOrExpressionContext): 148 | pass 149 | 150 | # Exit a parse tree produced by CParser#exclusiveOrExpression. 151 | def exitExclusiveOrExpression(self, ctx:CParser.ExclusiveOrExpressionContext): 152 | pass 153 | 154 | 155 | # Enter a parse tree produced by CParser#inclusiveOrExpression. 156 | def enterInclusiveOrExpression(self, ctx:CParser.InclusiveOrExpressionContext): 157 | pass 158 | 159 | # Exit a parse tree produced by CParser#inclusiveOrExpression. 160 | def exitInclusiveOrExpression(self, ctx:CParser.InclusiveOrExpressionContext): 161 | pass 162 | 163 | 164 | # Enter a parse tree produced by CParser#logicalAndExpression. 165 | def enterLogicalAndExpression(self, ctx:CParser.LogicalAndExpressionContext): 166 | pass 167 | 168 | # Exit a parse tree produced by CParser#logicalAndExpression. 169 | def exitLogicalAndExpression(self, ctx:CParser.LogicalAndExpressionContext): 170 | pass 171 | 172 | 173 | # Enter a parse tree produced by CParser#logicalOrExpression. 174 | def enterLogicalOrExpression(self, ctx:CParser.LogicalOrExpressionContext): 175 | pass 176 | 177 | # Exit a parse tree produced by CParser#logicalOrExpression. 178 | def exitLogicalOrExpression(self, ctx:CParser.LogicalOrExpressionContext): 179 | pass 180 | 181 | 182 | # Enter a parse tree produced by CParser#conditionalExpression. 183 | def enterConditionalExpression(self, ctx:CParser.ConditionalExpressionContext): 184 | pass 185 | 186 | # Exit a parse tree produced by CParser#conditionalExpression. 187 | def exitConditionalExpression(self, ctx:CParser.ConditionalExpressionContext): 188 | pass 189 | 190 | 191 | # Enter a parse tree produced by CParser#assignmentExpression. 192 | def enterAssignmentExpression(self, ctx:CParser.AssignmentExpressionContext): 193 | pass 194 | 195 | # Exit a parse tree produced by CParser#assignmentExpression. 196 | def exitAssignmentExpression(self, ctx:CParser.AssignmentExpressionContext): 197 | pass 198 | 199 | 200 | # Enter a parse tree produced by CParser#assignmentOperator. 201 | def enterAssignmentOperator(self, ctx:CParser.AssignmentOperatorContext): 202 | pass 203 | 204 | # Exit a parse tree produced by CParser#assignmentOperator. 205 | def exitAssignmentOperator(self, ctx:CParser.AssignmentOperatorContext): 206 | pass 207 | 208 | 209 | # Enter a parse tree produced by CParser#expression. 210 | def enterExpression(self, ctx:CParser.ExpressionContext): 211 | pass 212 | 213 | # Exit a parse tree produced by CParser#expression. 214 | def exitExpression(self, ctx:CParser.ExpressionContext): 215 | pass 216 | 217 | 218 | # Enter a parse tree produced by CParser#constantExpression. 219 | def enterConstantExpression(self, ctx:CParser.ConstantExpressionContext): 220 | pass 221 | 222 | # Exit a parse tree produced by CParser#constantExpression. 223 | def exitConstantExpression(self, ctx:CParser.ConstantExpressionContext): 224 | pass 225 | 226 | 227 | # Enter a parse tree produced by CParser#declaration. 228 | def enterDeclaration(self, ctx:CParser.DeclarationContext): 229 | pass 230 | 231 | # Exit a parse tree produced by CParser#declaration. 232 | def exitDeclaration(self, ctx:CParser.DeclarationContext): 233 | pass 234 | 235 | 236 | # Enter a parse tree produced by CParser#declarationSpecifiers. 237 | def enterDeclarationSpecifiers(self, ctx:CParser.DeclarationSpecifiersContext): 238 | pass 239 | 240 | # Exit a parse tree produced by CParser#declarationSpecifiers. 241 | def exitDeclarationSpecifiers(self, ctx:CParser.DeclarationSpecifiersContext): 242 | pass 243 | 244 | 245 | # Enter a parse tree produced by CParser#declarationSpecifiers2. 246 | def enterDeclarationSpecifiers2(self, ctx:CParser.DeclarationSpecifiers2Context): 247 | pass 248 | 249 | # Exit a parse tree produced by CParser#declarationSpecifiers2. 250 | def exitDeclarationSpecifiers2(self, ctx:CParser.DeclarationSpecifiers2Context): 251 | pass 252 | 253 | 254 | # Enter a parse tree produced by CParser#declarationSpecifier. 255 | def enterDeclarationSpecifier(self, ctx:CParser.DeclarationSpecifierContext): 256 | pass 257 | 258 | # Exit a parse tree produced by CParser#declarationSpecifier. 259 | def exitDeclarationSpecifier(self, ctx:CParser.DeclarationSpecifierContext): 260 | pass 261 | 262 | 263 | # Enter a parse tree produced by CParser#initDeclaratorList. 264 | def enterInitDeclaratorList(self, ctx:CParser.InitDeclaratorListContext): 265 | pass 266 | 267 | # Exit a parse tree produced by CParser#initDeclaratorList. 268 | def exitInitDeclaratorList(self, ctx:CParser.InitDeclaratorListContext): 269 | pass 270 | 271 | 272 | # Enter a parse tree produced by CParser#initDeclarator. 273 | def enterInitDeclarator(self, ctx:CParser.InitDeclaratorContext): 274 | pass 275 | 276 | # Exit a parse tree produced by CParser#initDeclarator. 277 | def exitInitDeclarator(self, ctx:CParser.InitDeclaratorContext): 278 | pass 279 | 280 | 281 | # Enter a parse tree produced by CParser#storageClassSpecifier. 282 | def enterStorageClassSpecifier(self, ctx:CParser.StorageClassSpecifierContext): 283 | pass 284 | 285 | # Exit a parse tree produced by CParser#storageClassSpecifier. 286 | def exitStorageClassSpecifier(self, ctx:CParser.StorageClassSpecifierContext): 287 | pass 288 | 289 | 290 | # Enter a parse tree produced by CParser#typeSpecifier. 291 | def enterTypeSpecifier(self, ctx:CParser.TypeSpecifierContext): 292 | pass 293 | 294 | # Exit a parse tree produced by CParser#typeSpecifier. 295 | def exitTypeSpecifier(self, ctx:CParser.TypeSpecifierContext): 296 | pass 297 | 298 | 299 | # Enter a parse tree produced by CParser#structOrUnionSpecifier. 300 | def enterStructOrUnionSpecifier(self, ctx:CParser.StructOrUnionSpecifierContext): 301 | pass 302 | 303 | # Exit a parse tree produced by CParser#structOrUnionSpecifier. 304 | def exitStructOrUnionSpecifier(self, ctx:CParser.StructOrUnionSpecifierContext): 305 | pass 306 | 307 | 308 | # Enter a parse tree produced by CParser#structOrUnion. 309 | def enterStructOrUnion(self, ctx:CParser.StructOrUnionContext): 310 | pass 311 | 312 | # Exit a parse tree produced by CParser#structOrUnion. 313 | def exitStructOrUnion(self, ctx:CParser.StructOrUnionContext): 314 | pass 315 | 316 | 317 | # Enter a parse tree produced by CParser#structDeclarationList. 318 | def enterStructDeclarationList(self, ctx:CParser.StructDeclarationListContext): 319 | pass 320 | 321 | # Exit a parse tree produced by CParser#structDeclarationList. 322 | def exitStructDeclarationList(self, ctx:CParser.StructDeclarationListContext): 323 | pass 324 | 325 | 326 | # Enter a parse tree produced by CParser#structDeclaration. 327 | def enterStructDeclaration(self, ctx:CParser.StructDeclarationContext): 328 | pass 329 | 330 | # Exit a parse tree produced by CParser#structDeclaration. 331 | def exitStructDeclaration(self, ctx:CParser.StructDeclarationContext): 332 | pass 333 | 334 | 335 | # Enter a parse tree produced by CParser#specifierQualifierList. 336 | def enterSpecifierQualifierList(self, ctx:CParser.SpecifierQualifierListContext): 337 | pass 338 | 339 | # Exit a parse tree produced by CParser#specifierQualifierList. 340 | def exitSpecifierQualifierList(self, ctx:CParser.SpecifierQualifierListContext): 341 | pass 342 | 343 | 344 | # Enter a parse tree produced by CParser#structDeclaratorList. 345 | def enterStructDeclaratorList(self, ctx:CParser.StructDeclaratorListContext): 346 | pass 347 | 348 | # Exit a parse tree produced by CParser#structDeclaratorList. 349 | def exitStructDeclaratorList(self, ctx:CParser.StructDeclaratorListContext): 350 | pass 351 | 352 | 353 | # Enter a parse tree produced by CParser#structDeclarator. 354 | def enterStructDeclarator(self, ctx:CParser.StructDeclaratorContext): 355 | pass 356 | 357 | # Exit a parse tree produced by CParser#structDeclarator. 358 | def exitStructDeclarator(self, ctx:CParser.StructDeclaratorContext): 359 | pass 360 | 361 | 362 | # Enter a parse tree produced by CParser#enumSpecifier. 363 | def enterEnumSpecifier(self, ctx:CParser.EnumSpecifierContext): 364 | pass 365 | 366 | # Exit a parse tree produced by CParser#enumSpecifier. 367 | def exitEnumSpecifier(self, ctx:CParser.EnumSpecifierContext): 368 | pass 369 | 370 | 371 | # Enter a parse tree produced by CParser#enumeratorList. 372 | def enterEnumeratorList(self, ctx:CParser.EnumeratorListContext): 373 | pass 374 | 375 | # Exit a parse tree produced by CParser#enumeratorList. 376 | def exitEnumeratorList(self, ctx:CParser.EnumeratorListContext): 377 | pass 378 | 379 | 380 | # Enter a parse tree produced by CParser#enumerator. 381 | def enterEnumerator(self, ctx:CParser.EnumeratorContext): 382 | pass 383 | 384 | # Exit a parse tree produced by CParser#enumerator. 385 | def exitEnumerator(self, ctx:CParser.EnumeratorContext): 386 | pass 387 | 388 | 389 | # Enter a parse tree produced by CParser#enumerationConstant. 390 | def enterEnumerationConstant(self, ctx:CParser.EnumerationConstantContext): 391 | pass 392 | 393 | # Exit a parse tree produced by CParser#enumerationConstant. 394 | def exitEnumerationConstant(self, ctx:CParser.EnumerationConstantContext): 395 | pass 396 | 397 | 398 | # Enter a parse tree produced by CParser#atomicTypeSpecifier. 399 | def enterAtomicTypeSpecifier(self, ctx:CParser.AtomicTypeSpecifierContext): 400 | pass 401 | 402 | # Exit a parse tree produced by CParser#atomicTypeSpecifier. 403 | def exitAtomicTypeSpecifier(self, ctx:CParser.AtomicTypeSpecifierContext): 404 | pass 405 | 406 | 407 | # Enter a parse tree produced by CParser#typeQualifier. 408 | def enterTypeQualifier(self, ctx:CParser.TypeQualifierContext): 409 | pass 410 | 411 | # Exit a parse tree produced by CParser#typeQualifier. 412 | def exitTypeQualifier(self, ctx:CParser.TypeQualifierContext): 413 | pass 414 | 415 | 416 | # Enter a parse tree produced by CParser#functionSpecifier. 417 | def enterFunctionSpecifier(self, ctx:CParser.FunctionSpecifierContext): 418 | pass 419 | 420 | # Exit a parse tree produced by CParser#functionSpecifier. 421 | def exitFunctionSpecifier(self, ctx:CParser.FunctionSpecifierContext): 422 | pass 423 | 424 | 425 | # Enter a parse tree produced by CParser#alignmentSpecifier. 426 | def enterAlignmentSpecifier(self, ctx:CParser.AlignmentSpecifierContext): 427 | pass 428 | 429 | # Exit a parse tree produced by CParser#alignmentSpecifier. 430 | def exitAlignmentSpecifier(self, ctx:CParser.AlignmentSpecifierContext): 431 | pass 432 | 433 | 434 | # Enter a parse tree produced by CParser#declarator. 435 | def enterDeclarator(self, ctx:CParser.DeclaratorContext): 436 | pass 437 | 438 | # Exit a parse tree produced by CParser#declarator. 439 | def exitDeclarator(self, ctx:CParser.DeclaratorContext): 440 | pass 441 | 442 | 443 | # Enter a parse tree produced by CParser#directDeclarator. 444 | def enterDirectDeclarator(self, ctx:CParser.DirectDeclaratorContext): 445 | pass 446 | 447 | # Exit a parse tree produced by CParser#directDeclarator. 448 | def exitDirectDeclarator(self, ctx:CParser.DirectDeclaratorContext): 449 | pass 450 | 451 | 452 | # Enter a parse tree produced by CParser#gccDeclaratorExtension. 453 | def enterGccDeclaratorExtension(self, ctx:CParser.GccDeclaratorExtensionContext): 454 | pass 455 | 456 | # Exit a parse tree produced by CParser#gccDeclaratorExtension. 457 | def exitGccDeclaratorExtension(self, ctx:CParser.GccDeclaratorExtensionContext): 458 | pass 459 | 460 | 461 | # Enter a parse tree produced by CParser#gccAttributeSpecifier. 462 | def enterGccAttributeSpecifier(self, ctx:CParser.GccAttributeSpecifierContext): 463 | pass 464 | 465 | # Exit a parse tree produced by CParser#gccAttributeSpecifier. 466 | def exitGccAttributeSpecifier(self, ctx:CParser.GccAttributeSpecifierContext): 467 | pass 468 | 469 | 470 | # Enter a parse tree produced by CParser#gccAttributeList. 471 | def enterGccAttributeList(self, ctx:CParser.GccAttributeListContext): 472 | pass 473 | 474 | # Exit a parse tree produced by CParser#gccAttributeList. 475 | def exitGccAttributeList(self, ctx:CParser.GccAttributeListContext): 476 | pass 477 | 478 | 479 | # Enter a parse tree produced by CParser#gccAttribute. 480 | def enterGccAttribute(self, ctx:CParser.GccAttributeContext): 481 | pass 482 | 483 | # Exit a parse tree produced by CParser#gccAttribute. 484 | def exitGccAttribute(self, ctx:CParser.GccAttributeContext): 485 | pass 486 | 487 | 488 | # Enter a parse tree produced by CParser#nestedParenthesesBlock. 489 | def enterNestedParenthesesBlock(self, ctx:CParser.NestedParenthesesBlockContext): 490 | pass 491 | 492 | # Exit a parse tree produced by CParser#nestedParenthesesBlock. 493 | def exitNestedParenthesesBlock(self, ctx:CParser.NestedParenthesesBlockContext): 494 | pass 495 | 496 | 497 | # Enter a parse tree produced by CParser#pointer. 498 | def enterPointer(self, ctx:CParser.PointerContext): 499 | pass 500 | 501 | # Exit a parse tree produced by CParser#pointer. 502 | def exitPointer(self, ctx:CParser.PointerContext): 503 | pass 504 | 505 | 506 | # Enter a parse tree produced by CParser#typeQualifierList. 507 | def enterTypeQualifierList(self, ctx:CParser.TypeQualifierListContext): 508 | pass 509 | 510 | # Exit a parse tree produced by CParser#typeQualifierList. 511 | def exitTypeQualifierList(self, ctx:CParser.TypeQualifierListContext): 512 | pass 513 | 514 | 515 | # Enter a parse tree produced by CParser#parameterTypeList. 516 | def enterParameterTypeList(self, ctx:CParser.ParameterTypeListContext): 517 | pass 518 | 519 | # Exit a parse tree produced by CParser#parameterTypeList. 520 | def exitParameterTypeList(self, ctx:CParser.ParameterTypeListContext): 521 | pass 522 | 523 | 524 | # Enter a parse tree produced by CParser#parameterList. 525 | def enterParameterList(self, ctx:CParser.ParameterListContext): 526 | pass 527 | 528 | # Exit a parse tree produced by CParser#parameterList. 529 | def exitParameterList(self, ctx:CParser.ParameterListContext): 530 | pass 531 | 532 | 533 | # Enter a parse tree produced by CParser#parameterDeclaration. 534 | def enterParameterDeclaration(self, ctx:CParser.ParameterDeclarationContext): 535 | pass 536 | 537 | # Exit a parse tree produced by CParser#parameterDeclaration. 538 | def exitParameterDeclaration(self, ctx:CParser.ParameterDeclarationContext): 539 | pass 540 | 541 | 542 | # Enter a parse tree produced by CParser#identifierList. 543 | def enterIdentifierList(self, ctx:CParser.IdentifierListContext): 544 | pass 545 | 546 | # Exit a parse tree produced by CParser#identifierList. 547 | def exitIdentifierList(self, ctx:CParser.IdentifierListContext): 548 | pass 549 | 550 | 551 | # Enter a parse tree produced by CParser#typeName. 552 | def enterTypeName(self, ctx:CParser.TypeNameContext): 553 | pass 554 | 555 | # Exit a parse tree produced by CParser#typeName. 556 | def exitTypeName(self, ctx:CParser.TypeNameContext): 557 | pass 558 | 559 | 560 | # Enter a parse tree produced by CParser#abstractDeclarator. 561 | def enterAbstractDeclarator(self, ctx:CParser.AbstractDeclaratorContext): 562 | pass 563 | 564 | # Exit a parse tree produced by CParser#abstractDeclarator. 565 | def exitAbstractDeclarator(self, ctx:CParser.AbstractDeclaratorContext): 566 | pass 567 | 568 | 569 | # Enter a parse tree produced by CParser#directAbstractDeclarator. 570 | def enterDirectAbstractDeclarator(self, ctx:CParser.DirectAbstractDeclaratorContext): 571 | pass 572 | 573 | # Exit a parse tree produced by CParser#directAbstractDeclarator. 574 | def exitDirectAbstractDeclarator(self, ctx:CParser.DirectAbstractDeclaratorContext): 575 | pass 576 | 577 | 578 | # Enter a parse tree produced by CParser#typedefName. 579 | def enterTypedefName(self, ctx:CParser.TypedefNameContext): 580 | pass 581 | 582 | # Exit a parse tree produced by CParser#typedefName. 583 | def exitTypedefName(self, ctx:CParser.TypedefNameContext): 584 | pass 585 | 586 | 587 | # Enter a parse tree produced by CParser#initializer. 588 | def enterInitializer(self, ctx:CParser.InitializerContext): 589 | pass 590 | 591 | # Exit a parse tree produced by CParser#initializer. 592 | def exitInitializer(self, ctx:CParser.InitializerContext): 593 | pass 594 | 595 | 596 | # Enter a parse tree produced by CParser#initializerList. 597 | def enterInitializerList(self, ctx:CParser.InitializerListContext): 598 | pass 599 | 600 | # Exit a parse tree produced by CParser#initializerList. 601 | def exitInitializerList(self, ctx:CParser.InitializerListContext): 602 | pass 603 | 604 | 605 | # Enter a parse tree produced by CParser#designation. 606 | def enterDesignation(self, ctx:CParser.DesignationContext): 607 | pass 608 | 609 | # Exit a parse tree produced by CParser#designation. 610 | def exitDesignation(self, ctx:CParser.DesignationContext): 611 | pass 612 | 613 | 614 | # Enter a parse tree produced by CParser#designatorList. 615 | def enterDesignatorList(self, ctx:CParser.DesignatorListContext): 616 | pass 617 | 618 | # Exit a parse tree produced by CParser#designatorList. 619 | def exitDesignatorList(self, ctx:CParser.DesignatorListContext): 620 | pass 621 | 622 | 623 | # Enter a parse tree produced by CParser#designator. 624 | def enterDesignator(self, ctx:CParser.DesignatorContext): 625 | pass 626 | 627 | # Exit a parse tree produced by CParser#designator. 628 | def exitDesignator(self, ctx:CParser.DesignatorContext): 629 | pass 630 | 631 | 632 | # Enter a parse tree produced by CParser#staticAssertDeclaration. 633 | def enterStaticAssertDeclaration(self, ctx:CParser.StaticAssertDeclarationContext): 634 | pass 635 | 636 | # Exit a parse tree produced by CParser#staticAssertDeclaration. 637 | def exitStaticAssertDeclaration(self, ctx:CParser.StaticAssertDeclarationContext): 638 | pass 639 | 640 | 641 | # Enter a parse tree produced by CParser#statement. 642 | def enterStatement(self, ctx:CParser.StatementContext): 643 | pass 644 | 645 | # Exit a parse tree produced by CParser#statement. 646 | def exitStatement(self, ctx:CParser.StatementContext): 647 | pass 648 | 649 | 650 | # Enter a parse tree produced by CParser#labeledStatement. 651 | def enterLabeledStatement(self, ctx:CParser.LabeledStatementContext): 652 | pass 653 | 654 | # Exit a parse tree produced by CParser#labeledStatement. 655 | def exitLabeledStatement(self, ctx:CParser.LabeledStatementContext): 656 | pass 657 | 658 | 659 | # Enter a parse tree produced by CParser#compoundStatement. 660 | def enterCompoundStatement(self, ctx:CParser.CompoundStatementContext): 661 | pass 662 | 663 | # Exit a parse tree produced by CParser#compoundStatement. 664 | def exitCompoundStatement(self, ctx:CParser.CompoundStatementContext): 665 | pass 666 | 667 | 668 | # Enter a parse tree produced by CParser#blockItemList. 669 | def enterBlockItemList(self, ctx:CParser.BlockItemListContext): 670 | pass 671 | 672 | # Exit a parse tree produced by CParser#blockItemList. 673 | def exitBlockItemList(self, ctx:CParser.BlockItemListContext): 674 | pass 675 | 676 | 677 | # Enter a parse tree produced by CParser#blockItem. 678 | def enterBlockItem(self, ctx:CParser.BlockItemContext): 679 | pass 680 | 681 | # Exit a parse tree produced by CParser#blockItem. 682 | def exitBlockItem(self, ctx:CParser.BlockItemContext): 683 | pass 684 | 685 | 686 | # Enter a parse tree produced by CParser#expressionStatement. 687 | def enterExpressionStatement(self, ctx:CParser.ExpressionStatementContext): 688 | pass 689 | 690 | # Exit a parse tree produced by CParser#expressionStatement. 691 | def exitExpressionStatement(self, ctx:CParser.ExpressionStatementContext): 692 | pass 693 | 694 | 695 | # Enter a parse tree produced by CParser#selectionStatement. 696 | def enterSelectionStatement(self, ctx:CParser.SelectionStatementContext): 697 | pass 698 | 699 | # Exit a parse tree produced by CParser#selectionStatement. 700 | def exitSelectionStatement(self, ctx:CParser.SelectionStatementContext): 701 | pass 702 | 703 | 704 | # Enter a parse tree produced by CParser#iterationStatement. 705 | def enterIterationStatement(self, ctx:CParser.IterationStatementContext): 706 | pass 707 | 708 | # Exit a parse tree produced by CParser#iterationStatement. 709 | def exitIterationStatement(self, ctx:CParser.IterationStatementContext): 710 | pass 711 | 712 | 713 | # Enter a parse tree produced by CParser#forCondition. 714 | def enterForCondition(self, ctx:CParser.ForConditionContext): 715 | pass 716 | 717 | # Exit a parse tree produced by CParser#forCondition. 718 | def exitForCondition(self, ctx:CParser.ForConditionContext): 719 | pass 720 | 721 | 722 | # Enter a parse tree produced by CParser#forDeclaration. 723 | def enterForDeclaration(self, ctx:CParser.ForDeclarationContext): 724 | pass 725 | 726 | # Exit a parse tree produced by CParser#forDeclaration. 727 | def exitForDeclaration(self, ctx:CParser.ForDeclarationContext): 728 | pass 729 | 730 | 731 | # Enter a parse tree produced by CParser#forExpression. 732 | def enterForExpression(self, ctx:CParser.ForExpressionContext): 733 | pass 734 | 735 | # Exit a parse tree produced by CParser#forExpression. 736 | def exitForExpression(self, ctx:CParser.ForExpressionContext): 737 | pass 738 | 739 | 740 | # Enter a parse tree produced by CParser#jumpStatement. 741 | def enterJumpStatement(self, ctx:CParser.JumpStatementContext): 742 | pass 743 | 744 | # Exit a parse tree produced by CParser#jumpStatement. 745 | def exitJumpStatement(self, ctx:CParser.JumpStatementContext): 746 | pass 747 | 748 | 749 | # Enter a parse tree produced by CParser#compilationUnit. 750 | def enterCompilationUnit(self, ctx:CParser.CompilationUnitContext): 751 | pass 752 | 753 | # Exit a parse tree produced by CParser#compilationUnit. 754 | def exitCompilationUnit(self, ctx:CParser.CompilationUnitContext): 755 | pass 756 | 757 | 758 | # Enter a parse tree produced by CParser#translationUnit. 759 | def enterTranslationUnit(self, ctx:CParser.TranslationUnitContext): 760 | pass 761 | 762 | # Exit a parse tree produced by CParser#translationUnit. 763 | def exitTranslationUnit(self, ctx:CParser.TranslationUnitContext): 764 | pass 765 | 766 | 767 | # Enter a parse tree produced by CParser#externalDeclaration. 768 | def enterExternalDeclaration(self, ctx:CParser.ExternalDeclarationContext): 769 | pass 770 | 771 | # Exit a parse tree produced by CParser#externalDeclaration. 772 | def exitExternalDeclaration(self, ctx:CParser.ExternalDeclarationContext): 773 | pass 774 | 775 | 776 | # Enter a parse tree produced by CParser#functionDefinition. 777 | def enterFunctionDefinition(self, ctx:CParser.FunctionDefinitionContext): 778 | pass 779 | 780 | # Exit a parse tree produced by CParser#functionDefinition. 781 | def exitFunctionDefinition(self, ctx:CParser.FunctionDefinitionContext): 782 | pass 783 | 784 | 785 | # Enter a parse tree produced by CParser#declarationList. 786 | def enterDeclarationList(self, ctx:CParser.DeclarationListContext): 787 | pass 788 | 789 | # Exit a parse tree produced by CParser#declarationList. 790 | def exitDeclarationList(self, ctx:CParser.DeclarationListContext): 791 | pass 792 | 793 | 794 | -------------------------------------------------------------------------------- /parser_/CVisitor.py: -------------------------------------------------------------------------------- 1 | # Generated from D:/TinyCCompiler/parser_\C.g4 by ANTLR 4.7.2 2 | from antlr4 import * 3 | if __name__ is not None and "." in __name__: 4 | from .CParser import CParser 5 | else: 6 | from CParser import CParser 7 | 8 | # This class defines a complete generic visitor for a parse tree produced by CParser. 9 | 10 | class CVisitor(ParseTreeVisitor): 11 | 12 | # Visit a parse tree produced by CParser#primaryExpression. 13 | def visitPrimaryExpression(self, ctx:CParser.PrimaryExpressionContext): 14 | return self.visitChildren(ctx) 15 | 16 | 17 | # Visit a parse tree produced by CParser#genericSelection. 18 | def visitGenericSelection(self, ctx:CParser.GenericSelectionContext): 19 | return self.visitChildren(ctx) 20 | 21 | 22 | # Visit a parse tree produced by CParser#genericAssocList. 23 | def visitGenericAssocList(self, ctx:CParser.GenericAssocListContext): 24 | return self.visitChildren(ctx) 25 | 26 | 27 | # Visit a parse tree produced by CParser#genericAssociation. 28 | def visitGenericAssociation(self, ctx:CParser.GenericAssociationContext): 29 | return self.visitChildren(ctx) 30 | 31 | 32 | # Visit a parse tree produced by CParser#postfixExpression. 33 | def visitPostfixExpression(self, ctx:CParser.PostfixExpressionContext): 34 | return self.visitChildren(ctx) 35 | 36 | 37 | # Visit a parse tree produced by CParser#argumentExpressionList. 38 | def visitArgumentExpressionList(self, ctx:CParser.ArgumentExpressionListContext): 39 | return self.visitChildren(ctx) 40 | 41 | 42 | # Visit a parse tree produced by CParser#unaryExpression. 43 | def visitUnaryExpression(self, ctx:CParser.UnaryExpressionContext): 44 | return self.visitChildren(ctx) 45 | 46 | 47 | # Visit a parse tree produced by CParser#unaryOperator. 48 | def visitUnaryOperator(self, ctx:CParser.UnaryOperatorContext): 49 | return self.visitChildren(ctx) 50 | 51 | 52 | # Visit a parse tree produced by CParser#castExpression. 53 | def visitCastExpression(self, ctx:CParser.CastExpressionContext): 54 | return self.visitChildren(ctx) 55 | 56 | 57 | # Visit a parse tree produced by CParser#multiplicativeExpression. 58 | def visitMultiplicativeExpression(self, ctx:CParser.MultiplicativeExpressionContext): 59 | return self.visitChildren(ctx) 60 | 61 | 62 | # Visit a parse tree produced by CParser#additiveExpression. 63 | def visitAdditiveExpression(self, ctx:CParser.AdditiveExpressionContext): 64 | return self.visitChildren(ctx) 65 | 66 | 67 | # Visit a parse tree produced by CParser#shiftExpression. 68 | def visitShiftExpression(self, ctx:CParser.ShiftExpressionContext): 69 | return self.visitChildren(ctx) 70 | 71 | 72 | # Visit a parse tree produced by CParser#relationalExpression. 73 | def visitRelationalExpression(self, ctx:CParser.RelationalExpressionContext): 74 | return self.visitChildren(ctx) 75 | 76 | 77 | # Visit a parse tree produced by CParser#equalityExpression. 78 | def visitEqualityExpression(self, ctx:CParser.EqualityExpressionContext): 79 | return self.visitChildren(ctx) 80 | 81 | 82 | # Visit a parse tree produced by CParser#andExpression. 83 | def visitAndExpression(self, ctx:CParser.AndExpressionContext): 84 | return self.visitChildren(ctx) 85 | 86 | 87 | # Visit a parse tree produced by CParser#exclusiveOrExpression. 88 | def visitExclusiveOrExpression(self, ctx:CParser.ExclusiveOrExpressionContext): 89 | return self.visitChildren(ctx) 90 | 91 | 92 | # Visit a parse tree produced by CParser#inclusiveOrExpression. 93 | def visitInclusiveOrExpression(self, ctx:CParser.InclusiveOrExpressionContext): 94 | return self.visitChildren(ctx) 95 | 96 | 97 | # Visit a parse tree produced by CParser#logicalAndExpression. 98 | def visitLogicalAndExpression(self, ctx:CParser.LogicalAndExpressionContext): 99 | return self.visitChildren(ctx) 100 | 101 | 102 | # Visit a parse tree produced by CParser#logicalOrExpression. 103 | def visitLogicalOrExpression(self, ctx:CParser.LogicalOrExpressionContext): 104 | return self.visitChildren(ctx) 105 | 106 | 107 | # Visit a parse tree produced by CParser#conditionalExpression. 108 | def visitConditionalExpression(self, ctx:CParser.ConditionalExpressionContext): 109 | return self.visitChildren(ctx) 110 | 111 | 112 | # Visit a parse tree produced by CParser#assignmentExpression. 113 | def visitAssignmentExpression(self, ctx:CParser.AssignmentExpressionContext): 114 | return self.visitChildren(ctx) 115 | 116 | 117 | # Visit a parse tree produced by CParser#assignmentOperator. 118 | def visitAssignmentOperator(self, ctx:CParser.AssignmentOperatorContext): 119 | return self.visitChildren(ctx) 120 | 121 | 122 | # Visit a parse tree produced by CParser#expression. 123 | def visitExpression(self, ctx:CParser.ExpressionContext): 124 | return self.visitChildren(ctx) 125 | 126 | 127 | # Visit a parse tree produced by CParser#constantExpression. 128 | def visitConstantExpression(self, ctx:CParser.ConstantExpressionContext): 129 | return self.visitChildren(ctx) 130 | 131 | 132 | # Visit a parse tree produced by CParser#declaration. 133 | def visitDeclaration(self, ctx:CParser.DeclarationContext): 134 | return self.visitChildren(ctx) 135 | 136 | 137 | # Visit a parse tree produced by CParser#declarationSpecifiers. 138 | def visitDeclarationSpecifiers(self, ctx:CParser.DeclarationSpecifiersContext): 139 | return self.visitChildren(ctx) 140 | 141 | 142 | # Visit a parse tree produced by CParser#declarationSpecifiers2. 143 | def visitDeclarationSpecifiers2(self, ctx:CParser.DeclarationSpecifiers2Context): 144 | return self.visitChildren(ctx) 145 | 146 | 147 | # Visit a parse tree produced by CParser#declarationSpecifier. 148 | def visitDeclarationSpecifier(self, ctx:CParser.DeclarationSpecifierContext): 149 | return self.visitChildren(ctx) 150 | 151 | 152 | # Visit a parse tree produced by CParser#initDeclaratorList. 153 | def visitInitDeclaratorList(self, ctx:CParser.InitDeclaratorListContext): 154 | return self.visitChildren(ctx) 155 | 156 | 157 | # Visit a parse tree produced by CParser#initDeclarator. 158 | def visitInitDeclarator(self, ctx:CParser.InitDeclaratorContext): 159 | return self.visitChildren(ctx) 160 | 161 | 162 | # Visit a parse tree produced by CParser#storageClassSpecifier. 163 | def visitStorageClassSpecifier(self, ctx:CParser.StorageClassSpecifierContext): 164 | return self.visitChildren(ctx) 165 | 166 | 167 | # Visit a parse tree produced by CParser#typeSpecifier. 168 | def visitTypeSpecifier(self, ctx:CParser.TypeSpecifierContext): 169 | return self.visitChildren(ctx) 170 | 171 | 172 | # Visit a parse tree produced by CParser#structOrUnionSpecifier. 173 | def visitStructOrUnionSpecifier(self, ctx:CParser.StructOrUnionSpecifierContext): 174 | return self.visitChildren(ctx) 175 | 176 | 177 | # Visit a parse tree produced by CParser#structOrUnion. 178 | def visitStructOrUnion(self, ctx:CParser.StructOrUnionContext): 179 | return self.visitChildren(ctx) 180 | 181 | 182 | # Visit a parse tree produced by CParser#structDeclarationList. 183 | def visitStructDeclarationList(self, ctx:CParser.StructDeclarationListContext): 184 | return self.visitChildren(ctx) 185 | 186 | 187 | # Visit a parse tree produced by CParser#structDeclaration. 188 | def visitStructDeclaration(self, ctx:CParser.StructDeclarationContext): 189 | return self.visitChildren(ctx) 190 | 191 | 192 | # Visit a parse tree produced by CParser#specifierQualifierList. 193 | def visitSpecifierQualifierList(self, ctx:CParser.SpecifierQualifierListContext): 194 | return self.visitChildren(ctx) 195 | 196 | 197 | # Visit a parse tree produced by CParser#structDeclaratorList. 198 | def visitStructDeclaratorList(self, ctx:CParser.StructDeclaratorListContext): 199 | return self.visitChildren(ctx) 200 | 201 | 202 | # Visit a parse tree produced by CParser#structDeclarator. 203 | def visitStructDeclarator(self, ctx:CParser.StructDeclaratorContext): 204 | return self.visitChildren(ctx) 205 | 206 | 207 | # Visit a parse tree produced by CParser#enumSpecifier. 208 | def visitEnumSpecifier(self, ctx:CParser.EnumSpecifierContext): 209 | return self.visitChildren(ctx) 210 | 211 | 212 | # Visit a parse tree produced by CParser#enumeratorList. 213 | def visitEnumeratorList(self, ctx:CParser.EnumeratorListContext): 214 | return self.visitChildren(ctx) 215 | 216 | 217 | # Visit a parse tree produced by CParser#enumerator. 218 | def visitEnumerator(self, ctx:CParser.EnumeratorContext): 219 | return self.visitChildren(ctx) 220 | 221 | 222 | # Visit a parse tree produced by CParser#enumerationConstant. 223 | def visitEnumerationConstant(self, ctx:CParser.EnumerationConstantContext): 224 | return self.visitChildren(ctx) 225 | 226 | 227 | # Visit a parse tree produced by CParser#atomicTypeSpecifier. 228 | def visitAtomicTypeSpecifier(self, ctx:CParser.AtomicTypeSpecifierContext): 229 | return self.visitChildren(ctx) 230 | 231 | 232 | # Visit a parse tree produced by CParser#typeQualifier. 233 | def visitTypeQualifier(self, ctx:CParser.TypeQualifierContext): 234 | return self.visitChildren(ctx) 235 | 236 | 237 | # Visit a parse tree produced by CParser#functionSpecifier. 238 | def visitFunctionSpecifier(self, ctx:CParser.FunctionSpecifierContext): 239 | return self.visitChildren(ctx) 240 | 241 | 242 | # Visit a parse tree produced by CParser#alignmentSpecifier. 243 | def visitAlignmentSpecifier(self, ctx:CParser.AlignmentSpecifierContext): 244 | return self.visitChildren(ctx) 245 | 246 | 247 | # Visit a parse tree produced by CParser#declarator. 248 | def visitDeclarator(self, ctx:CParser.DeclaratorContext): 249 | return self.visitChildren(ctx) 250 | 251 | 252 | # Visit a parse tree produced by CParser#directDeclarator. 253 | def visitDirectDeclarator(self, ctx:CParser.DirectDeclaratorContext): 254 | return self.visitChildren(ctx) 255 | 256 | 257 | # Visit a parse tree produced by CParser#gccDeclaratorExtension. 258 | def visitGccDeclaratorExtension(self, ctx:CParser.GccDeclaratorExtensionContext): 259 | return self.visitChildren(ctx) 260 | 261 | 262 | # Visit a parse tree produced by CParser#gccAttributeSpecifier. 263 | def visitGccAttributeSpecifier(self, ctx:CParser.GccAttributeSpecifierContext): 264 | return self.visitChildren(ctx) 265 | 266 | 267 | # Visit a parse tree produced by CParser#gccAttributeList. 268 | def visitGccAttributeList(self, ctx:CParser.GccAttributeListContext): 269 | return self.visitChildren(ctx) 270 | 271 | 272 | # Visit a parse tree produced by CParser#gccAttribute. 273 | def visitGccAttribute(self, ctx:CParser.GccAttributeContext): 274 | return self.visitChildren(ctx) 275 | 276 | 277 | # Visit a parse tree produced by CParser#nestedParenthesesBlock. 278 | def visitNestedParenthesesBlock(self, ctx:CParser.NestedParenthesesBlockContext): 279 | return self.visitChildren(ctx) 280 | 281 | 282 | # Visit a parse tree produced by CParser#pointer. 283 | def visitPointer(self, ctx:CParser.PointerContext): 284 | return self.visitChildren(ctx) 285 | 286 | 287 | # Visit a parse tree produced by CParser#typeQualifierList. 288 | def visitTypeQualifierList(self, ctx:CParser.TypeQualifierListContext): 289 | return self.visitChildren(ctx) 290 | 291 | 292 | # Visit a parse tree produced by CParser#parameterTypeList. 293 | def visitParameterTypeList(self, ctx:CParser.ParameterTypeListContext): 294 | return self.visitChildren(ctx) 295 | 296 | 297 | # Visit a parse tree produced by CParser#parameterList. 298 | def visitParameterList(self, ctx:CParser.ParameterListContext): 299 | return self.visitChildren(ctx) 300 | 301 | 302 | # Visit a parse tree produced by CParser#parameterDeclaration. 303 | def visitParameterDeclaration(self, ctx:CParser.ParameterDeclarationContext): 304 | return self.visitChildren(ctx) 305 | 306 | 307 | # Visit a parse tree produced by CParser#identifierList. 308 | def visitIdentifierList(self, ctx:CParser.IdentifierListContext): 309 | return self.visitChildren(ctx) 310 | 311 | 312 | # Visit a parse tree produced by CParser#typeName. 313 | def visitTypeName(self, ctx:CParser.TypeNameContext): 314 | return self.visitChildren(ctx) 315 | 316 | 317 | # Visit a parse tree produced by CParser#abstractDeclarator. 318 | def visitAbstractDeclarator(self, ctx:CParser.AbstractDeclaratorContext): 319 | return self.visitChildren(ctx) 320 | 321 | 322 | # Visit a parse tree produced by CParser#directAbstractDeclarator. 323 | def visitDirectAbstractDeclarator(self, ctx:CParser.DirectAbstractDeclaratorContext): 324 | return self.visitChildren(ctx) 325 | 326 | 327 | # Visit a parse tree produced by CParser#typedefName. 328 | def visitTypedefName(self, ctx:CParser.TypedefNameContext): 329 | return self.visitChildren(ctx) 330 | 331 | 332 | # Visit a parse tree produced by CParser#initializer. 333 | def visitInitializer(self, ctx:CParser.InitializerContext): 334 | return self.visitChildren(ctx) 335 | 336 | 337 | # Visit a parse tree produced by CParser#initializerList. 338 | def visitInitializerList(self, ctx:CParser.InitializerListContext): 339 | return self.visitChildren(ctx) 340 | 341 | 342 | # Visit a parse tree produced by CParser#designation. 343 | def visitDesignation(self, ctx:CParser.DesignationContext): 344 | return self.visitChildren(ctx) 345 | 346 | 347 | # Visit a parse tree produced by CParser#designatorList. 348 | def visitDesignatorList(self, ctx:CParser.DesignatorListContext): 349 | return self.visitChildren(ctx) 350 | 351 | 352 | # Visit a parse tree produced by CParser#designator. 353 | def visitDesignator(self, ctx:CParser.DesignatorContext): 354 | return self.visitChildren(ctx) 355 | 356 | 357 | # Visit a parse tree produced by CParser#staticAssertDeclaration. 358 | def visitStaticAssertDeclaration(self, ctx:CParser.StaticAssertDeclarationContext): 359 | return self.visitChildren(ctx) 360 | 361 | 362 | # Visit a parse tree produced by CParser#statement. 363 | def visitStatement(self, ctx:CParser.StatementContext): 364 | return self.visitChildren(ctx) 365 | 366 | 367 | # Visit a parse tree produced by CParser#labeledStatement. 368 | def visitLabeledStatement(self, ctx:CParser.LabeledStatementContext): 369 | return self.visitChildren(ctx) 370 | 371 | 372 | # Visit a parse tree produced by CParser#compoundStatement. 373 | def visitCompoundStatement(self, ctx:CParser.CompoundStatementContext): 374 | return self.visitChildren(ctx) 375 | 376 | 377 | # Visit a parse tree produced by CParser#blockItemList. 378 | def visitBlockItemList(self, ctx:CParser.BlockItemListContext): 379 | return self.visitChildren(ctx) 380 | 381 | 382 | # Visit a parse tree produced by CParser#blockItem. 383 | def visitBlockItem(self, ctx:CParser.BlockItemContext): 384 | return self.visitChildren(ctx) 385 | 386 | 387 | # Visit a parse tree produced by CParser#expressionStatement. 388 | def visitExpressionStatement(self, ctx:CParser.ExpressionStatementContext): 389 | return self.visitChildren(ctx) 390 | 391 | 392 | # Visit a parse tree produced by CParser#selectionStatement. 393 | def visitSelectionStatement(self, ctx:CParser.SelectionStatementContext): 394 | return self.visitChildren(ctx) 395 | 396 | 397 | # Visit a parse tree produced by CParser#iterationStatement. 398 | def visitIterationStatement(self, ctx:CParser.IterationStatementContext): 399 | return self.visitChildren(ctx) 400 | 401 | 402 | # Visit a parse tree produced by CParser#forCondition. 403 | def visitForCondition(self, ctx:CParser.ForConditionContext): 404 | return self.visitChildren(ctx) 405 | 406 | 407 | # Visit a parse tree produced by CParser#forDeclaration. 408 | def visitForDeclaration(self, ctx:CParser.ForDeclarationContext): 409 | return self.visitChildren(ctx) 410 | 411 | 412 | # Visit a parse tree produced by CParser#forExpression. 413 | def visitForExpression(self, ctx:CParser.ForExpressionContext): 414 | return self.visitChildren(ctx) 415 | 416 | 417 | # Visit a parse tree produced by CParser#jumpStatement. 418 | def visitJumpStatement(self, ctx:CParser.JumpStatementContext): 419 | return self.visitChildren(ctx) 420 | 421 | 422 | # Visit a parse tree produced by CParser#compilationUnit. 423 | def visitCompilationUnit(self, ctx:CParser.CompilationUnitContext): 424 | return self.visitChildren(ctx) 425 | 426 | 427 | # Visit a parse tree produced by CParser#translationUnit. 428 | def visitTranslationUnit(self, ctx:CParser.TranslationUnitContext): 429 | return self.visitChildren(ctx) 430 | 431 | 432 | # Visit a parse tree produced by CParser#externalDeclaration. 433 | def visitExternalDeclaration(self, ctx:CParser.ExternalDeclarationContext): 434 | return self.visitChildren(ctx) 435 | 436 | 437 | # Visit a parse tree produced by CParser#functionDefinition. 438 | def visitFunctionDefinition(self, ctx:CParser.FunctionDefinitionContext): 439 | return self.visitChildren(ctx) 440 | 441 | 442 | # Visit a parse tree produced by CParser#declarationList. 443 | def visitDeclarationList(self, ctx:CParser.DeclarationListContext): 444 | return self.visitChildren(ctx) 445 | 446 | 447 | 448 | del CParser -------------------------------------------------------------------------------- /parser_/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JunguangJiang/TinyCCompiler/fe612e12f294e0c29b46e6dbf2be314ab56f7309/parser_/__init__.py -------------------------------------------------------------------------------- /test.py: -------------------------------------------------------------------------------- 1 | from generator.generator import generate 2 | from executor.executor import execute 3 | import sys 4 | import test.testcase 5 | import unit_test.testcase 6 | import os 7 | import filecmp 8 | import traceback 9 | 10 | def test_file(filename, print_exception=True): 11 | """ 12 | 测试filename代码的编译与执行 13 | :param filename: 14 | :param print_exception: 是否打印异常 15 | :return: 是否正确编译与执行 16 | """ 17 | output_filename = filename.split('.')[0]+".ll" 18 | 19 | if print_exception: 20 | generate_result = generate(input_filename=filename, output_filename=output_filename) 21 | else: 22 | try: 23 | generate_result = generate(input_filename=filename, output_filename=output_filename) 24 | except Exception: 25 | traceback.print_exc() 26 | print("generate", filename, "failed.") 27 | return False 28 | 29 | if not generate_result: 30 | traceback.print_exc() 31 | print("generate", filename, "failed.") 32 | return False 33 | else: 34 | if print_exception: 35 | execute_result = execute(output_filename) 36 | else: 37 | try: 38 | execute_result = execute(output_filename) 39 | except Exception as e: 40 | print("execute", output_filename, "failed.") 41 | traceback.print_exc() 42 | return False 43 | 44 | return True 45 | 46 | 47 | def test_files(filenames, print_exception=False, is_unit=False): 48 | """ 49 | 测试文件列表filenames中的所有文件 50 | :param filenames: 51 | :param print_exception: 是否打印异常 52 | :param is_unit: 是否是单元测试 53 | :return: None 54 | """ 55 | success_numbers = 0 56 | fail_numbers = 0 57 | for filename in filenames: 58 | print("Test:",filename) 59 | if is_unit: 60 | result = unit_test_file(filename) 61 | else: 62 | result = test_file(filename, print_exception) 63 | 64 | if result: 65 | success_numbers += 1 66 | else: 67 | fail_numbers += 1 68 | print() 69 | print("Test Results:", success_numbers, "success,", fail_numbers, "fails") 70 | 71 | 72 | def unit_test_file(filename): 73 | """ 74 | 单元测试filename代码的编译与执行 75 | :param filename: 76 | :return: 是否正确编译与执行 77 | """ 78 | os.system("python test.py " + filename + " > " + "unit_test/temp.txt") 79 | if filecmp.cmp(filename.split('.')[0]+".txt", "unit_test/temp.txt"): 80 | return True 81 | else: 82 | with open("unit_test/temp.txt") as f: 83 | print(f.read()) 84 | print("Fail to pass", filename) 85 | return False 86 | 87 | 88 | if __name__ == '__main__': 89 | if len(sys.argv) == 2: 90 | if sys.argv[1] == "unit": # 运行单元测试文件 91 | test_files(filenames=unit_test.testcase.cases(), print_exception=False, is_unit=True) 92 | else: # 运行某个特定的C文件进行测试 93 | test_file(filename=sys.argv[1], print_exception=True) 94 | else: # 运行测试文件 95 | test_files(filenames=test.testcase.cases(), print_exception=False, is_unit=False) 96 | 97 | -------------------------------------------------------------------------------- /test/AVLTree.c: -------------------------------------------------------------------------------- 1 | int nullptr = 0; 2 | int LH = 0; 3 | int EH = 1; 4 | int RH = 2; 5 | int printf(const char *format,...); 6 | void *malloc(unsigned int num_bytes); 7 | void free(void *ptr); 8 | 9 | struct AVLNode 10 | { 11 | int m_data; 12 | int bf; // balance factor 13 | struct AVLNode* lchild; 14 | struct AVLNode* rchild; 15 | }; 16 | 17 | struct AVLNode* MallocNode(int e) 18 | { 19 | struct AVLNode* new_node = malloc(24); // length of pointer is 8 bytes in 64 bit machine 20 | new_node->m_data = e; 21 | new_node->bf = EH; 22 | new_node->lchild = nullptr; 23 | new_node->rchild = nullptr; 24 | return new_node; 25 | } 26 | 27 | void FreeTree(struct AVLNode** root) 28 | { 29 | if(*root == nullptr) 30 | return; 31 | FreeTree(&((*root)->lchild)); 32 | FreeTree(&((*root)->rchild)); 33 | free(*root); 34 | *root = nullptr; 35 | } 36 | 37 | void R_Rotate(struct AVLNode ** p) 38 | { 39 | struct AVLNode* q = (*p)->lchild; 40 | (*p)->lchild = q->rchild; 41 | q->rchild = *p; 42 | *p = q; 43 | } 44 | 45 | void L_Rotate(struct AVLNode ** p) 46 | { 47 | struct AVLNode* q = (*p)->rchild; 48 | (*p)->rchild = q->lchild; 49 | q->lchild = *p; 50 | *p = q; 51 | } 52 | 53 | void Adjust(struct AVLNode ** root, int Type) 54 | { 55 | struct AVLNode* p; 56 | switch (Type) 57 | { 58 | case LH: 59 | p = (*root)->lchild; 60 | if (p->bf == LH) 61 | { 62 | p->bf = EH; 63 | (*root)->bf = EH; 64 | R_Rotate(root); 65 | } 66 | else if (p->bf == RH) 67 | { 68 | struct AVLNode* q = p->rchild; 69 | switch (q->bf) 70 | { 71 | case LH: 72 | p->bf = EH; 73 | (*root)->bf = RH; 74 | break; 75 | case EH: 76 | p->bf = EH; 77 | (*root)->bf = EH; 78 | break; 79 | case RH: 80 | p->bf = LH; 81 | (*root)->bf = EH; 82 | break; 83 | } 84 | q->bf = EH; 85 | L_Rotate(&((*root)->lchild)); 86 | R_Rotate(root); 87 | } 88 | break; 89 | case RH: 90 | p = (*root)->rchild; 91 | if (p->bf == RH) 92 | { 93 | (*root)->bf = EH; 94 | p->bf = EH; 95 | L_Rotate(root); 96 | } 97 | else if (p->bf == LH) 98 | { 99 | struct AVLNode* q = p->lchild; 100 | switch (q->bf) 101 | { 102 | case LH: 103 | p->bf = RH; 104 | (*root)->bf = EH; 105 | break; 106 | case EH: 107 | p->bf = EH; 108 | (*root)->bf = EH; 109 | break; 110 | case RH: 111 | p->bf = EH; 112 | (*root)->bf = LH; 113 | break; 114 | } 115 | q->bf = EH; 116 | R_Rotate(&((*root)->rchild)); 117 | L_Rotate(root); 118 | } 119 | break; 120 | } 121 | } 122 | 123 | int Insert(struct AVLNode ** root, int e, int* taller) 124 | { 125 | if (*root == nullptr) 126 | { 127 | *root = MallocNode(e); 128 | *taller = 1; 129 | } 130 | else 131 | { 132 | if ((*root)->m_data == e) 133 | { 134 | *taller = 0; 135 | return 0; 136 | } 137 | if (!((*root)->m_data < e)) 138 | { 139 | if (!Insert(&((*root)->lchild), e, taller)) 140 | return 0; 141 | if (*taller) 142 | { 143 | switch ((*root)->bf) 144 | { 145 | case LH: 146 | Adjust(root, LH); 147 | *taller = 0; 148 | break; 149 | case EH: 150 | (*root)->bf = LH; 151 | *taller = 1; 152 | break; 153 | case RH: 154 | (*root)->bf = EH; 155 | *taller = 0; 156 | break; 157 | } 158 | } 159 | } 160 | else 161 | { 162 | if (!Insert(&((*root)->rchild), e, taller)) 163 | return 0; 164 | if (*taller) 165 | { 166 | switch ((*root)->bf) 167 | { 168 | case LH: 169 | (*root)->bf = EH; 170 | *taller = 0; 171 | break; 172 | case EH: 173 | (*root)->bf = RH; 174 | *taller = 1; 175 | break; 176 | case RH: 177 | Adjust(root, RH); 178 | *taller = 0; 179 | break; 180 | } 181 | } 182 | } 183 | } 184 | return 1; 185 | } 186 | 187 | struct AVLNode* Search(struct AVLNode* p, int e) 188 | { 189 | struct AVLNode* res; 190 | if (p == nullptr) 191 | res = p; 192 | else if (p->m_data == e) 193 | res = p; 194 | else if (p->m_data < e) 195 | res = Search(p->rchild, e); 196 | else 197 | res = Search(p->lchild, e); 198 | return res; 199 | } 200 | 201 | void PrintTree(struct AVLNode* root) 202 | { 203 | if(root == nullptr) 204 | { 205 | printf("Empty Tree!"); 206 | return; 207 | } 208 | printf("{"); 209 | printf(" data: %d, ", root->m_data); 210 | printf(" lchild: "); 211 | if(root->lchild != nullptr) 212 | PrintTree(root->lchild); 213 | else 214 | printf("null"); 215 | printf(", "); 216 | printf(" rchild: "); 217 | if(root->rchild != nullptr) 218 | PrintTree(root->rchild); 219 | else 220 | printf("null"); 221 | printf("}"); 222 | } 223 | 224 | int main() 225 | { 226 | printf("\nAVLTree test:\n"); 227 | struct AVLNode* root = nullptr; 228 | int taller; 229 | 230 | PrintTree(root); 231 | printf("\n"); 232 | 233 | Insert(&root, 0, &taller); 234 | PrintTree(root); 235 | printf("\n"); 236 | 237 | Insert(&root, 1, &taller); 238 | PrintTree(root); 239 | printf("\n"); 240 | 241 | Insert(&root, 2, &taller); 242 | PrintTree(root); 243 | printf("\n"); 244 | 245 | Insert(&root, 4, &taller); 246 | PrintTree(root); 247 | printf("\n"); 248 | 249 | Insert(&root, -22, &taller); 250 | PrintTree(root); 251 | printf("\n"); 252 | 253 | Insert(&root, -25, &taller); 254 | PrintTree(root); 255 | printf("\n"); 256 | 257 | FreeTree(&root); 258 | PrintTree(root); 259 | 260 | return 0; 261 | } -------------------------------------------------------------------------------- /test/KMP.c: -------------------------------------------------------------------------------- 1 | //KMP TEST 2 | //#include 3 | int printf(const char *format,...); 4 | 5 | int strlen(char s[]) 6 | { 7 | int i=0; 8 | while(s[i]) i++; 9 | return i; 10 | } 11 | 12 | int match(char s[], char t[], int pos, int next[]) 13 | { 14 | int i = pos; 15 | int j = 0; 16 | while ((i < strlen(s)) && (j < strlen(t))) 17 | { 18 | if ((j == -1) || s[i] == t[j]) 19 | { 20 | i++; 21 | j++; 22 | } 23 | else 24 | { 25 | j = next[j]; 26 | } 27 | } 28 | 29 | if (strlen(t) == j) 30 | { 31 | return i - strlen(t); 32 | } 33 | return -1; 34 | } 35 | 36 | 37 | void get_next(char t[], int next[]) 38 | { 39 | int k = -1; 40 | int j = 0; 41 | next[j] = k; 42 | while (j < strlen(t)) 43 | { 44 | if ((k == -1) || (t[j] == t[k])) 45 | { 46 | ++k; 47 | ++j; 48 | next[j] = k; 49 | } 50 | else 51 | { 52 | k = next[k]; 53 | } 54 | } 55 | } 56 | 57 | 58 | void print_next(int next[], int n) 59 | { 60 | for (int i = 0; i < n; i++) 61 | { 62 | printf("next[%d] = %d\n", i, next[i]); 63 | } 64 | } 65 | 66 | int main() 67 | { 68 | char s[] = "ababcabcacbab"; 69 | char t[] = "abcac"; 70 | int pos = 0; 71 | int index; 72 | int next[32]; 73 | 74 | 75 | printf("\nKMP test:\n"); 76 | get_next(t, next); 77 | print_next(next, strlen(t)); 78 | 79 | index = match(s, t, pos, next); 80 | printf("index = %d\n", index); 81 | return 0; 82 | } 83 | -------------------------------------------------------------------------------- /test/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JunguangJiang/TinyCCompiler/fe612e12f294e0c29b46e6dbf2be314ab56f7309/test/__init__.py -------------------------------------------------------------------------------- /test/arithmetic.c: -------------------------------------------------------------------------------- 1 | //#include 2 | //#include 3 | //#include 4 | //#include 5 | int printf(const char *format,...); 6 | void exit(int status); 7 | 8 | char pri[7][7]={ 9 | /* + - * / ( ) \0 */ 10 | /* + */ {'>','>','<','<','<','>','>'}, 11 | /* - */ {'>','>','<','<','<','>','>'}, 12 | /* * */ {'>','>','>','>','<','>','>'}, 13 | /* / */ {'>','>','>','>','<','>','>'}, 14 | /* ( */ {'<','<','<','<','<','=',' '}, 15 | /* ) */ {' ',' ',' ',' ',' ',' ',' '}, 16 | /* \0 */ {'<','<','<','<','<',' ','='} 17 | }; 18 | 19 | int optr2rank(char op) 20 | { 21 | int ans = 0; 22 | switch(op){ 23 | case '+': 24 | ans = 0; 25 | break; 26 | case '-': 27 | ans = 1; 28 | break; 29 | case '*': 30 | ans = 2; 31 | break; 32 | case '/': 33 | ans = 3; 34 | break; 35 | case '(': 36 | ans = 4; 37 | break; 38 | case ')': 39 | ans = 5; 40 | break; 41 | case '\0': 42 | ans = 6; 43 | break; 44 | default: 45 | printf("optr2rank error: %c", op); 46 | exit(-1); 47 | break; 48 | } 49 | return ans; 50 | } 51 | 52 | char orderBetween(char op1, char op2) 53 | { 54 | return pri[optr2rank(op1)][optr2rank(op2)]; 55 | } 56 | 57 | int calcu(int opnd1, char op, int opnd2) 58 | { 59 | int ans = 0; 60 | if (op == '+') { 61 | ans = opnd1 + opnd2; 62 | } else if (op == '-') { 63 | ans = opnd1 - opnd2; 64 | } else if (op == '*') { 65 | ans = opnd1 * opnd2; 66 | } else if (op == '/') { 67 | ans = opnd1 / opnd2; 68 | } else { 69 | exit(-2); 70 | } 71 | return ans; 72 | } 73 | 74 | bool isdigit(char c){ 75 | int i = c - '0'; 76 | return (i >= 0) && (i <= 9); 77 | } 78 | 79 | int evaluate(char S[]) 80 | { 81 | int opnd[10000]; 82 | int opnd_top = -1; 83 | char optr[10000]; 84 | int optr_top = -1; 85 | 86 | int i=0; 87 | 88 | optr[++optr_top] = '\0'; 89 | 90 | while (optr_top >= 0) { 91 | if (isdigit(S[i])) { 92 | opnd[++opnd_top] = S[i] - '0'; 93 | while(isdigit(S[++i])){ 94 | opnd[opnd_top] = opnd[opnd_top] * 10 + S[i] - '0'; 95 | } 96 | } else { 97 | char order = orderBetween(optr[optr_top], S[i]); 98 | if (order == '<') { 99 | optr[++optr_top] = S[i++]; 100 | } else if (order == '=') { 101 | optr_top--; 102 | i++; 103 | } else if (order == '>') { 104 | char op = optr[optr_top--]; 105 | int pOpnd2 = opnd[opnd_top--], pOpnd1 = opnd[opnd_top--]; 106 | opnd[++opnd_top] = calcu(pOpnd1, op, pOpnd2); 107 | } else { 108 | exit(-1); 109 | } 110 | } 111 | } 112 | return opnd[opnd_top]; 113 | } 114 | 115 | void testEvaluate(char S[], int true_answer) 116 | { 117 | int test_answer = evaluate(S); 118 | if(test_answer == true_answer){ 119 | printf("pass:"); 120 | }else{ 121 | printf("fail:"); 122 | } 123 | printf("'%s' = %d", S, test_answer); 124 | if(test_answer != true_answer){ 125 | printf(", while true answer is %d", true_answer); 126 | } 127 | printf("\n"); 128 | } 129 | 130 | void evaluateTests() 131 | { 132 | printf("\nevaluate test:\n"); 133 | testEvaluate("3", 3); 134 | testEvaluate("23+5", 28); 135 | testEvaluate("3*4", 12); 136 | testEvaluate("22-(6-4)", 20); 137 | testEvaluate("22/(6/3)",11); 138 | testEvaluate("1+(5-2)*4/(2+1)", 5); 139 | testEvaluate("0+(1+23)/4*5*67-8+9", 2011); 140 | testEvaluate("192/(3*8+4*(33/5))-5", -1); 141 | } 142 | 143 | int main() 144 | { 145 | evaluateTests(); 146 | return 0; 147 | } 148 | -------------------------------------------------------------------------------- /test/fibonacci.c: -------------------------------------------------------------------------------- 1 | int scanf(const char * restrict format,...); 2 | int printf(const char *format,...); 3 | 4 | int fib(int n){ 5 | if(n <= 0){ 6 | return 0; 7 | }else if(n==1){ 8 | return 1; 9 | } 10 | return fib(n-1) + fib(n-2); 11 | } 12 | 13 | int main() 14 | { 15 | printf("Please input number n:"); 16 | int n; 17 | scanf("%d", &n); 18 | printf("fib(n)=%d\n", fib(n)); 19 | return 0; 20 | } -------------------------------------------------------------------------------- /test/linkedlist.c: -------------------------------------------------------------------------------- 1 | int printf(const char *format,...); 2 | 3 | int nullptr = 0; 4 | struct Node 5 | { 6 | int data; 7 | struct Node* next; 8 | }; 9 | void addNode(struct Node* pre, struct Node* next) 10 | { 11 | pre->next = next; 12 | } 13 | int main() 14 | { 15 | printf("\nlinkedlist test:\n"); 16 | 17 | struct Node n1, n2, n3; 18 | n1.data = 1; 19 | n1.next = nullptr; 20 | n2.data = 2; 21 | n2.next = nullptr; 22 | n3.data = 3; 23 | n3.next = nullptr; 24 | addNode(&n1, &n2); 25 | addNode(&n2, &n3); 26 | 27 | struct Node* head = &n1; 28 | struct Node* cur = head; 29 | do 30 | { 31 | printf("data=%d\n", cur->data); 32 | cur = cur->next; 33 | }while(cur!=nullptr); 34 | return 0; 35 | } -------------------------------------------------------------------------------- /test/palindrome.c: -------------------------------------------------------------------------------- 1 | //#include 2 | //#include 3 | int printf(const char *format,...); 4 | 5 | int strlen(char s[]) 6 | { 7 | int i=0; 8 | while(s[i]) i++; 9 | return i; 10 | } 11 | 12 | int isPalindrome(char s[]) 13 | { 14 | int len = strlen(s); 15 | for(int i=0, mi=len/2; i> 1; // 3 22 | printf("a = a >> 3, a = %d\n", a); 23 | a = a & 5; // 1 24 | printf("a = a & 3, a = %d\n", a); 25 | a = a | 4; // 5 26 | printf("a = a | 3, a = %d\n", a); 27 | a = a ^ 3; // 6 28 | printf("a = a ^ 3, a = %d\n\n", a); 29 | } 30 | 31 | void test_operator() { 32 | int a; 33 | printf("=====Start test operator=====\n"); 34 | a = 1; 35 | printf("a = %d\n", a); 36 | a += 1; 37 | printf("a += 1, a = %d\n", a); 38 | a -= 1; 39 | printf("a -= 1, a = %d\n", a); 40 | a *= 2; 41 | printf("a *= 2, a = %d\n", a); 42 | a /= 2; 43 | printf("a /= 2, a = %d\n", a); 44 | a = 7; 45 | a %= 4; 46 | printf("a = 7, a %%= 4, a = %d\n", a); 47 | a <<= 1; // 6 48 | printf("a <<= 1, a = %d\n", a); 49 | a >>= 1; // 3 50 | printf("a >>= 1, a = %d\n", a); 51 | a &= 5; // 1 52 | printf("a &= 5, a = %d\n", a); 53 | a |= 4; // 5 54 | printf("a |= 4, a = %d\n", a); 55 | a ^= 3; // 6 56 | printf("a ^= 3, a = %d\n\n", a); 57 | } 58 | 59 | void test_conditional() { 60 | printf("=====Start test conditional=====\n"); 61 | printf("(2 < 3 ? 2 : 3) is %d\n", 2 < 3 ? 2 : 3); 62 | printf("(2 > 3 ? 2 : 3) is %d\n\n", 2 > 3 ? 2 : 3); 63 | } 64 | 65 | void test_logical_and_or() { 66 | int a = 0; 67 | char* t = "true"; 68 | char* f = "false"; 69 | printf("=====Start test logical and or=====\n"); 70 | printf("a = %d\n", a); 71 | printf("(2 < 3 && (a += 1)) is %s\n", (2 > 3 && (a += 1)) ? t : f); 72 | printf("and now a = %d\n", a); 73 | printf("((a += 1) && (3 > 2 || (a += 1))) is %s\n", ((a += 1) && (3 > 2 || (a += 1))) ? t : f); 74 | printf("and now a = %d\n\n", a); 75 | } 76 | 77 | int main() { 78 | test_operator(); 79 | test_conditional(); 80 | test_assignment(); 81 | test_logical_and_or(); 82 | return 0; 83 | } -------------------------------------------------------------------------------- /unit_test/assignment_operator.txt: -------------------------------------------------------------------------------- 1 | =====Start test operator===== 2 | a = 1 3 | a += 1, a = 2 4 | a -= 1, a = 1 5 | a *= 2, a = 2 6 | a /= 2, a = 1 7 | a = 7, a %= 4, a = 3 8 | a <<= 1, a = 6 9 | a >>= 1, a = 3 10 | a &= 5, a = 1 11 | a |= 4, a = 5 12 | a ^= 3, a = 6 13 | 14 | =====Start test conditional===== 15 | (2 < 3 ? 2 : 3) is 2 16 | (2 > 3 ? 2 : 3) is 3 17 | 18 | =====Start test assignment===== 19 | a = 1 20 | a = a + 1, a = 2 21 | a = a - 1, a = 1 22 | a = a * 2, a = 2 23 | a = a / 2, a = 1 24 | a = 7, a %= 4, a = 3 25 | a = a << 1, a = 6 26 | a = a >> 3, a = 3 27 | a = a & 3, a = 1 28 | a = a | 3, a = 5 29 | a = a ^ 3, a = 6 30 | 31 | =====Start test logical and or===== 32 | a = 0 33 | (2 < 3 && (a += 1)) is false 34 | and now a = 0 35 | ((a += 1) && (3 > 2 || (a += 1))) is true 36 | and now a = 1 37 | 38 | -------------------------------------------------------------------------------- /unit_test/error.c: -------------------------------------------------------------------------------- 1 | int func(int a); 2 | 3 | int func() 4 | { 5 | return 0; 6 | } 7 | int main() 8 | { 9 | int a=0; 10 | int a=1; 11 | b=3; 12 | int c=3.9%2; 13 | int array[-3]; 14 | int array2[4.5]; 15 | break; 16 | return 0; 17 | } -------------------------------------------------------------------------------- /unit_test/expression.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JunguangJiang/TinyCCompiler/fe612e12f294e0c29b46e6dbf2be314ab56f7309/unit_test/expression.c -------------------------------------------------------------------------------- /unit_test/function.c: -------------------------------------------------------------------------------- 1 | int printf(const char *format,...); 2 | 3 | int abs(int x); 4 | 5 | // test visitFunctionDefinition 6 | int func1() 7 | { 8 | printf("func1 called.\n"); 9 | return 1; 10 | } 11 | 12 | void func2(short i) 13 | { 14 | printf("func2 called with i=%hd.\n", i); 15 | } 16 | 17 | void func3(char s[]) 18 | { 19 | printf("func3 called with s=%s.\n", s); 20 | } 21 | 22 | float func4(float i, char c) 23 | { 24 | printf("func4 called with i=%3.2f and c=%c\n", i, c); 25 | return i; 26 | } 27 | 28 | void func5(int array[], int n) 29 | { 30 | printf("func5 called with array=["); 31 | for(int i=0;i0){ 41 | inner_func(i/8); 42 | } 43 | } 44 | 45 | void outter_func(int j) 46 | { 47 | printf("outter function called with j=%d\n", j); 48 | inner_func(j*j); 49 | } 50 | 51 | int func_declaration(int i, int j); 52 | 53 | void extern_func_declaration_test() 54 | { 55 | printf("extern function decalaration test:"); 56 | printf("abs(-4)=%d\n", abs(-4)); 57 | } 58 | 59 | int main() 60 | { 61 | func1(); 62 | func2(3); 63 | func3("Hello"); 64 | func4(4.5,'a'); 65 | int array[8] = {3,4,5,6,7,8,9,10}; 66 | func5(array, 8); 67 | outter_func(8); 68 | printf("function decalaration: 3*5=%d\n", func_declaration(3,5)); 69 | extern_func_declaration_test(); 70 | return 0; 71 | } 72 | 73 | int func_declaration(int i, int j) 74 | { 75 | return i*j; 76 | } -------------------------------------------------------------------------------- /unit_test/function.txt: -------------------------------------------------------------------------------- 1 | func1 called. 2 | func2 called with i=3. 3 | func3 called with s=Hello. 4 | func4 called with i=4.50 and c=a 5 | func5 called with array=[3,4,5,6,7,8,9,10,] and n=8 6 | outter function called with j=8 7 | inner function called with i=64 8 | inner function called with i=8 9 | inner function called with i=1 10 | inner function called with i=0 11 | function decalaration: 3*5=15 12 | extern function decalaration test:abs(-4)=4 13 | -------------------------------------------------------------------------------- /unit_test/initialize.c: -------------------------------------------------------------------------------- 1 | int printf(const char *format,...); 2 | 3 | // Test 4 | int main() 5 | { 6 | float i=5.5666; 7 | printf("i=%f\n", i); 8 | double i2 = 4.444; 9 | printf("i2=%f\n",i2); 10 | char j = 49; 11 | printf("j=%c\n", j); 12 | int k = 5; 13 | printf("k=%d\n", k); 14 | char s[5] = "5\t6\n"; 15 | s[2] = 33; 16 | printf("%s", s); 17 | return 0; 18 | } -------------------------------------------------------------------------------- /unit_test/initialize.txt: -------------------------------------------------------------------------------- 1 | i=5.566600 2 | i2=4.444000 3 | j=1 4 | k=5 5 | 5 ! 6 | -------------------------------------------------------------------------------- /unit_test/loop.c: -------------------------------------------------------------------------------- 1 | int printf(const char *format,...); 2 | 3 | void for_test_1() 4 | { 5 | int data[6]={4,5,6,7,8,9}; 6 | int sum = 0; 7 | for(int i=0; i<6; i++){ 8 | sum += data[i]; 9 | } 10 | printf("for test 1: sum=%d\n",sum); 11 | } 12 | 13 | void for_test_2() 14 | { 15 | printf("for test 2:"); 16 | for(int m=100; m<=200; m=m+3){ 17 | printf("%d,", m); 18 | if((m%11)==0){ 19 | printf("break!"); 20 | break; 21 | } 22 | } 23 | printf("\n"); 24 | } 25 | 26 | void for_test_3() 27 | { 28 | for(int i=0, j=1; i<3; i++){ 29 | j *= 3; 30 | if(i==2){ 31 | printf("j=%d\n",j); 32 | break; 33 | } 34 | } 35 | } 36 | 37 | void while_test_1() 38 | { 39 | printf("while test 1:"); 40 | short i = 1; 41 | while(i<30){ 42 | printf("%d,", i); 43 | i *= 3; 44 | } 45 | printf("\n"); 46 | } 47 | 48 | void while_test_2() 49 | { 50 | printf("while test 2:"); 51 | int result = 1; 52 | int i = 0; 53 | while(i<20){ 54 | i++; 55 | if((i%3)==0){ 56 | continue; 57 | }else if(i>10){ 58 | break; 59 | }else{ 60 | result *= i; 61 | } 62 | } 63 | printf("result=%d\n", result); 64 | } 65 | 66 | void triple_break() 67 | { 68 | int i=0,j=0,k=0; 69 | while(1){ 70 | i++; 71 | while(1){ 72 | j++; 73 | while(1){ 74 | k++; 75 | if(k>3){ 76 | printf("k break,"); 77 | break; 78 | } 79 | } 80 | if(j>3){ 81 | printf("j break,"); 82 | break; 83 | } 84 | } 85 | if(i>3){ 86 | printf("i break"); 87 | break; 88 | } 89 | } 90 | } 91 | 92 | int main() 93 | { 94 | for_test_1(); 95 | for_test_2(); 96 | for_test_3(); 97 | while_test_1(); 98 | while_test_2(); 99 | triple_break(); 100 | return 0; 101 | } 102 | -------------------------------------------------------------------------------- /unit_test/loop.txt: -------------------------------------------------------------------------------- 1 | for test 1: sum=39 2 | for test 2:100,103,106,109,112,115,118,121,break! 3 | j=27 4 | while test 1:1,3,9,27, 5 | while test 2:result=22400 6 | k break,k break,k break,k break,j break,k break,j break,k break,j break,k break,j break,i break -------------------------------------------------------------------------------- /unit_test/pointer.c: -------------------------------------------------------------------------------- 1 | int printf(const char *format,...); 2 | void *malloc(unsigned int num_bytes); 3 | void free(void *ptr); 4 | 5 | void mul(int* i_ptr, int *j_ptr) 6 | { 7 | int k=(*i_ptr) * (*j_ptr); 8 | printf("i=%d, j=%d, i*j=%d\n",*(i_ptr),*(j_ptr),k); 9 | } 10 | 11 | void add(int *a, int i){ 12 | (*a) = (*a) + i; 13 | } 14 | 15 | void swap(int *p1, int *p2) 16 | { 17 | int tmp; 18 | tmp = *p1; 19 | *p1 = *p2; 20 | *p2 = tmp; 21 | } 22 | 23 | int main() 24 | { 25 | //TEST 1 26 | int i=5; 27 | int j=6; 28 | mul(&i, &j); 29 | 30 | //TEST 2 31 | add(&i, 10); 32 | printf("i=%d\n",i); 33 | 34 | //TEST 3 35 | int d1=1,d2=3; 36 | swap(&d1, &d2); 37 | printf("d1=%d, d2=%d\n", d1, d2); 38 | 39 | //TEST 4 40 | int a[4] = {4,5,6,7}; 41 | int *a_ptr = &a[1]; 42 | printf("a[1]=%d\n", *a_ptr); 43 | 44 | //TEST 5 45 | swap(&a[1], &a[3]); 46 | printf("a[1]=%d, a[3]=%d\n", a[1], a[3]); 47 | 48 | //TEST 6 49 | swap(a, &a[2]); 50 | printf("a[0]=%d, a[2]=%d\n", a[0], a[2]); 51 | 52 | //TEST 7 53 | float f = 5.0; 54 | float* f_ptr = &f; 55 | *f_ptr = 7; 56 | printf("f=%f\n", f); 57 | 58 | //TEST 8 59 | int ** a_ptr_ptr = &a_ptr; 60 | printf("a[1] is %d\n", **a_ptr_ptr); 61 | 62 | //TEST 9 63 | double *malloc_ptr=0; 64 | malloc_ptr = malloc(8); 65 | *malloc_ptr = 3.0; 66 | printf("*malloc_ptr=%0.2f\n", *malloc_ptr); 67 | free(malloc_ptr); 68 | 69 | //TEST 10 70 | struct my_struct{ 71 | int i; 72 | double f; 73 | }; 74 | struct my_struct* S=malloc(12); 75 | S->i=3; 76 | S->f=4.4; 77 | printf("S->i=%d,S->f=%0.2f\n", S->i, S->f); 78 | free(S); 79 | 80 | return 0; 81 | } 82 | -------------------------------------------------------------------------------- /unit_test/pointer.txt: -------------------------------------------------------------------------------- 1 | i=5, j=6, i*j=30 2 | i=15 3 | d1=3, d2=1 4 | a[1]=5 5 | a[1]=7, a[3]=5 6 | a[0]=6, a[2]=4 7 | f=7.000000 8 | a[1] is 7 9 | *malloc_ptr=3.00 10 | S->i=3,S->f=4.40 11 | -------------------------------------------------------------------------------- /unit_test/scope.c: -------------------------------------------------------------------------------- 1 | int printf(const char *format,...); 2 | 3 | int i=0; 4 | void scope_test_1() 5 | { 6 | printf("scope test 1:\n"); 7 | printf("global i=%d\n", i); 8 | int i = 1; 9 | printf("inner 1 i=%d\n",i); 10 | if(1){ 11 | int i=2; 12 | printf("inner 2 i=%d\n",i); 13 | while(1){ 14 | int i=3; 15 | printf("inner 3 i=%d\n",i); 16 | if(1){ 17 | break; 18 | } 19 | } 20 | printf("inner 2 i=%d\n",i); 21 | } 22 | printf("inner 1 i=%d\n",i); 23 | } 24 | 25 | 26 | int main() 27 | { 28 | scope_test_1(); 29 | printf("global i=%d\n", i); 30 | return 0; 31 | } -------------------------------------------------------------------------------- /unit_test/scope.txt: -------------------------------------------------------------------------------- 1 | scope test 1: 2 | global i=0 3 | inner 1 i=1 4 | inner 2 i=2 5 | inner 3 i=3 6 | inner 2 i=2 7 | inner 1 i=1 8 | global i=0 9 | -------------------------------------------------------------------------------- /unit_test/select.c: -------------------------------------------------------------------------------- 1 | int printf(const char *format,...); 2 | 3 | int switch_func(int a) { 4 | int b; 5 | switch (a) { 6 | case 1: 7 | b = 1; 8 | case 2: 9 | b = 2; 10 | break; 11 | case 3: 12 | case 4: 13 | b = 4; 14 | break; 15 | case 5: 16 | b = 5; 17 | break; 18 | default: 19 | b = 6; 20 | break; 21 | } 22 | return b; 23 | } 24 | 25 | void switch_test_1() 26 | { 27 | printf("switch test 1:"); 28 | for(int i=1; i<=6; i++){ 29 | printf("%d,", switch_func(i)); 30 | } 31 | printf("\n"); 32 | } 33 | 34 | int if_func(int a) 35 | { 36 | int b=0; 37 | if(a==1){ 38 | b=1; 39 | }else if(a==2){ 40 | b=2; 41 | }else{ 42 | if(a>=3){ 43 | b=3; 44 | if(a==4){ 45 | b=4; 46 | }else{ 47 | b=5; 48 | } 49 | } 50 | } 51 | return b; 52 | } 53 | 54 | void if_test_1() 55 | { 56 | printf("if test 1:"); 57 | for(int a=0; a<5; a++){ 58 | printf("%d,", if_func(a)); 59 | } 60 | printf("\n"); 61 | } 62 | 63 | 64 | int main() 65 | { 66 | switch_test_1(); 67 | if_test_1(); 68 | return 0; 69 | } -------------------------------------------------------------------------------- /unit_test/select.txt: -------------------------------------------------------------------------------- 1 | switch test 1:2,2,4,4,5,6, 2 | if test 1:0,1,2,5,4, 3 | -------------------------------------------------------------------------------- /unit_test/struct.c: -------------------------------------------------------------------------------- 1 | int printf(const char *format,...); 2 | 3 | struct Node 4 | { 5 | int num; 6 | double price; 7 | int *ip; 8 | struct Node* next; 9 | }n,*np; 10 | int main() 11 | { 12 | struct Node n2; 13 | n.num = 1; 14 | int *a=&(n.num); 15 | printf("%d\n", ++n.num); 16 | printf("%d\n", ++(*a)); 17 | printf("%d\n", n.num); 18 | n2.num=n.num*n.num; 19 | printf("%d\n", n2.num); 20 | struct Node* n3; 21 | n3=&n2; 22 | printf("%d\n", n3->num); 23 | int aa=2; 24 | n3->ip = &aa; 25 | printf("%d\n", *n2.ip); 26 | n.next = &n2; 27 | printf("%d\n", n.next->num); 28 | return 0; 29 | } -------------------------------------------------------------------------------- /unit_test/struct.txt: -------------------------------------------------------------------------------- 1 | 2 2 | 3 3 | 3 4 | 9 5 | 9 6 | 2 7 | 9 8 | -------------------------------------------------------------------------------- /unit_test/temp.txt: -------------------------------------------------------------------------------- 1 | 5 2 | 6 3 | 7 4 | 8 5 | 7 6 | 6 7 | 5 8 | 4 9 | 3 10 | b=8 11 | !b=0 12 | !!b=1 13 | !!!b=0 14 | !!!!b=1 15 | ~b=-9 16 | ~~b=8 17 | -------------------------------------------------------------------------------- /unit_test/testcase.py: -------------------------------------------------------------------------------- 1 | _cases = [ 2 | "function.c", #函数测试 3 | "initialize.c", #变量初始化测试 4 | "pointer.c", #指针测试 5 | "assignment_operator.c", # 赋值和运算符测试 6 | "loop.c", # 循环测试 7 | "select.c", # 选择分支测试 8 | "scope.c", # 作用域测试 9 | "struct.c", # 结构体和指针相关测试 10 | "array.c", #数组测试 11 | "unaryop.c", #一元运算符测试 12 | ] 13 | 14 | def cases(): 15 | return ["unit_test/"+case for case in _cases] 16 | -------------------------------------------------------------------------------- /unit_test/unaryop.c: -------------------------------------------------------------------------------- 1 | int printf(const char *format,...); 2 | 3 | int main(){ 4 | int a = 4; 5 | while(a++<7) 6 | printf("%d\n", a); 7 | do{ 8 | printf("%d\n", a); 9 | a--; 10 | }while(a>2); 11 | int b=8; 12 | printf("b=%d\n", b); 13 | printf("!b=%d\n", !b); 14 | printf("!!b=%d\n", !!b); 15 | printf("!!!b=%d\n", !!!b); 16 | printf("!!!!b=%d\n", !!!!b); 17 | printf("~b=%d\n", ~b); 18 | printf("~~b=%d\n", ~~b); 19 | return 0; 20 | } -------------------------------------------------------------------------------- /unit_test/unaryop.txt: -------------------------------------------------------------------------------- 1 | 5 2 | 6 3 | 7 4 | 8 5 | 7 6 | 6 7 | 5 8 | 4 9 | 3 10 | b=8 11 | !b=0 12 | !!b=1 13 | !!!b=0 14 | !!!!b=1 15 | ~b=-9 16 | ~~b=8 17 | --------------------------------------------------------------------------------