Last active
August 29, 2015 14:15
-
-
Save junr03/6f85c3315fd259eea217 to your computer and use it in GitHub Desktop.
Compilers Assignment 3 Test 1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Thanks to Peter H. Frohlich |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
strict digraph CST { | |
L0 [label="Program",shape=box] | |
L1 [label="PROGRAM",shape=diamond] | |
L0 -> L1 | |
L2 [label="As3",shape=diamond] | |
L0 -> L2 | |
L3 [label=";",shape=diamond] | |
L0 -> L3 | |
L4 [label="Declarations",shape=box] | |
L0 -> L4 | |
L5 [label="ConstDecl",shape=box] | |
L4 -> L5 | |
L6 [label="CONST",shape=diamond] | |
L5 -> L6 | |
L7 [label="x",shape=diamond] | |
L5 -> L7 | |
L8 [label="=",shape=diamond] | |
L5 -> L8 | |
L9 [label="Expression",shape=box] | |
L5 -> L9 | |
L10 [label="-",shape=diamond] | |
L9 -> L10 | |
L11 [label="Term",shape=box] | |
L9 -> L11 | |
L12 [label="Factor",shape=box] | |
L11 -> L12 | |
L13 [label="47",shape=diamond] | |
L12 -> L13 | |
L14 [label=";",shape=diamond] | |
L5 -> L14 | |
L15 [label="TypeDecl",shape=box] | |
L4 -> L15 | |
L16 [label="TYPE",shape=diamond] | |
L15 -> L16 | |
L17 [label="T",shape=diamond] | |
L15 -> L17 | |
L18 [label="=",shape=diamond] | |
L15 -> L18 | |
L19 [label="Type",shape=box] | |
L15 -> L19 | |
L20 [label="RECORD",shape=diamond] | |
L19 -> L20 | |
L21 [label="IdentifierList",shape=box] | |
L19 -> L21 | |
L22 [label="f",shape=diamond] | |
L21 -> L22 | |
L23 [label=":",shape=diamond] | |
L19 -> L23 | |
L24 [label="Type",shape=box] | |
L19 -> L24 | |
L25 [label="INTEGER",shape=diamond] | |
L24 -> L25 | |
L26 [label=";",shape=diamond] | |
L19 -> L26 | |
L27 [label="END",shape=diamond] | |
L19 -> L27 | |
L28 [label=";",shape=diamond] | |
L15 -> L28 | |
L29 [label="VarDecl",shape=box] | |
L4 -> L29 | |
L30 [label="VAR",shape=diamond] | |
L29 -> L30 | |
L31 [label="IdentifierList",shape=box] | |
L29 -> L31 | |
L32 [label="a",shape=diamond] | |
L31 -> L32 | |
L33 [label=":",shape=diamond] | |
L29 -> L33 | |
L34 [label="Type",shape=box] | |
L29 -> L34 | |
L35 [label="ARRAY",shape=diamond] | |
L34 -> L35 | |
L36 [label="Expression",shape=box] | |
L34 -> L36 | |
L37 [label="Term",shape=box] | |
L36 -> L37 | |
L38 [label="Factor",shape=box] | |
L37 -> L38 | |
L39 [label="12",shape=diamond] | |
L38 -> L39 | |
L40 [label="OF",shape=diamond] | |
L34 -> L40 | |
L41 [label="Type",shape=box] | |
L34 -> L41 | |
L42 [label="T",shape=diamond] | |
L41 -> L42 | |
L43 [label=";",shape=diamond] | |
L29 -> L43 | |
L44 [label="BEGIN",shape=diamond] | |
L0 -> L44 | |
L45 [label="Instructions",shape=box] | |
L0 -> L45 | |
L46 [label="Instruction",shape=box] | |
L45 -> L46 | |
L47 [label="Assign",shape=box] | |
L46 -> L47 | |
L48 [label="Designator",shape=box] | |
L47 -> L48 | |
L49 [label="a",shape=diamond] | |
L48 -> L49 | |
L50 [label="Selector",shape=box] | |
L48 -> L50 | |
L51 [label="[",shape=diamond] | |
L50 -> L51 | |
L52 [label="ExpressionList",shape=box] | |
L50 -> L52 | |
L53 [label="Expression",shape=box] | |
L52 -> L53 | |
L54 [label="Term",shape=box] | |
L53 -> L54 | |
L55 [label="Factor",shape=box] | |
L54 -> L55 | |
L56 [label="7",shape=diamond] | |
L55 -> L56 | |
L57 [label="]",shape=diamond] | |
L50 -> L57 | |
L58 [label=".",shape=diamond] | |
L50 -> L58 | |
L59 [label="f",shape=diamond] | |
L50 -> L59 | |
L60 [label=":=",shape=diamond] | |
L47 -> L60 | |
L61 [label="Expression",shape=box] | |
L47 -> L61 | |
L62 [label="-",shape=diamond] | |
L61 -> L62 | |
L63 [label="Term",shape=box] | |
L61 -> L63 | |
L64 [label="Factor",shape=box] | |
L63 -> L64 | |
L65 [label="Designator",shape=box] | |
L64 -> L65 | |
L66 [label="x",shape=diamond] | |
L65 -> L66 | |
L67 [label="Selector",shape=box] | |
L65 -> L67 | |
L68 [label="END",shape=diamond] | |
L0 -> L68 | |
L69 [label="As3",shape=diamond] | |
L0 -> L69 | |
L70 [label=".",shape=diamond] | |
L0 -> L70 | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Program | |
PROGRAM@(0, 6) | |
identifier<As3>@(8, 10) | |
;@(11, 11) | |
Declarations | |
ConstDecl | |
CONST@(13, 17) | |
identifier<x>@(19, 19) | |
=@(21, 21) | |
Expression | |
-@(23, 23) | |
Term | |
Factor | |
integer<47>@(24, 25) | |
;@(26, 26) | |
TypeDecl | |
TYPE@(28, 31) | |
identifier<T>@(33, 33) | |
=@(35, 35) | |
Type | |
RECORD@(37, 42) | |
IdentifierList | |
identifier<f>@(44, 44) | |
:@(45, 45) | |
Type | |
identifier<INTEGER>@(47, 53) | |
;@(54, 54) | |
END@(56, 58) | |
;@(59, 59) | |
VarDecl | |
VAR@(61, 63) | |
IdentifierList | |
identifier<a>@(65, 65) | |
:@(66, 66) | |
Type | |
ARRAY@(68, 72) | |
Expression | |
Term | |
Factor | |
integer<12>@(74, 75) | |
OF@(77, 78) | |
Type | |
identifier<T>@(80, 80) | |
;@(81, 81) | |
BEGIN@(83, 87) | |
Instructions | |
Instruction | |
Assign | |
Designator | |
identifier<a>@(91, 91) | |
Selector | |
[@(92, 92) | |
ExpressionList | |
Expression | |
Term | |
Factor | |
integer<7>@(93, 93) | |
]@(94, 94) | |
.@(95, 95) | |
identifier<f>@(96, 96) | |
:=@(98, 99) | |
Expression | |
-@(101, 101) | |
Term | |
Factor | |
Designator | |
identifier<x>@(102, 102) | |
Selector | |
END@(104, 106) | |
identifier<As3>@(108, 110) | |
.@(111, 111) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PROGRAM As3; | |
CONST x = -47; | |
TYPE T = RECORD f: INTEGER; END; | |
VAR a: ARRAY 12 OF T; | |
BEGIN | |
a[7].f := -x | |
END As3. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment