文件名称:CP_test_1
介绍说明--下载内容均来自于网络,请自行研究使用
编译原理实验 词法分析
一、实验目的:
通过设计编制调试一个具体的词法分析程序,加深对词法分析原理的理解。并掌握在对程序设计语言源程序进行扫描过程中将其分解为各类单词的词法分析方法。
二、实验内容
编制一个能够分析整数、小数、字符串、标识符、分隔符、运算符和关键字的词法分析程序。同时要能过滤行注释和块注释。
三、实验要求
1、词法规则
关键字: if、then、else、while、do、int、float、string、begin、end
单词类别:1
标识符: 由字母打头的字母数字串。
单词类别:2
整数: 数字串。
单词类别:3
小数: 数字串• 数字串
单词类别:4
字符串: 由一对“”括起来的文本串
单词类别:5
分隔符: {、}、(、)、;、空格
单词类别:5
运算符: :=、=、<、<=、>、>=、+、-、*、/
单词类别:6
2、设计词法分析函数scan( ),完成以下功能:
1)从键盘或文件读入数据,分析出一个单词;
注意:调用一次词法分析函数scan( )只识别出一个单词。
2)返回单词类别、单词本身、所在的行列号;
3、编写测试程序,反复调用函数scan( ),输出单词种别和属性。-Compiler theory lexical analysis experiment
First, the purpose of the experiment :
Design prepared by commissioning a specific lexical analysis program to deepen the understanding of the principles of lexical analysis . And mastery of the programming language source code scanning process will be broken down into various types of word lexical analysis methods .
Second, experimental content
Preparation of an ability to analyze integer, decimal , string, identifier , separator, lexical analysis program operators and keywords. At the same time to be able to filter line comments and block comments.
Third, the experimental requirements
A lexical rules
Keywords : if, then, else, while, do, int, float, string, begin, end
Words Category : 1
Identifier: beginning with the letter alphanumeric string .
Word category: 2
Integer: numeric string .
Words Category : 3
Decimal : numeric string • string of digits
Words Category : 4
String: a pair of " " text string enclosed
一、实验目的:
通过设计编制调试一个具体的词法分析程序,加深对词法分析原理的理解。并掌握在对程序设计语言源程序进行扫描过程中将其分解为各类单词的词法分析方法。
二、实验内容
编制一个能够分析整数、小数、字符串、标识符、分隔符、运算符和关键字的词法分析程序。同时要能过滤行注释和块注释。
三、实验要求
1、词法规则
关键字: if、then、else、while、do、int、float、string、begin、end
单词类别:1
标识符: 由字母打头的字母数字串。
单词类别:2
整数: 数字串。
单词类别:3
小数: 数字串• 数字串
单词类别:4
字符串: 由一对“”括起来的文本串
单词类别:5
分隔符: {、}、(、)、;、空格
单词类别:5
运算符: :=、=、<、<=、>、>=、+、-、*、/
单词类别:6
2、设计词法分析函数scan( ),完成以下功能:
1)从键盘或文件读入数据,分析出一个单词;
注意:调用一次词法分析函数scan( )只识别出一个单词。
2)返回单词类别、单词本身、所在的行列号;
3、编写测试程序,反复调用函数scan( ),输出单词种别和属性。-Compiler theory lexical analysis experiment
First, the purpose of the experiment :
Design prepared by commissioning a specific lexical analysis program to deepen the understanding of the principles of lexical analysis . And mastery of the programming language source code scanning process will be broken down into various types of word lexical analysis methods .
Second, experimental content
Preparation of an ability to analyze integer, decimal , string, identifier , separator, lexical analysis program operators and keywords. At the same time to be able to filter line comments and block comments.
Third, the experimental requirements
A lexical rules
Keywords : if, then, else, while, do, int, float, string, begin, end
Words Category : 1
Identifier: beginning with the letter alphanumeric string .
Word category: 2
Integer: numeric string .
Words Category : 3
Decimal : numeric string • string of digits
Words Category : 4
String: a pair of " " text string enclosed
(系统自动生成,下载前可以参看下载内容)
下载文件列表
CP_test_1\CP_test_1\a.txt
.........\.........\Compiler.cpp
.........\.........\CP_test_1.vcxproj
.........\.........\CP_test_1.vcxproj.filters
.........\.........\Debug\2.obj
.........\.........\.....\CL.read.1.tlog
.........\.........\.....\CL.write.1.tlog
.........\.........\.....\Compiler.obj
.........\.........\.....\Compiler1.obj
.........\.........\.....\CP_test_1.lastbuildstate
.........\.........\.....\CP_test_1.log
.........\.........\.....\..........tlog\CL.read.1.tlog
.........\.........\.....\..............\CL.write.1.tlog
.........\.........\.....\..............\CP_test_1.lastbuildstate
.........\.........\.....\..............\link.read.1.tlog
.........\.........\.....\..............\link.write.1.tlog
.........\.........\.....\link-cvtres.read.1.tlog
.........\.........\.....\link-cvtres.write.1.tlog
.........\.........\.....\link-rc.read.1.tlog
.........\.........\.....\link-rc.write.1.tlog
.........\.........\.....\link.1268-cvtres.read.1.tlog
.........\.........\.....\link.1268-cvtres.write.1.tlog
.........\.........\.....\link.1268-rc.read.1.tlog
.........\.........\.....\link.1268-rc.write.1.tlog
.........\.........\.....\link.1268.read.1.tlog
.........\.........\.....\link.1268.write.1.tlog
.........\.........\.....\link.2068-cvtres.read.1.tlog
.........\.........\.....\link.2068-cvtres.write.1.tlog
.........\.........\.....\link.2068-rc.read.1.tlog
.........\.........\.....\link.2068-rc.write.1.tlog
.........\.........\.....\link.2068.read.1.tlog
.........\.........\.....\link.2068.write.1.tlog
.........\.........\.....\link.2220-cvtres.read.1.tlog
.........\.........\.....\link.2220-cvtres.write.1.tlog
.........\.........\.....\link.2220-rc.read.1.tlog
.........\.........\.....\link.2220-rc.write.1.tlog
.........\.........\.....\link.2220.read.1.tlog
.........\.........\.....\link.2220.write.1.tlog
.........\.........\.....\link.2572-cvtres.read.1.tlog
.........\.........\.....\link.2572-cvtres.write.1.tlog
.........\.........\.....\link.2572-rc.read.1.tlog
.........\.........\.....\link.2572-rc.write.1.tlog
.........\.........\.....\link.2572.read.1.tlog
.........\.........\.....\link.2572.write.1.tlog
.........\.........\.....\link.3172-cvtres.read.1.tlog
.........\.........\.....\link.3172-cvtres.write.1.tlog
.........\.........\.....\link.3172-rc.read.1.tlog
.........\.........\.....\link.3172-rc.write.1.tlog
.........\.........\.....\link.3172.read.1.tlog
.........\.........\.....\link.3172.write.1.tlog
.........\.........\.....\link.3316-cvtres.read.1.tlog
.........\.........\.....\link.3316-cvtres.write.1.tlog
.........\.........\.....\link.3316-rc.read.1.tlog
.........\.........\.....\link.3316-rc.write.1.tlog
.........\.........\.....\link.3316.read.1.tlog
.........\.........\.....\link.3316.write.1.tlog
.........\.........\.....\link.360-cvtres.read.1.tlog
.........\.........\.....\link.360-cvtres.write.1.tlog
.........\.........\.....\link.360-rc.read.1.tlog
.........\.........\.....\link.360-rc.write.1.tlog
.........\.........\.....\link.360.read.1.tlog
.........\.........\.....\link.360.write.1.tlog
.........\.........\.....\link.4656-cvtres.read.1.tlog
.........\.........\.....\link.4656-cvtres.write.1.tlog
.........\.........\.....\link.4656-rc.read.1.tlog
.........\.........\.....\link.4656-rc.write.1.tlog
.........\.........\.....\link.4656.read.1.tlog
.........\.........\.....\link.4656.write.1.tlog
.........\.........\.....\link.5260-cvtres.read.1.tlog
.........\.........\.....\link.5260-cvtres.write.1.tlog
.........\.........\.....\link.5260-rc.read.1.tlog
.........\.........\.....\link.5260-rc.write.1.tlog
.........\.........\.....\link.5260.read.1.tlog
.........\.........\.....\link.5260.write.1.tlog
.........\.........\.....\link.6196-cvtres.read.1.tlog
.........\.........\.....\link.6196-cvtres.write.1.tlog
.........\.........\.....\link.6196-rc.read.1.tlog
.........\.........\.....\link.6196-rc.write.1.tlog
.........\.........\.....\link.6196.read.1.tlog
.........\.........\.....\link.6196.write.1.tlog
.........\.........\.....\link.6284-cvtres.read.1.tlog
.........\.....