⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lalr(1)dfa.txt

📁 一个不算完整的编译器实现
💻 TXT
📖 第 1 页 / 共 2 页
字号:
STATE0
program -->  . declaration-list 	|||	$  
通过declaration-list到状态1
通过declaration到状态2
通过var-declaration到状态3
通过fun-declaration到状态4
通过type-specifier到状态5
通过int到状态6
通过void到状态7
通过bool到状态8
STATE1
declaration-list --> declaration-list  . declaration 	|||	int  void  bool  $  
program --> declaration-list 	|||	$  
通过var-declaration到状态3
通过fun-declaration到状态4
通过type-specifier到状态5
通过declaration到状态9
通过int到状态6
通过void到状态7
通过bool到状态8
STATE2
declaration-list --> declaration 	|||	int  void  bool  $  
STATE3
declaration --> var-declaration 	|||	int  void  bool  $  
STATE4
declaration --> fun-declaration 	|||	int  void  bool  $  
STATE5
var-declaration --> type-specifier  . ID ; 	|||	int  void  bool  $  
var-declaration --> type-specifier  . ID [ NUM ] ; 	|||	int  void  bool  $  
fun-declaration --> type-specifier  . ID ( params ) compound-stmt 	|||	int  void  bool  $  
通过ID到状态10
STATE6
type-specifier --> int 	|||	ID  
STATE7
type-specifier --> void 	|||	ID  
STATE8
type-specifier --> bool 	|||	ID  
STATE9
declaration-list --> declaration-list declaration 	|||	int  void  bool  $  
STATE10
var-declaration --> type-specifier ID  . ; 	|||	int  void  bool  $  
var-declaration --> type-specifier ID  . [ NUM ] ; 	|||	int  void  bool  $  
fun-declaration --> type-specifier ID  . ( params ) compound-stmt 	|||	int  void  bool  $  
通过;到状态11
通过[到状态12
通过(到状态13
STATE11
var-declaration --> type-specifier ID ; 	|||	ID  ;  NUM  int  void  bool  (  {  }  if  while  return  -  !  true  false  $  
STATE12
var-declaration --> type-specifier ID [  . NUM ] ; 	|||	ID  ;  NUM  int  void  bool  (  {  }  if  while  return  -  !  true  false  $  
通过NUM到状态14
STATE13
fun-declaration --> type-specifier ID (  . params ) compound-stmt 	|||	int  void  bool  $  
通过param-list到状态16
通过param到状态17
通过type-specifier到状态18
通过params到状态19
通过int到状态6
通过void到状态15
通过bool到状态8
STATE14
var-declaration --> type-specifier ID [ NUM  . ] ; 	|||	ID  ;  NUM  int  void  bool  (  {  }  if  while  return  -  !  true  false  $  
通过]到状态20
STATE15
type-specifier --> void 	|||	ID  
params --> void 	|||	)  
STATE16
params --> param-list 	|||	)  
param-list --> param-list  . , param 	|||	)  ,  
通过,到状态21
STATE17
param-list --> param 	|||	)  ,  
STATE18
param --> type-specifier  . ID 	|||	)  ,  
param --> type-specifier  . ID [ ] 	|||	)  ,  
通过ID到状态22
STATE19
fun-declaration --> type-specifier ID ( params  . ) compound-stmt 	|||	int  void  bool  $  
通过)到状态23
STATE20
var-declaration --> type-specifier ID [ NUM ]  . ; 	|||	ID  ;  NUM  int  void  bool  (  {  }  if  while  return  -  !  true  false  $  
通过;到状态24
STATE21
param-list --> param-list ,  . param 	|||	)  ,  
通过type-specifier到状态18
通过param到状态25
通过int到状态6
通过void到状态7
通过bool到状态8
STATE22
param --> type-specifier ID 	|||	)  ,  
param --> type-specifier ID  . [ ] 	|||	)  ,  
通过[到状态26
STATE23
fun-declaration --> type-specifier ID ( params )  . compound-stmt 	|||	int  void  bool  $  
通过compound-stmt到状态28
通过{到状态27
STATE24
var-declaration --> type-specifier ID [ NUM ] ; 	|||	ID  ;  NUM  int  void  bool  (  {  }  if  while  return  -  !  true  false  $  
STATE25
param-list --> param-list , param 	|||	)  ,  
STATE26
param --> type-specifier ID [  . ] 	|||	)  ,  
通过]到状态29
STATE27
compound-stmt --> {  . local-declarations statement-list } 	|||	ID  ;  NUM  int  void  bool  (  {  }  if  else  while  return  -  !  true  false  $  
通过local-declarations到状态30
通过#到状态31
STATE28
fun-declaration --> type-specifier ID ( params ) compound-stmt 	|||	int  void  bool  $  
STATE29
param --> type-specifier ID [ ] 	|||	)  ,  
STATE30
local-declarations --> local-declarations  . var-declaration 	|||	ID  ;  NUM  int  void  bool  (  {  }  if  while  return  -  !  true  false  
compound-stmt --> { local-declarations  . statement-list } 	|||	ID  ;  NUM  int  void  bool  (  {  }  if  else  while  return  -  !  true  false  $  
通过type-specifier到状态32
通过statement-list到状态33
通过var-declaration到状态35
通过int到状态6
通过void到状态7
通过bool到状态8
通过#到状态34
STATE31
local-declarations --> # 	|||	ID  ;  NUM  int  void  bool  (  {  }  if  while  return  -  !  true  false  
STATE32
var-declaration --> type-specifier  . ID ; 	|||	ID  ;  NUM  int  void  bool  (  {  }  if  while  return  -  !  true  false  
var-declaration --> type-specifier  . ID [ NUM ] ; 	|||	ID  ;  NUM  int  void  bool  (  {  }  if  while  return  -  !  true  false  
通过ID到状态36
STATE33
statement-list --> statement-list  . statement 	|||	ID  ;  NUM  (  {  }  if  while  return  -  !  true  false  
compound-stmt --> { local-declarations statement-list  . } 	|||	ID  ;  NUM  int  void  bool  (  {  }  if  else  while  return  -  !  true  false  $  
通过expression-stmt到状态38
通过compound-stmt到状态39
通过selection-stmt到状态40
通过iteration-stmt到状态41
通过return-stmt到状态42
通过expression到状态43
通过var到状态48
通过simple-expression到状态49
通过additive-expression到状态51
通过term到状态52
通过unary-expression到状态53
通过unaryop到状态54
通过factor到状态55
通过call到状态59
通过constant到状态60
通过statement到状态64
通过{到状态27
通过;到状态44
通过if到状态45
通过while到状态46
通过return到状态47
通过ID到状态50
通过!到状态56
通过-到状态57
通过(到状态58
通过NUM到状态61
通过true到状态62
通过false到状态63
通过}到状态65
STATE34
statement-list --> # 	|||	ID  ;  NUM  (  {  }  if  while  return  -  !  true  false  
STATE35
local-declarations --> local-declarations var-declaration 	|||	ID  ;  NUM  int  void  bool  (  {  }  if  while  return  -  !  true  false  
STATE36
var-declaration --> type-specifier ID  . ; 	|||	ID  ;  NUM  int  void  bool  (  {  }  if  while  return  -  !  true  false  
var-declaration --> type-specifier ID  . [ NUM ] ; 	|||	ID  ;  NUM  int  void  bool  (  {  }  if  while  return  -  !  true  false  
通过;到状态11
通过[到状态12
STATE38
statement --> expression-stmt 	|||	ID  ;  NUM  (  {  }  if  else  while  return  -  !  true  false  
STATE39
statement --> compound-stmt 	|||	ID  ;  NUM  (  {  }  if  else  while  return  -  !  true  false  
STATE40
statement --> selection-stmt 	|||	ID  ;  NUM  (  {  }  if  else  while  return  -  !  true  false  
STATE41
statement --> iteration-stmt 	|||	ID  ;  NUM  (  {  }  if  else  while  return  -  !  true  false  
STATE42
statement --> return-stmt 	|||	ID  ;  NUM  (  {  }  if  else  while  return  -  !  true  false  
STATE43
expression-stmt --> expression  . ; 	|||	ID  ;  NUM  (  {  }  if  else  while  return  -  !  true  false  
通过;到状态69
STATE44
expression-stmt --> ; 	|||	ID  ;  NUM  (  {  }  if  else  while  return  -  !  true  false  
STATE45
selection-stmt --> if  . ( expression ) statement 	|||	ID  ;  NUM  (  {  }  if  else  while  return  -  !  true  false  
selection-stmt --> if  . ( expression ) statement else statement 	|||	ID  ;  NUM  (  {  }  if  else  while  return  -  !  true  false  
通过(到状态70
STATE46
iteration-stmt --> while  . ( expression ) statement 	|||	ID  ;  NUM  (  {  }  if  else  while  return  -  !  true  false  
通过(到状态71
STATE47
return-stmt --> return  . ; 	|||	ID  ;  NUM  (  {  }  if  else  while  return  -  !  true  false  
return-stmt --> return  . expression ; 	|||	ID  ;  NUM  (  {  }  if  else  while  return  -  !  true  false  
通过var到状态48
通过simple-expression到状态49
通过additive-expression到状态51
通过term到状态52
通过unary-expression到状态53
通过unaryop到状态54
通过factor到状态55
通过call到状态59
通过constant到状态60
通过expression到状态73
通过ID到状态50
通过!到状态56
通过-到状态57
通过(到状态58
通过NUM到状态61
通过true到状态62
通过false到状态63
通过;到状态72
STATE48
expression --> var  . = expression 	|||	;  ]  )  ,  
factor --> var 	|||	;  ]  )  ,  <=  <  >  >=  ==  !=  +  -  ||  |  *  /  %  &&  
通过=到状态74
STATE49
expression --> simple-expression 	|||	;  ]  )  ,  
STATE50
var --> ID 	|||	;  ]  )  ,  =  <=  <  >  >=  ==  !=  +  -  ||  |  *  /  %  &&  
var --> ID  . [ expression ] 	|||	;  ]  )  ,  =  <=  <  >  >=  ==  !=  +  -  ||  |  *  /  %  &&  
call --> ID  . ( args ) 	|||	;  ]  )  ,  <=  <  >  >=  ==  !=  +  -  ||  |  *  /  %  &&  
通过[到状态75
通过(到状态76
STATE51
simple-expression --> additive-expression  . relop additive-expression 	|||	;  ]  )  ,  
simple-expression --> additive-expression 	|||	;  ]  )  ,  
additive-expression --> additive-expression  . addop term 	|||	;  ]  )  ,  <=  <  >  >=  ==  !=  +  -  ||  |  
通过relop到状态87
通过addop到状态88
通过<=到状态77
通过<到状态78
通过>到状态79
通过>=到状态80
通过==到状态81
通过!=到状态82
通过+到状态83
通过-到状态84
通过||到状态85
通过|到状态86
STATE52
additive-expression --> term 	|||	;  ]  )  ,  <=  <  >  >=  ==  !=  +  -  ||  |  
term --> term  . mulop unary-expression 	|||	;  ]  )  ,  <=  <  >  >=  ==  !=  +  -  ||  |  *  /  %  &&  
通过mulop到状态93
通过*到状态89
通过/到状态90
通过%到状态91
通过&&到状态92
STATE53
term --> unary-expression 	|||	;  ]  )  ,  <=  <  >  >=  ==  !=  +  -  ||  |  *  /  %  &&  
STATE54
unary-expression --> unaryop  . unary-expression 	|||	;  ]  )  ,  <=  <  >  >=  ==  !=  +  -  ||  |  *  /  %  &&  
通过unaryop到状态54
通过factor到状态55
通过var到状态95
通过call到状态59
通过constant到状态60
通过unary-expression到状态96
通过ID到状态50
通过!到状态56
通过-到状态57
通过(到状态58
通过NUM到状态61
通过true到状态62
通过false到状态63
STATE55
unary-expression --> factor 	|||	;  ]  )  ,  <=  <  >  >=  ==  !=  +  -  ||  |  *  /  %  &&  
STATE56
unaryop --> ! 	|||	ID  NUM  (  -  !  true  false  
STATE57
unaryop --> - 	|||	ID  NUM  (  -  !  true  false  
STATE58
factor --> (  . expression ) 	|||	;  ]  )  ,  <=  <  >  >=  ==  !=  +  -  ||  |  *  /  %  &&  
通过var到状态48
通过simple-expression到状态49
通过additive-expression到状态51
通过term到状态52
通过unary-expression到状态53
通过unaryop到状态54
通过factor到状态55
通过call到状态59
通过constant到状态60
通过expression到状态111
通过ID到状态50
通过!到状态56
通过-到状态57
通过(到状态58
通过NUM到状态61
通过true到状态62
通过false到状态63
STATE59
factor --> call 	|||	;  ]  )  ,  <=  <  >  >=  ==  !=  +  -  ||  |  *  /  %  &&  
STATE60
factor --> constant 	|||	;  ]  )  ,  <=  <  >  >=  ==  !=  +  -  ||  |  *  /  %  &&  
STATE61
constant --> NUM 	|||	;  ]  )  ,  <=  <  >  >=  ==  !=  +  -  ||  |  *  /  %  &&  
STATE62
constant --> true 	|||	;  ]  )  ,  <=  <  >  >=  ==  !=  +  -  ||  |  *  /  %  &&  
STATE63
constant --> false 	|||	;  ]  )  ,  <=  <  >  >=  ==  !=  +  -  ||  |  *  /  %  &&  
STATE64
statement-list --> statement-list statement 	|||	ID  ;  NUM  (  {  }  if  while  return  -  !  true  false  
STATE65
compound-stmt --> { local-declarations statement-list } 	|||	ID  ;  NUM  int  void  bool  (  {  }  if  else  while  return  -  !  true  false  $  
STATE69
expression-stmt --> expression ; 	|||	ID  ;  NUM  (  {  }  if  else  while  return  -  !  true  false  
STATE70
selection-stmt --> if (  . expression ) statement 	|||	ID  ;  NUM  (  {  }  if  else  while  return  -  !  true  false  
selection-stmt --> if (  . expression ) statement else statement 	|||	ID  ;  NUM  (  {  }  if  else  while  return  -  !  true  false  
通过var到状态48
通过simple-expression到状态49
通过additive-expression到状态51
通过term到状态52
通过unary-expression到状态53
通过unaryop到状态54
通过factor到状态55
通过call到状态59
通过constant到状态60
通过expression到状态114
通过ID到状态50
通过!到状态56
通过-到状态57
通过(到状态58
通过NUM到状态61
通过true到状态62
通过false到状态63
STATE71
iteration-stmt --> while (  . expression ) statement 	|||	ID  ;  NUM  (  {  }  if  else  while  return  -  !  true  false  
通过var到状态48
通过simple-expression到状态49
通过additive-expression到状态51

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -