文件名称:compiler2
介绍说明--下载内容均来自于网络,请自行研究使用
语法分析(一)
在实验一的基础上,对符号表中的单词采用自顶向下的分析方法进行语法分析,对不符合给定的文法的字符串,给出错误信息。
内容:给定描述语法的文法为:
E→E+T|E-T|T
T→T*F|T/F|F
F→i
注:i为实验一中分析得到的整型数值型数据,+、-、*和/为实验一文法二所描述的算符。
使用的数据结构:
1.定义一个结构体,利用该结构体定义一个数组stable,用来存放字符串中字符的属性(类型class和值value)。(与实验一同用)
2.定义一个整型数组eft,大小与stable数组相同,记录对应单词是否是错误。
3.定义一个三维字符数组:用来存放分析表。-Parsing (a) on the basis of experiment, using the word in the symbol table parsing top-down analysis methods that do not meet the string of a given grammar, given the error message. : Grammar describes the syntax given: E → E+T | ET | the TT → T* F | T/F, | the FF → i Note: i is an integer numeric data analysis experiment,+,-,* and/experiment grammar described by the two operators. The data structures used: 1. Define a structure, the structure is defined an array of stable, used to store the characters in the string attributes (type, class and value value). (Together with the experimental use) 2. Define an integer array eft, the size of the stable array of the same record the corresponding word is wrong. 3. Define a three-dimensional array of characters: used to store the analysis table.
在实验一的基础上,对符号表中的单词采用自顶向下的分析方法进行语法分析,对不符合给定的文法的字符串,给出错误信息。
内容:给定描述语法的文法为:
E→E+T|E-T|T
T→T*F|T/F|F
F→i
注:i为实验一中分析得到的整型数值型数据,+、-、*和/为实验一文法二所描述的算符。
使用的数据结构:
1.定义一个结构体,利用该结构体定义一个数组stable,用来存放字符串中字符的属性(类型class和值value)。(与实验一同用)
2.定义一个整型数组eft,大小与stable数组相同,记录对应单词是否是错误。
3.定义一个三维字符数组:用来存放分析表。-Parsing (a) on the basis of experiment, using the word in the symbol table parsing top-down analysis methods that do not meet the string of a given grammar, given the error message. : Grammar describes the syntax given: E → E+T | ET | the TT → T* F | T/F, | the FF → i Note: i is an integer numeric data analysis experiment,+,-,* and/experiment grammar described by the two operators. The data structures used: 1. Define a structure, the structure is defined an array of stable, used to store the characters in the string attributes (type, class and value value). (Together with the experimental use) 2. Define an integer array eft, the size of the stable array of the same record the corresponding word is wrong. 3. Define a three-dimensional array of characters: used to store the analysis table.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
compiler2.c