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

📄 pl3.output

📁 简介:PL0语言是pascal语言的一个子集。编译VC工程之前
💻 OUTPUT
📖 第 1 页 / 共 3 页
字号:
Grammar

  Number, Line, Rule
    1  33 program -> subprogram '.'
    2  36 @1 -> /* empty */
    3  36 @2 -> /* empty */
    4  36 subprogram -> tmp_cx @1 const_dec var_dec procedure_dec @2 statement
    5  41 const_dec -> CONST const_dec_list ';'
    6  43 const_dec -> /* empty */
    7  45 const_dec_list -> const_dec_list ',' const_def
    8  47 const_dec_list -> const_def
    9  49 const_def -> id '=' NUMBER
   10  53 var_dec -> VAR var_dec_list ';'
   11  55 var_dec -> /* empty */
   12  57 var_dec_list -> var_def
   13  59 var_dec_list -> var_dec_list ',' var_def
   14  61 var_def -> id
   15  63 var_def -> id '(' bound_pair ')'
   16  65 bound_pair -> array_bound ':' array_bound
   17  68 array_bound -> id
   18  70 array_bound -> NUMBER
   19  73 procedure_dec -> procedure_dec PROCEDURE procedure_head subprogram ';'
   20  75 procedure_dec -> /* empty */
   21  77 @3 -> /* empty */
   22  77 procedure_head -> id @3 ';'
   23  79 @4 -> /* empty */
   24  79 procedure_head -> id @4 '(' para_list ')' ';'
   25  81 para_list -> id
   26  83 para_list -> para_list ',' id
   27  85 id -> LEGAL_ID
   28  89 tmp_cx -> /* empty */
   29  92 tmp_jpc -> /* empty */
   30  95 tmp_else -> /* empty */
   31  99 statement -> Cstmt
   32 101 statement -> Ostmt
   33 103 Cstmt -> var_ref COLEQ expression
   34 105 Cstmt -> IF cond THEN tmp_jpc Cstmt tmp_else ELSE Cstmt
   35 106 Cstmt -> BEGINSYM statement_list ENDSYM
   36 107 Cstmt -> CALL id arguments
   37 108 Cstmt -> READ '(' read_list ')'
   38 109 Cstmt -> WRITE '(' write_list ')'
   39 110 Cstmt -> WHILE tmp_cx cond tmp_jpc DO Cstmt
   40 111 Cstmt -> REPEAT tmp_cx statement UNTIL cond
   41 112 Cstmt -> /* empty */
   42 114 Ostmt -> IF cond THEN tmp_jpc statement
   43 116 Ostmt -> IF cond THEN tmp_jpc Cstmt tmp_else ELSE Ostmt
   44 117 Ostmt -> WHILE tmp_cx cond tmp_jpc DO Ostmt
   45 120 statement_list -> statement
   46 122 statement_list -> statement_list ';' statement
   47 125 arguments -> /* empty */
   48 127 arguments -> '(' expression_list ')'
   49 130 var_ref -> id
   50 132 var_ref -> id '(' expression ')'
   51 134 read_list -> var_ref
   52 136 read_list -> read_list ',' var_ref
   53 139 expression_list -> expression
   54 141 expression_list -> expression_list ',' expression
   55 144 write_list -> expression
   56 146 write_list -> write_list ',' expression
   57 149 cond -> ODD expression
   58 151 cond -> expression relation_opr expression
   59 153 relation_opr -> '='
   60 155 relation_opr -> '<'
   61 156 relation_opr -> '>'
   62 157 relation_opr -> '#'
   63 158 relation_opr -> LE
   64 159 relation_opr -> RE
   65 162 expression -> sign term
   66 164 expression -> expression add_opr term
   67 167 sign -> '+'
   68 169 sign -> '-'
   69 170 sign -> /* empty */
   70 172 add_opr -> '+'
   71 174 add_opr -> '-'
   72 176 multi_opr -> '*'
   73 178 multi_opr -> '/'
   74 180 term -> factor
   75 182 term -> term multi_opr factor
   76 184 factor -> var_ref
   77 186 factor -> NUMBER
   78 187 factor -> '(' expression ')'


Terminals, with rules where they appear

$ (-1)
'#' (35) 62
'(' (40) 15 24 37 38 48 50 78
')' (41) 15 24 37 38 48 50 78
'*' (42) 72
'+' (43) 67 70
',' (44) 7 13 26 52 54 56
'-' (45) 68 71
'.' (46) 1
'/' (47) 73
':' (58) 16
';' (59) 5 10 19 22 24 46
'<' (60) 60
'=' (61) 9 59
'>' (62) 61
error (256)
BEGINSYM (257) 35
ENDSYM (258) 35
CONST (259) 5
VAR (260) 10
PROCEDURE (261) 19
REPEAT (262) 40
UNTIL (263) 40
WHILE (264) 39 44
CALL (265) 36
DO (266) 39 44
READ (267) 37
WRITE (268) 38
COLEQ (269) 33
ODD (270) 57
LEGAL_ID (271) 27
NUMBER (272) 9 18 77
LE (273) 63
RE (274) 64
IF (275) 34 42 43
THEN (276) 34 42 43
ELSE (277) 34 43


