Make 3 + 4 working, though the code is rather messy
...and needs a lot of cleanup. There are no checks for error cases,
no debug info, etc...
"{ Package: 'jv:tea/compiler' }"
"{ NameSpace: Smalltalk }"
Object subclass:#TCompiler
instanceVariableNames:'context'
classVariableNames:''
poolDictionaries:''
category:'Languages-Tea-Compiler'
!
!TCompiler class methodsFor:'compilation'!
compile: unit in: env
self new compile: unit in: env.
"Created: / 29-08-2015 / 14:18:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!TCompiler methodsFor:'accessing'!
context
^ context
!
context:aTCompilerContext
context := aTCompilerContext.
! !
!TCompiler methodsFor:'compilation'!
compile
| unit |
unit := context unit.
self
assert:(unit isRingObject and:[ unit isClass and:[ unit isMeta not ] ]).
self runPass:TSemanticAnalyser.
self runPass:TTypeseeder.
self runPass:TTypechecker.
self runPass:TCodeGenerator.
"Created: / 29-08-2015 / 14:22:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 03-09-2015 / 16:25:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
compile: unit
context unit: unit.
self compile.
"Created: / 29-08-2015 / 21:53:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
compile: unit in: environment
context := TCompilerContext new.
context environment: environment.
context unit: unit.
self context: context.
self compile: unit.
"Created: / 31-08-2015 / 12:27:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!TCompiler methodsFor:'private'!
runPass: aClass
aClass new
context: context;
run
"Created: / 31-08-2015 / 10:51:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!TCompiler class methodsFor:'documentation'!
version
^ 'Path: jv/tea/compiler/TCompiler.st, Version: 1.0, User: jv, Time: 2015-08-31T13:47:55.136+01'
!
version_HG
^ 'Path: jv/tea/compiler/TCompiler.st, Version: 1.0, User: jv, Time: 2015-08-31T13:47:55.136+01'
! !