编译原理实验:词法分析器
实验意图:掌握对设计一种简单程序设计言语的完整词法分析器所必需具有的方法与技巧。实验请求:1)设计一个简单程序言语的单词标识及其相应种属编码,设计该言语单词的状况转换图并建立该言语的重要字表;2)在程序中实现对该言语中标识符及整型数字的定义;3)熟练掌握从外部文件扫描正文并读入正文符号继而组合单词的技巧,以及掌握准确识别和管理回车和换行等ASC控制码的方法,并可以对源程序进行原样列表;4)建立二元式文件,其间整型数字以二进制模式表明;5)在CRT上输出二元式文件,每行四个二元式,上下对齐;scanner改正后.txt
(Experimental intent: To master the methods and techniques necessary to design a complete lexical analyzer for a simple programming language. Experiment request: 1) Design the word identification of a simple program language and its corresponding species code, design the state transition diagram of the words of the language and establish the important word list of the language; 2) Implement the identifier and the code in the language in the program. Definition of integer numbers; 3) Proficiency in scanning the text from an external file and reading in text symbols to combine words, and mastering the methods of accurately identifying and managing ASC control codes such as carriage return and line feed, and can copy the source program as it is List; 4) Create a binary file, during which the integer numbers are represented in binary mode; 5) Output a binary file on the CRT, four binary files per line, aligned up and down;
Scanner corrected.txt)
页:
[1]