Nonterminals, with rules where they appear

program (38)
    on left: 1
subprogram (39)
    on left: 4, on right: 1 19
@1 (40)
    on left: 2, on right: 4
@2 (41)
    on left: 3, on right: 4
const_dec (42)
    on left: 5 6, on right: 4
const_dec_list (43)
    on left: 7 8, on right: 5 7
const_def (44)
    on left: 9, on right: 7 8
var_dec (45)
    on left: 10 11, on right: 4
var_dec_list (46)
    on left: 12 13, on right: 10 13
var_def (47)
    on left: 14 15, on right: 12 13
bound_pair (48)
    on left: 16, on right: 15
array_bound (49)
    on left: 17 18, on right: 16
procedure_dec (50)
    on left: 19 20, on right: 4 19
procedure_head (51)
    on left: 22 24, on right: 19
@3 (52)
    on left: 21, on right: 22
@4 (53)
    on left: 23, on right: 24
para_list (54)
    on left: 25 26, on right: 24 26
id (55)
    on left: 27, on right: 9 14 15 17 22 24 25 26 36 49 50
tmp_cx (56)
    on left: 28, on right: 4 39 40 44
tmp_jpc (57)
    on left: 29, on right: 34 39 42 43 44
tmp_else (58)
    on left: 30, on right: 34 43
statement (59)
    on left: 31 32, on right: 4 40 42 45 46
Cstmt (60)
    on left: 33 34 35 36 37 38 39 40 41, on right: 31 34 39 43
Ostmt (61)
    on left: 42 43 44, on right: 32 43 44
statement_list (62)
    on left: 45 46, on right: 35 46
arguments (63)
    on left: 47 48, on right: 36
var_ref (64)
    on left: 49 50, on right: 33 51 52 76
read_list (65)
    on left: 51 52, on right: 37 52
expression_list (66)
    on left: 53 54, on right: 48 54
write_list (67)
    on left: 55 56, on right: 38 56
cond (68)
    on left: 57 58, on right: 34 39 40 42 43 44
relation_opr (69)
    on left: 59 60 61 62 63 64, on right: 58
expression (70)
    on left: 65 66, on right: 33 50 53 54 55 56 57 58 66 78
sign (71)
    on left: 67 68 69, on right: 65
add_opr (72)
    on left: 70 71, on right: 66
multi_opr (73)
    on left: 72 73, on right: 75
term (74)
    on left: 74 75, on right: 65 66 75
factor (75)
    on left: 76 77 78, on right: 74 75


state 0

    $default	reduce using rule 28 (tmp_cx)

    program	go to state 139
    subprogram	go to state 1
    tmp_cx	go to state 2



state 1

    program  ->  subprogram . '.'   (rule 1)

    '.' 	shift, and go to state 3



state 2

    subprogram  ->  tmp_cx . @1 const_dec var_dec procedure_dec @2 statement   (rule 4)

    $default	reduce using rule 2 (@1)

    @1  	go to state 4



state 3

    program  ->  subprogram '.' .   (rule 1)

    $default	reduce using rule 1 (program)



state 4

    subprogram  ->  tmp_cx @1 . const_dec var_dec procedure_dec @2 statement   (rule 4)

    CONST	shift, and go to state 5

    $default	reduce using rule 6 (const_dec)

    const_dec	go to state 6



state 5

    const_dec  ->  CONST . const_dec_list ';'   (rule 5)

    LEGAL_ID	shift, and go to state 7

    const_dec_list	go to state 8
    const_def	go to state 9
    id  	go to state 10



state 6

    subprogram  ->  tmp_cx @1 const_dec . var_dec procedure_dec @2 statement   (rule 4)

    VAR 	shift, and go to state 11

    $default	reduce using rule 11 (var_dec)

    var_dec	go to state 12



state 7

    id  ->  LEGAL_ID .   (rule 27)

    $default	reduce using rule 27 (id)



state 8

    const_dec  ->  CONST const_dec_list . ';'   (rule 5)
    const_dec_list  ->  const_dec_list . ',' const_def   (rule 7)

    ';' 	shift, and go to state 13
    ',' 	shift, and go to state 14



state 9

    const_dec_list  ->  const_def .   (rule 8)

    $default	reduce using rule 8 (const_dec_list)



state 10

    const_def  ->  id . '=' NUMBER   (rule 9)

    '=' 	shift, and go to state 15



state 11

    var_dec  ->  VAR . var_dec_list ';'   (rule 10)

    LEGAL_ID	shift, and go to state 7

    var_dec_list	go to state 16
    var_def	go to state 17
    id  	go to state 18



state 12

    subprogram  ->  tmp_cx @1 const_dec var_dec . procedure_dec @2 statement   (rule 4)

    $default	reduce using rule 20 (procedure_dec)

    procedure_dec	go to state 19



state 13

    const_dec  ->  CONST const_dec_list ';' .   (rule 5)

    $default	reduce using rule 5 (const_dec)



