搜索资源列表
cifafenxi
- 输入:所给文法的源程序字符串 输出:二元组(syn, token或sum)构成的序列。 syn为单词种别码; token为存放的单词自身字符串; sum为整形常数。 例如:对源程序begin x:=9 if x>0 then x:=2*x+1/3 end# 经词法分析后输出如下序列:(1,begin)(10,’x’) (18,:=) (11,9) (26, ) (2,if)-failed to translate
syn
- 语法分析程序,用于分析输入的程序是否符合既定的语法规则,符合规则则成功通过,不符合规则则报出错误原因-Parser for analyzing the input program meets the established rules of grammar, in line with the rules of the successfully passed, does not comply with the rules of the reported cause of the error
词法分析程序
- 词法分析 输入:所给文法的源程序字符串。 输出:二元组(syn,token或sum)构成的序列。(lexical analysis Input: the source code string for the given grammar. Output: a sequence consisting of two tuples (syn, token, or sum).)
编译原理词法分析器
- 2.1 待分析的简单的词法 (1)关键字: begin if then while do end 所有的关键字都是小写。 (2)运算符和界符 : = + - * / < <= <> > >= = ; ( ) # (3)其他单词是标识符(ID)和整型常数(SUM),通过以下正规式定义: ID = letter (letter | digit)* NUM = digit digit* (4)空格有空白、制表符