一种基于LL1文法实现的解释器  

An Interpreter Based on LL1 Grammar

在线阅读下载全文

作  者:刘辉 严碧波[1] LIU hui;YAN Bi-bo(Electronics Information School of Yangtze University,Jingzhou 434023,China)

机构地区:[1]长江大学电子信息学院

出  处:《电脑与信息技术》2019年第5期9-11,15,共4页Computer and Information Technology

摘  要:随着计算机技术的快速发展,越来越多的编程语言出现在了大众的视野中。设计一门新的编程语言,最重要的工作就是实现其对应的编译系统。文章基于LL1文法设计并实现了一款解释器。LL1文法是一种上下文无关的简单文法,使用该文法可以简化解释器的实现过程。解释器主要由前端和后端两大部分组成,前端主要包括词法分析和语法分析,后端主要包括解释执行器和符号表。前端通过词法分析和语法分析将用户的源程序转换成抽象语法树,后端将遍历抽象语法树完成类型检查、符号表的建立以及用户程序的执行。With the rapid development of computer technology,more and more programming languages have appeared in the public's field of vision.To design a new programming language,the most important task is to implement its corresponding compilation system.Therefore,this paper designs and implements an interpreter based on the LL1 grammar.The LL1 grammar is a context-free simple grammar that can be used to simplify the implementation of the interpreter.The interpreter is mainly composed of two parts:the frontend and the backend.The frontend mainly includes lexical analysis and syntax analysis,and the backend mainly includes an explanation executor and a symbol table.The frontend transforms the user's source program into an abstract syntax tree through lexical analysis and parsing.The backend will traverse the abstract syntax tree to complete type checking,symbol table creation,and user program execution.

关 键 词:LL1 解释器 词法分析 语法分析 符号表 

分 类 号:TP314[自动化与计算机技术—计算机软件与理论]

 

参考文献:

正在载入数据...

 

二级参考文献:

正在载入数据...

 

耦合文献:

正在载入数据...

 

引证文献:

正在载入数据...

 

二级引证文献:

正在载入数据...

 

同被引文献:

正在载入数据...

 

相关期刊文献:

正在载入数据...

相关的主题
相关的作者对象
相关的机构对象