state 14

    const_dec_list  ->  const_dec_list ',' . const_def   (rule 7)

    LEGAL_ID	shift, and go to state 7

    const_def	go to state 20
    id  	go to state 10



state 15

    const_def  ->  id '=' . NUMBER   (rule 9)

    NUMBER	shift, and go to state 21



state 16

    var_dec  ->  VAR var_dec_list . ';'   (rule 10)
    var_dec_list  ->  var_dec_list . ',' var_def   (rule 13)

    ';' 	shift, and go to state 22
    ',' 	shift, and go to state 23



state 17

    var_dec_list  ->  var_def .   (rule 12)

    $default	reduce using rule 12 (var_dec_list)



state 18

    var_def  ->  id .   (rule 14)
    var_def  ->  id . '(' bound_pair ')'   (rule 15)

    '(' 	shift, and go to state 24

    $default	reduce using rule 14 (var_def)



state 19

    subprogram  ->  tmp_cx @1 const_dec var_dec procedure_dec . @2 statement   (rule 4)
    procedure_dec  ->  procedure_dec . PROCEDURE procedure_head subprogram ';'   (rule 19)

    PROCEDURE	shift, and go to state 25

    $default	reduce using rule 3 (@2)

    @2  	go to state 26



state 20

    const_dec_list  ->  const_dec_list ',' const_def .   (rule 7)

    $default	reduce using rule 7 (const_dec_list)



state 21

    const_def  ->  id '=' NUMBER .   (rule 9)

    $default	reduce using rule 9 (const_def)



state 22

    var_dec  ->  VAR var_dec_list ';' .   (rule 10)

    $default	reduce using rule 10 (var_dec)



state 23

    var_dec_list  ->  var_dec_list ',' . var_def   (rule 13)

    LEGAL_ID	shift, and go to state 7

    var_def	go to state 27
    id  	go to state 18



state 24

    var_def  ->  id '(' . bound_pair ')'   (rule 15)

    LEGAL_ID	shift, and go to state 7
    NUMBER	shift, and go to state 28

    bound_pair	go to state 29
    array_bound	go to state 30
    id  	go to state 31



state 25

    procedure_dec  ->  procedure_dec PROCEDURE . procedure_head subprogram ';'   (rule 19)

    LEGAL_ID	shift, and go to state 7

    procedure_head	go to state 32
    id  	go to state 33



state 26

    subprogram  ->  tmp_cx @1 const_dec var_dec procedure_dec @2 . statement   (rule 4)

    BEGINSYM	shift, and go to state 34
    REPEAT	shift, and go to state 35
    WHILE	shift, and go to state 36
    CALL	shift, and go to state 37
    READ	shift, and go to state 38
    WRITE	shift, and go to state 39
    LEGAL_ID	shift, and go to state 7
    IF  	shift, and go to state 40

    $default	reduce using rule 41 (Cstmt)

    id  	go to state 41
    statement	go to state 42
    Cstmt	go to state 43
    Ostmt	go to state 44
    var_ref	go to state 45



state 27

    var_dec_list  ->  var_dec_list ',' var_def .   (rule 13)

    $default	reduce using rule 13 (var_dec_list)



state 28

    array_bound  ->  NUMBER .   (rule 18)

    $default	reduce using rule 18 (array_bound)



state 29

    var_def  ->  id '(' bound_pair . ')'   (rule 15)

    ')' 	shift, and go to state 46



state 30

    bound_pair  ->  array_bound . ':' array_bound   (rule 16)

    ':' 	shift, and go to state 47



state 31

    array_bound  ->  id .   (rule 17)

    $default	reduce using rule 17 (array_bound)



state 32

    procedure_dec  ->  procedure_dec PROCEDURE procedure_head . subprogram ';'   (rule 19)

    $default	reduce using rule 28 (tmp_cx)

    subprogram	go to state 48
    tmp_cx	go to state 2



state 33

    procedure_head  ->  id . @3 ';'   (rule 22)
    procedure_head  ->  id . @4 '(' para_list ')' ';'   (rule 24)

    '(' 	reduce using rule 23 (@4)
    $default	reduce using rule 21 (@3)
    @3  	go to state 49
    @4  	go to state 50



state 34

    Cstmt  ->  BEGINSYM . statement_list ENDSYM   (rule 35)

    BEGINSYM	shift, and go to state 34
    REPEAT	shift, and go to state 35
    WHILE	shift, and go to state 36
    CALL	shift, and go to state 37
    READ	shift, and go to state 38
    WRITE	shift, and go to state 39
    LEGAL_ID	shift, and go to state 7
    IF  	shift, and go to state 40

    $default	reduce using rule 41 (Cstmt)

    id  	go to state 41
    statement	go to state 51
    Cstmt	go to state 43
    Ostmt	go to state 44
    statement_list	go to state 52
    var_ref	go to state 45



state 35

    Cstmt  ->  REPEAT . tmp_cx statement UNTIL cond   (rule 40)

    $default	reduce using rule 28 (tmp_cx)

    tmp_cx	go to state 53

⌨️ 快捷键说明

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