Documentation
¶
Index ¶
- Variables
- func AnalysisToken(input, output string) error
- func CompareTwoFile(res, ans string)
- func GrammarAnalysis(input, output string) error
- func GrammarDeduction()
- func InitTokenSequence()
- func IsConstDef(tkSpecCode string) bool
- func RemoveLeftToken(in, out string)
- func WalkPrintToken(n int)
- func WriteFileLine(str string)
- type Token
Constants ¶
This section is empty.
Variables ¶
View Source
var ( TokenSequence []Token CurPtr = 0 )
View Source
var SpeciesCode = map[string]string{
"": "",
"integer": "INTCON",
"string": "STRCON",
"const": "CONSTTK",
"charc": "CHARCON",
"main": "MAINTK",
"identifier": "IDENFR",
"return": "RETURNTK",
"do": "DOTK",
"void": "VOIDTK",
"for": "FORTK",
"scanf": "SCANFTK",
"int": "INTTK",
"else": "ELSETK",
"char": "CHARTK",
"while": "WHILETK",
"printf": "PRINTFTK",
"if": "IFTK",
"-": "MINU",
"+": "PLUS",
"*": "MULT",
"/": "DIV",
"<": "LSS",
"<=": "LEQ",
">": "GRE",
">=": "GEQ",
"==": "EQL",
"!=": "NEQ",
"=": "ASSIGN",
";": "SEMICN",
",": "COMMA",
"(": "LPARENT",
")": "RPARENT",
"[": "LBRACK",
"]": "RBRACK",
"{": "LBRACE",
"}": "RBRACE",
}
Functions ¶
func AnalysisToken ¶
func CompareTwoFile ¶
func CompareTwoFile(res, ans string)
func GrammarAnalysis ¶
func GrammarDeduction ¶
func GrammarDeduction()
func InitTokenSequence ¶
func InitTokenSequence()
func IsConstDef ¶
tkSpecCode == "IDENFR" || tkSpecCode == "INTCON" || tkSpecCode == "CHARCON" || tkSpecCode == "INTTK" || tkSpecCode =="CHARTK" || tkSpecCode == "ASSIGN" || tkSpecCode == "COMMA" || tkSpecCode == "MINUS" || tkSpecCode == "PLUS"
检查标识符重复错误 只输出,不检查语法,不分析语法错误
func RemoveLeftToken ¶
func RemoveLeftToken(in, out string)
func WalkPrintToken ¶
func WalkPrintToken(n int)
func WriteFileLine ¶
func WriteFileLine(str string)
Types ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.