|
1 " |
|
2 Copyright (C) 2015-now Jan Vrany |
|
3 |
|
4 This code is not an open-source (yet). You may use this code |
|
5 for your own experiments and projects, given that: |
|
6 |
|
7 * all modification to the code will be sent to the |
|
8 original author for inclusion in future releases |
|
9 * this is not used in any commercial software |
|
10 |
|
11 This license is provisional and may (will) change in |
|
12 a future. |
|
13 " |
1 "{ Package: 'jv:tea/compiler' }" |
14 "{ Package: 'jv:tea/compiler' }" |
2 |
15 |
3 "{ NameSpace: Smalltalk }" |
16 "{ NameSpace: Smalltalk }" |
4 |
17 |
5 Object subclass:#TCompilerContext |
18 TObjectWithProperties subclass:#TCompilerContext |
6 instanceVariableNames:'environment unit module' |
19 instanceVariableNames:'options environment unit' |
7 classVariableNames:'' |
20 classVariableNames:'' |
8 poolDictionaries:'' |
21 poolDictionaries:'' |
9 category:'Languages-Tea-Compiler' |
22 category:'Languages-Tea-Compiler' |
10 ! |
23 ! |
|
24 |
|
25 !TCompilerContext class methodsFor:'documentation'! |
|
26 |
|
27 copyright |
|
28 " |
|
29 Copyright (C) 2015-now Jan Vrany |
|
30 |
|
31 This code is not an open-source (yet). You may use this code |
|
32 for your own experiments and projects, given that: |
|
33 |
|
34 * all modification to the code will be sent to the |
|
35 original author for inclusion in future releases |
|
36 * this is not used in any commercial software |
|
37 |
|
38 This license is provisional and may (will) change in |
|
39 a future. |
|
40 " |
|
41 ! ! |
11 |
42 |
12 !TCompilerContext methodsFor:'accessing'! |
43 !TCompilerContext methodsFor:'accessing'! |
13 |
44 |
14 environment |
45 environment |
15 ^ environment |
46 ^ environment |
17 |
48 |
18 environment:aTNamespaceDefinition |
49 environment:aTNamespaceDefinition |
19 environment := aTNamespaceDefinition. |
50 environment := aTNamespaceDefinition. |
20 ! |
51 ! |
21 |
52 |
22 module |
53 options |
23 module isNil ifTrue:[ |
54 options isNil ifTrue:[ |
24 module := LLVMModule newWithName: unit name. |
55 options := TCompilerOptions new |
25 ]. |
56 ]. |
26 ^ module |
57 ^ self. |
27 |
58 |
28 "Modified: / 30-08-2015 / 09:25:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
59 "Created: / 24-09-2015 / 16:17:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
60 ! |
|
61 |
|
62 options: aTCompilerOptions |
|
63 options := aTCompilerOptions |
|
64 |
|
65 "Created: / 24-09-2015 / 16:17:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
29 ! |
66 ! |
30 |
67 |
31 unit |
68 unit |
32 ^ unit |
69 ^ unit |
33 ! |
70 ! |
34 |
71 |
35 unit:aTCompilationUnit |
72 unit:aTCompilationUnit |
36 unit := aTCompilationUnit. |
73 unit := aTCompilationUnit. |
|
74 ! ! |
|
75 |
|
76 !TCompilerContext methodsFor:'accessing - llvm'! |
|
77 |
|
78 llvmModule |
|
79 | module | |
|
80 |
|
81 module := self propertyAt: #llvmModule ifAbsentPut: [ nil ]. |
|
82 module isNil ifTrue:[ |
|
83 module := LLVMModule newWithName: unit name. |
|
84 self llvmModule: module. |
|
85 ]. |
|
86 ^ module. |
|
87 |
|
88 "Created: / 24-09-2015 / 16:18:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
89 ! |
|
90 |
|
91 llvmModule: anLLVMModule |
|
92 ^ self propertyAt: #llvmModule put: anLLVMModule |
|
93 |
|
94 "Created: / 24-09-2015 / 17:05:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
37 ! ! |
95 ! ! |
38 |
96 |
39 !TCompilerContext methodsFor:'error reporting'! |
97 !TCompilerContext methodsFor:'error reporting'! |
40 |
98 |
41 reportSemanticError: message |
99 reportSemanticError: message |