文件名称:CP_test_1

  • 所属分类:
  • 编译器/词法分析
  • 资源属性:
  • [C/C++] [源码]
  • 上传时间:
  • 2013-12-09
  • 文件大小:
  • 1.62mb
  • 下载次数:
  • 0次
  • 提 供 者:
  • jc***
  • 相关连接:
  • 下载说明:
  • 别用迅雷下载,失败请重下,重下不扣分!

介绍说明--下载内容均来自于网络,请自行研究使用

编译原理实验 词法分析





一、实验目的:

通过设计编制调试一个具体的词法分析程序,加深对词法分析原理的理解。并掌握在对程序设计语言源程序进行扫描过程中将其分解为各类单词的词法分析方法。



二、实验内容

编制一个能够分析整数、小数、字符串、标识符、分隔符、运算符和关键字的词法分析程序。同时要能过滤行注释和块注释。



三、实验要求

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

.........\.....

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度更多...
  • 请直接用浏览器下载本站内容,不要使用迅雷之类的下载软件,用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.

相关评论

暂无评论内容.

发表评论

*主  题:
*内  容:
*验 证 码:

源码中国 www.ymcn.org