File: A1_10.grm

package info (click to toggle)
hol88 2.02.19940316dfsg-8
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 65,960 kB
  • sloc: ml: 199,939; ansic: 9,666; sh: 6,913; makefile: 6,032; lisp: 2,747; yacc: 894; sed: 201; cpp: 87; awk: 5
file content (90 lines) | stat: -rw-r--r-- 3,564 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
% A1.10 SEQUENCES %

sequence --> [BEGIN] sequence_BE [END] 
           | [(] sequence_br [)].

sequence_BE --> [SEQ] poss_seq_step [OUTPUT] 
                {MK_two(`sequence_BEGINEND`,unit,POP)}.

sequence_br --> [SEQ] poss_seq_step [OUTPUT] 
                {MK_two(`sequence_brackets`,unit,POP)}.

poss_seq_step --> {MK_one(`sequencestep`,sequencestep)} [;] more_seq_steps 
                | {MK_zero(`sequencestep`)}.

more_seq_steps --> {MK_one(`sequencestep`,sequencestep)}
                   {add_to_list(POP,POP)} [;] more_seq_steps 
                 | [].

sequencestep --> [LET] letitem more_letitems {MK_one(`step_LET`,POP)}
               | [VAR] varitem more_varitems {MK_one(`sequencestep_VAR`,POP)}
               | [STATE] [VAR] statevaritem more_statevaritems
                 {MK_one(`sequencestep_STATEVAR`,POP)}
               | [PVAR] statevaritem more_statevaritems
                 {MK_one(`sequencestep_PVAR`,POP)}
               | [PRINT] printitem more_printitems
                 {MK_one(`step_PRINT`,POP)}
               | [FAULT] faultitem more_faultitems
                 {MK_one(`step_FAULT`,POP)}
               | declaration
               | statement.

varitem --> name [:=] {MK_two(`varitem`,POP,unit)}.

more_varitems --> {add_to_list(POP,varitem)} more_varitems | [].

statevaritem --> name init_or_other.

init_or_other --> [INIT] {MK_two(`statevaritem_INIT`,POP,const1)}
                  {MK_one(`statevaritem`,POP)} 
                | [::=] {MK_two(`statevaritem`,POP,const1)}.

more_statevaritems --> {add_to_list(POP,statevaritem)} more_statevaritems | [].

statement --> [IF] boolean [THEN] statement poss_ifseq_else [FI]
            | [CASE] unit [OF] seqchoices poss_caseseq_else [ESAC]
            | [\[] [INT] name [=] int [..] 
              {MK_four(`statement_INT`,POP,POP,int,statement)}
            | [(] statement more_statements [)] {MK_one(`statements`,POP)}
            | {MK_one(`varname`,varname)} [:=] 
              {MK_two(`statement_assign`,POP,unit)}.

poss_ifseq_else --> [ELSE] {MK_three(`statement_cond`,POP,POP,statement)}
                  | {MK_two(`statement_cond`,POP,POP)}.

poss_caseseq_else --> [ELSE] {MK_zero(`statement_ELSEOF`)}
                      {MK_four(`statement_case`,POP,POP,POP,statement)}
                    | [ELSEOF] seqchoices more_seq_elseofs
                    | {MK_zero(`statement_ELSEOF`)} 
                      {MK_three(`statement_case`,POP,POP,POP)}.

more_seq_elseofs --> [ELSEOF] {add_to_list(POP,seqchoices)} 
                     more_seq_elseofs
                   | [ELSE] {MK_one(`statement_ELSEOF`,POP)}
                     {MK_four(`statement_case`,POP,POP,POP,statement)}
                   | {MK_one(`statement_ELSEOF`,POP)}
                     {MK_three(`statement_case`,POP,POP,POP)}.

more_statements --> [;] {add_to_list(POP,statement)} more_statements | [].

seqchoices --> seqchoice more_seqchoices {MK_one(`seqchoices`,POP)}.

seqchoice --> choosers [:] poss_statement.

poss_statement --> {MK_two(`seqchoice`,POP,statement)} 
                 | {MK_one(`seqchoice`,POP)}.

more_seqchoices --> [,] {add_to_list(POP,seqchoice)} more_seqchoices | [].

varname --> name rest_of_varname.

rest_of_varname --> {MK_two(`varname`,POP,name)} rest_of_varname
                  | [\[] var_brackets [\]]
                  | [].

var_brackets --> [\[] {MK_two(`varname_unit`,POP,unit)} [\]] 
                 | int var_int_stuff.

var_int_stuff --> [..] {MK_three(`varname_int_range`,POP,POP,int)} 
                | {MK_two(`varname_int`,POP,POP)}.