文件名称:InputAndOutputOfGrammar

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

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

1、了解文法定义的4个部分:

G(Vn, Vt, S, P)

Vn 文法的非终结符号集合,在实验中用大写的英文字母表示;

Vt 文法的终结符号集合,在实验中用小写的英文字母表示;

S 开始符号,在实验中是Vn集合中的一个元素;

P 产生式,分左部和右部,左部为非终结符号中的一个,右部为终结符号或非终结符号组成的字符串,如S->ab|c

2、根据文法各个部分的性质,设计一个合理的数据结构用来表示文法,

1)若使用C语言编写,则文法可以设计成结构体形式,结构体中应包含上述的4部分,

2)若使用C++语言编写,则文法可以设计成文法类形式,类中至少含有4个数据成员,分别表示上述4个部分

文法数据结构的具体设计由学生根据自己想法完成,并使用C或C++语言实现设计的数据结构。

3、利用完成的数据结构完成以下功能:

1)从文本文件中读入文法(文法事先应写入文本文件);

2)根据文法产生式的结构,分析出文法的4个部分,分别写入定义好的文法数据结构的相应部分;

3)整理文法的结构;

4)在计算机屏幕或者文本框中输出文法,文法输出按照一个非终结符号一行,开始符号引出的产生式写在第一行,同一个非终结符号的候选式用“|”分隔的方式输出。-1 for 4 portions grammar definition:

G (Vn, Vt, S, P)

Vn grammar nonterminal collection, in experiments using uppercase letters that

Vt grammar end set of symbols, in experiments using lowercase letters represent

S start symbol, in the experiment is an element of the set Vn

P production, divided left and right parts, the left part of a non-terminal symbols, the right part of the end of the symbol or symbols of the end of a string, such as S-> ab | c

2, according to the nature of the various parts of the grammar, design a reasonable data structure used to represent the grammar,

1) If you use C language, the grammar can be designed to form a structure, the structure should be included in the above-mentioned four parts,

2) If you are using C++ language, the grammar can be designed in the form of statutory class, class contains at least four data members, respectively, said four portions

The specific design grammar data structures completed by the students according to their
(系统自动生成,下载前可以参看下载内容)

下载文件列表





InputAndOutputOfGrammar.c

相关说明

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

相关评论

暂无评论内容.

发表评论

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

源码中国 www.ymcn.org