Added standalone Tea compiler - teak
It allows for compilation of .tea files from the command line.
"
Copyright (C) 2015-now Jan Vrany
This code is not an open-source (yet). You may use this code
for your own experiments and projects, given that:
* all modification to the code will be sent to the
original author for inclusion in future releases
* this is not used in any commercial software
This license is provisional and may (will) change in
a future.
"
"{ Package: 'jv:tea/compiler' }"
"{ NameSpace: Smalltalk }"
TObjectWithProperties subclass:#TCompilerContext
instanceVariableNames:'options environment unit'
classVariableNames:''
poolDictionaries:''
category:'Languages-Tea-Compiler'
!
!TCompilerContext class methodsFor:'documentation'!
copyright
"
Copyright (C) 2015-now Jan Vrany
This code is not an open-source (yet). You may use this code
for your own experiments and projects, given that:
* all modification to the code will be sent to the
original author for inclusion in future releases
* this is not used in any commercial software
This license is provisional and may (will) change in
a future.
"
! !
!TCompilerContext methodsFor:'accessing'!
environment
^ environment
!
environment:aTNamespaceDefinition
environment := aTNamespaceDefinition.
!
options
options isNil ifTrue:[
options := TCompilerOptions new
].
^ self.
"Created: / 24-09-2015 / 16:17:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
options: aTCompilerOptions
options := aTCompilerOptions
"Created: / 24-09-2015 / 16:17:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
unit
^ unit
!
unit:aTCompilationUnit
unit := aTCompilationUnit.
! !
!TCompilerContext methodsFor:'accessing - llvm'!
llvmModule
| module |
module := self propertyAt: #llvmModule ifAbsentPut: [ nil ].
module isNil ifTrue:[
module := LLVMModule newWithName: unit name.
self llvmModule: module.
].
^ module.
"Created: / 24-09-2015 / 16:18:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
llvmModule: anLLVMModule
^ self propertyAt: #llvmModule put: anLLVMModule
"Created: / 24-09-2015 / 17:05:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!TCompilerContext methodsFor:'error reporting'!
reportSemanticError: message
TCompilerError raiseErrorString: message
"Created: / 20-09-2015 / 06:13:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
reportTypeError: message
TCompilerError raiseErrorString: message
"Created: / 14-09-2015 / 14:20:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !