Make 3 + 4 working, though the code is rather messy
authorJan Vrany <jan.vrany@fit.cvut.cz>
Wed, 02 Sep 2015 18:15:44 +0100
changeset 7 7556e3d41d80
parent 6 0c806a7f1888
child 8 eec72263ed75
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...
compiler/Make.proto
compiler/Make.spec
compiler/TBinding.st
compiler/TBlockType.st
compiler/TClassBinding.st
compiler/TClassDefinition.st
compiler/TCodeGenerator.st
compiler/TCompiler.st
compiler/TCompilerTests.st
compiler/TConstantBinding.st
compiler/TFunctionBinding.st
compiler/TFunctionType.st
compiler/TMetaDefinition.st
compiler/TMethodBinding.st
compiler/TMethodType.st
compiler/TNamespaceBinding.st
compiler/TNamespaceDefinition.st
compiler/TParser.st
compiler/TSemanticAnalyser.st
compiler/TSimpleType.st
compiler/TSourceReader.st
compiler/TType.st
compiler/TTypechecker.st
compiler/TTypeseeder.st
compiler/TUnionType.st
compiler/TUnionTypeNode.st
compiler/TVariableBinding.st
compiler/abbrev.stc
compiler/bc.mak
compiler/jv_tea_compiler.st
compiler/libInit.cc
--- a/compiler/Make.proto	Wed Sep 02 09:18:00 2015 +0100
+++ b/compiler/Make.proto	Wed Sep 02 18:15:44 2015 +0100
@@ -147,24 +147,21 @@
 $(OUTDIR)TTypeNode.$(O) TTypeNode.$(H): TTypeNode.st $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/parser/RBProgramNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)TTypeSpecNode.$(O) TTypeSpecNode.$(H): TTypeSpecNode.st $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/parser/RBProgramNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)jv_tea_compiler.$(O) jv_tea_compiler.$(H): jv_tea_compiler.st $(INCLUDE_TOP)/stx/libbasic/LibraryDefinition.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/ProjectDefinition.$(H) $(STCHDR)
+$(OUTDIR)TBlockType.$(O) TBlockType.$(H): TBlockType.st $(INCLUDE_TOP)/jv/tea/compiler/TType.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)TClassBinding.$(O) TClassBinding.$(H): TClassBinding.st $(INCLUDE_TOP)/jv/tea/compiler/TBinding.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)TCompilerPass.$(O) TCompilerPass.$(H): TCompilerPass.st $(INCLUDE_TOP)/jv/tea/compiler/TProgramNodeVisitor.$(H) $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/parser/RBProgramNodeVisitor.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)TFunctionBinding.$(O) TFunctionBinding.$(H): TFunctionBinding.st $(INCLUDE_TOP)/jv/tea/compiler/TBinding.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
-$(OUTDIR)TFunctionType.$(O) TFunctionType.$(H): TFunctionType.st $(INCLUDE_TOP)/jv/tea/compiler/TType.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)TNamespaceBinding.$(O) TNamespaceBinding.$(H): TNamespaceBinding.st $(INCLUDE_TOP)/jv/tea/compiler/TBinding.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)TSimpleType.$(O) TSimpleType.$(H): TSimpleType.st $(INCLUDE_TOP)/jv/tea/compiler/TType.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)TSimpleTypeNode.$(O) TSimpleTypeNode.$(H): TSimpleTypeNode.st $(INCLUDE_TOP)/jv/tea/compiler/TTypeNode.$(H) $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/parser/RBProgramNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
-$(OUTDIR)TUnionType.$(O) TUnionType.$(H): TUnionType.st $(INCLUDE_TOP)/jv/tea/compiler/TType.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
-$(OUTDIR)TUnionTypeNode.$(O) TUnionTypeNode.$(H): TUnionTypeNode.st $(INCLUDE_TOP)/jv/tea/compiler/TTypeNode.$(H) $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/parser/RBProgramNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)TValueBinding.$(O) TValueBinding.$(H): TValueBinding.st $(INCLUDE_TOP)/jv/tea/compiler/TBinding.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)TBlockBinding.$(O) TBlockBinding.$(H): TBlockBinding.st $(INCLUDE_TOP)/jv/tea/compiler/TBinding.$(H) $(INCLUDE_TOP)/jv/tea/compiler/TFunctionBinding.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
-$(OUTDIR)TBlockType.$(O) TBlockType.$(H): TBlockType.st $(INCLUDE_TOP)/jv/tea/compiler/TFunctionType.$(H) $(INCLUDE_TOP)/jv/tea/compiler/TType.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)TCodeGenerator.$(O) TCodeGenerator.$(H): TCodeGenerator.st $(INCLUDE_TOP)/jv/tea/compiler/TCompilerPass.$(H) $(INCLUDE_TOP)/jv/tea/compiler/TProgramNodeVisitor.$(H) $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/parser/RBProgramNodeVisitor.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)TConstantBinding.$(O) TConstantBinding.$(H): TConstantBinding.st $(INCLUDE_TOP)/jv/tea/compiler/TBinding.$(H) $(INCLUDE_TOP)/jv/tea/compiler/TValueBinding.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)TMethodBinding.$(O) TMethodBinding.$(H): TMethodBinding.st $(INCLUDE_TOP)/jv/tea/compiler/TBinding.$(H) $(INCLUDE_TOP)/jv/tea/compiler/TFunctionBinding.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
-$(OUTDIR)TMethodType.$(O) TMethodType.$(H): TMethodType.st $(INCLUDE_TOP)/jv/tea/compiler/TFunctionType.$(H) $(INCLUDE_TOP)/jv/tea/compiler/TType.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)TSemanticAnalyser.$(O) TSemanticAnalyser.$(H): TSemanticAnalyser.st $(INCLUDE_TOP)/jv/tea/compiler/TCompilerPass.$(H) $(INCLUDE_TOP)/jv/tea/compiler/TProgramNodeVisitor.$(H) $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/parser/RBProgramNodeVisitor.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)TTypechecker.$(O) TTypechecker.$(H): TTypechecker.st $(INCLUDE_TOP)/jv/tea/compiler/TCompilerPass.$(H) $(INCLUDE_TOP)/jv/tea/compiler/TProgramNodeVisitor.$(H) $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/parser/RBProgramNodeVisitor.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)TTypeseeder.$(O) TTypeseeder.$(H): TTypeseeder.st $(INCLUDE_TOP)/jv/tea/compiler/TCompilerPass.$(H) $(INCLUDE_TOP)/jv/tea/compiler/TProgramNodeVisitor.$(H) $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/parser/RBProgramNodeVisitor.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)TVariableBinding.$(O) TVariableBinding.$(H): TVariableBinding.st $(INCLUDE_TOP)/jv/tea/compiler/TBinding.$(H) $(INCLUDE_TOP)/jv/tea/compiler/TValueBinding.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)TArgumentBinding.$(O) TArgumentBinding.$(H): TArgumentBinding.st $(INCLUDE_TOP)/jv/tea/compiler/TBinding.$(H) $(INCLUDE_TOP)/jv/tea/compiler/TValueBinding.$(H) $(INCLUDE_TOP)/jv/tea/compiler/TVariableBinding.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)TLocalBinding.$(O) TLocalBinding.$(H): TLocalBinding.st $(INCLUDE_TOP)/jv/tea/compiler/TBinding.$(H) $(INCLUDE_TOP)/jv/tea/compiler/TValueBinding.$(H) $(INCLUDE_TOP)/jv/tea/compiler/TVariableBinding.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
--- a/compiler/Make.spec	Wed Sep 02 09:18:00 2015 +0100
+++ b/compiler/Make.spec	Wed Sep 02 18:15:44 2015 +0100
@@ -71,24 +71,21 @@
 	TTypeNode \
 	TTypeSpecNode \
 	jv_tea_compiler \
+	TBlockType \
 	TClassBinding \
 	TCompilerPass \
 	TFunctionBinding \
-	TFunctionType \
 	TNamespaceBinding \
 	TSimpleType \
 	TSimpleTypeNode \
-	TUnionType \
-	TUnionTypeNode \
 	TValueBinding \
 	TBlockBinding \
-	TBlockType \
 	TCodeGenerator \
 	TConstantBinding \
 	TMethodBinding \
-	TMethodType \
 	TSemanticAnalyser \
 	TTypechecker \
+	TTypeseeder \
 	TVariableBinding \
 	TArgumentBinding \
 	TLocalBinding \
@@ -117,24 +114,21 @@
     $(OUTDIR_SLASH)TTypeNode.$(O) \
     $(OUTDIR_SLASH)TTypeSpecNode.$(O) \
     $(OUTDIR_SLASH)jv_tea_compiler.$(O) \
+    $(OUTDIR_SLASH)TBlockType.$(O) \
     $(OUTDIR_SLASH)TClassBinding.$(O) \
     $(OUTDIR_SLASH)TCompilerPass.$(O) \
     $(OUTDIR_SLASH)TFunctionBinding.$(O) \
-    $(OUTDIR_SLASH)TFunctionType.$(O) \
     $(OUTDIR_SLASH)TNamespaceBinding.$(O) \
     $(OUTDIR_SLASH)TSimpleType.$(O) \
     $(OUTDIR_SLASH)TSimpleTypeNode.$(O) \
-    $(OUTDIR_SLASH)TUnionType.$(O) \
-    $(OUTDIR_SLASH)TUnionTypeNode.$(O) \
     $(OUTDIR_SLASH)TValueBinding.$(O) \
     $(OUTDIR_SLASH)TBlockBinding.$(O) \
-    $(OUTDIR_SLASH)TBlockType.$(O) \
     $(OUTDIR_SLASH)TCodeGenerator.$(O) \
     $(OUTDIR_SLASH)TConstantBinding.$(O) \
     $(OUTDIR_SLASH)TMethodBinding.$(O) \
-    $(OUTDIR_SLASH)TMethodType.$(O) \
     $(OUTDIR_SLASH)TSemanticAnalyser.$(O) \
     $(OUTDIR_SLASH)TTypechecker.$(O) \
+    $(OUTDIR_SLASH)TTypeseeder.$(O) \
     $(OUTDIR_SLASH)TVariableBinding.$(O) \
     $(OUTDIR_SLASH)TArgumentBinding.$(O) \
     $(OUTDIR_SLASH)TLocalBinding.$(O) \
--- a/compiler/TBinding.st	Wed Sep 02 09:18:00 2015 +0100
+++ b/compiler/TBinding.st	Wed Sep 02 18:15:44 2015 +0100
@@ -9,6 +9,7 @@
 	category:'Languages-Tea-Compiler-Bindings'
 !
 
+
 !TBinding methodsFor:'accessing'!
 
 type
@@ -43,3 +44,10 @@
     ^ false
 ! !
 
+!TBinding class methodsFor:'documentation'!
+
+version_HG
+
+    ^ '$Changeset: <not expanded> $'
+! !
+
--- a/compiler/TBlockType.st	Wed Sep 02 09:18:00 2015 +0100
+++ b/compiler/TBlockType.st	Wed Sep 02 18:15:44 2015 +0100
@@ -2,8 +2,8 @@
 
 "{ NameSpace: Smalltalk }"
 
-TFunctionType subclass:#TBlockType
-	instanceVariableNames:''
+TType subclass:#TBlockType
+	instanceVariableNames:'parameterTypes returnType'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'Languages-Tea-Compiler-Types'
@@ -35,3 +35,11 @@
     "Created: / 31-08-2015 / 09:41:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!TBlockType methodsFor:'testing'!
+
+isBlockType
+    ^ true
+
+    "Created: / 02-09-2015 / 17:09:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
--- a/compiler/TClassBinding.st	Wed Sep 02 09:18:00 2015 +0100
+++ b/compiler/TClassBinding.st	Wed Sep 02 18:15:44 2015 +0100
@@ -3,7 +3,7 @@
 "{ NameSpace: Smalltalk }"
 
 TBinding subclass:#TClassBinding
-	instanceVariableNames:'name instvars methods'
+	instanceVariableNames:'clazz'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'Languages-Tea-Compiler-Bindings'
@@ -11,6 +11,12 @@
 
 !TClassBinding class methodsFor:'instance creation'!
 
+clazz: aTClassDefinition
+    ^ self new initializeWithClazz: aTClassDefinition
+
+    "Created: / 02-09-2015 / 15:57:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 name: aString
     ^ self new initializeWithName: aString
 
@@ -19,20 +25,39 @@
 
 !TClassBinding methodsFor:'accessing'!
 
+clazz
+   ^ clazz
+
+    "Created: / 02-09-2015 / 15:58:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 type
-   ^ TSimpleType named: name
+   ^ TSimpleType named: clazz name
 
     "Created: / 31-08-2015 / 11:45:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 02-09-2015 / 15:56:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !TClassBinding methodsFor:'initialization'!
 
-initializeWithName: aString
-    name := aString.
-    instvars := OrderedCollection new.
-    methods := Set new.
+initializeWithClazz: aTClassDefinition
+    clazz := aTClassDefinition
+
+    "Created: / 02-09-2015 / 15:58:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!TClassBinding methodsFor:'lookup'!
 
-    "Created: / 31-08-2015 / 11:22:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+lookupMethodNamed: selector
+    | method |
+
+    method := clazz methodNamed: selector.
+    method isNil ifTrue:[ 
+        self error: ('Could not resolve method %1 >> #%2' bindWith: clazz name with: selector)  
+    ].
+    ^ method binding
+
+    "Created: / 02-09-2015 / 16:06:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !TClassBinding methodsFor:'testing'!
--- a/compiler/TClassDefinition.st	Wed Sep 02 09:18:00 2015 +0100
+++ b/compiler/TClassDefinition.st	Wed Sep 02 18:15:44 2015 +0100
@@ -12,11 +12,12 @@
 !TClassDefinition methodsFor:'accessing'!
 
 binding
+    binding isNil ifTrue:[ 
+        binding := TClassBinding clazz: self.
+    ].
     ^ binding
-!
 
-binding:aTClassBinding
-    binding := aTClassBinding.
+    "Modified: / 02-09-2015 / 16:02:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !TClassDefinition methodsFor:'behavior'!
--- a/compiler/TCodeGenerator.st	Wed Sep 02 09:18:00 2015 +0100
+++ b/compiler/TCodeGenerator.st	Wed Sep 02 18:15:44 2015 +0100
@@ -121,7 +121,7 @@
     | emitMethodNode emitMethod|
 
     emitMethodNode := RBMethodNode new.
-    emitMethodNode arguments: aTInlineAssemblyNode arguments , { RBVariableNode named: 'zelf' } , aTInlineAssemblyNode topNode arguments.
+    emitMethodNode arguments: (aTInlineAssemblyNode arguments collect:[ :e|e copy]) , { RBVariableNode named: 'zelf' } , (aTInlineAssemblyNode topNode arguments collect:[ :e|e copy]).
     emitMethodNode body: aTInlineAssemblyNode body copy.
     emitMethodNode variableNodesDo:[ :variableNode |
         variableNode name = 'self' ifTrue:[ 
@@ -135,7 +135,7 @@
         arguments: { asm } , ((1 to: function numArgs) collect: [ :i | function parameterAt: i ])
 
     "Created: / 02-09-2015 / 06:53:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 02-09-2015 / 09:14:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 02-09-2015 / 10:30:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 acceptLiteralNode: aLiteralNode
@@ -145,10 +145,20 @@
     "Modified: / 31-08-2015 / 12:20:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
-acceptMessageNode: aMessageNode 
-    self notYetImplemented
+acceptMessageNode: aMessageNode
+    | receiver arguments methodName methodFunction |
+
+    receiver := self visitNode: aMessageNode receiver.
+    receiver := self visitNode: aMessageNode receiver.
+    arguments := aMessageNode arguments collect: [:argument | self visitNode: argument ].
+
+    methodName := self class llvmFunctionNameForClass: aMessageNode binding mclass clazz selector: aMessageNode selector.
+    methodFunction := context module getFunctionNamed: methodName.
+
+    ^ asm call: methodFunction _: { receiver } , arguments
 
     "Created: / 31-08-2015 / 10:13:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 03-09-2015 / 07:13:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 acceptMethodNode: aMethodNode 
@@ -157,13 +167,16 @@
     binding := aMethodNode binding.
     function := context module 
                     addFunctionNamed: (self class llvmFunctionNameForClass: currentClass selector: currentMethod selector)      
-                    type:  (binding type asLLVMTypeInModule: context module).
+                    type: (LLVMType 
+                            function: { binding receiverType asLLVMTypeInModule: context module } ,
+                                       (binding parameterTypes collect:[:t|t asLLVMTypeInModule: context module])
+                            returning: (binding returnType asLLVMTypeInModule: context module)).
     asm := function builder.
     (function parameterAt: 1) name: 'self'.
     super acceptMethodNode: aMethodNode
 
     "Created: / 31-08-2015 / 09:42:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 02-09-2015 / 08:59:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 02-09-2015 / 21:31:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 acceptOptimizedNode: anOptimizedNode 
--- a/compiler/TCompiler.st	Wed Sep 02 09:18:00 2015 +0100
+++ b/compiler/TCompiler.st	Wed Sep 02 18:15:44 2015 +0100
@@ -36,11 +36,12 @@
     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 (format): / 31-08-2015 / 10:51:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 03-09-2015 / 16:25:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 compile: unit
--- a/compiler/TCompilerTests.st	Wed Sep 02 09:18:00 2015 +0100
+++ b/compiler/TCompilerTests.st	Wed Sep 02 18:15:44 2015 +0100
@@ -55,5 +55,40 @@
     "
 
     "Created: / 02-09-2015 / 07:00:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+test_three_plus_four
+    | compiler environment |
+
+    environment := TNamespaceDefinition new.
+    (TSourceReader read:'
+nil subclass: #tSmallInteger
+    category: ''tKernel''
+!!
+!!tSmallInteger methodsFor:''arithmetic''!!
++ another <tSmallInteger> <^ tSmallInteger> 
+    %[:asm | 
+        asm ret: (asm add: self _: another)
+    %].
+    "Following code is actually used only in hosted environment"
+    ^ self + another
+!! !!
+
+!!tSmallInteger methodsFor:''test''!!
+threePlusFour <^ tSmallInteger> 
+        ^ 3 + 4
+
+!! !!
+    ') do:[ :each | environment addElement: each ].
+
+    compiler := TCompiler new.
+    compiler compile: (environment classNamed: 'tSmallInteger') in: environment.
+    self halt.
+    "
+    compiler context module
+    "
+
+    "Created: / 02-09-2015 / 10:25:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 03-09-2015 / 16:53:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
--- a/compiler/TConstantBinding.st	Wed Sep 02 09:18:00 2015 +0100
+++ b/compiler/TConstantBinding.st	Wed Sep 02 18:15:44 2015 +0100
@@ -24,6 +24,17 @@
     ^ value
 ! !
 
+!TConstantBinding methodsFor:'converting'!
+
+asLLVMValueInModule: aLLVMModule
+    value isInteger ifTrue:[ 
+        ^ LLVMConstant sint: value type: (type asLLVMTypeInModule: aLLVMModule ).
+    ].
+    ^ self notYetImplemented
+
+    "Created: / 03-09-2015 / 07:07:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !TConstantBinding methodsFor:'initialization'!
 
 initializeWithValue: anObject
--- a/compiler/TFunctionBinding.st	Wed Sep 02 09:18:00 2015 +0100
+++ b/compiler/TFunctionBinding.st	Wed Sep 02 18:15:44 2015 +0100
@@ -3,7 +3,7 @@
 "{ NameSpace: Smalltalk }"
 
 TBinding subclass:#TFunctionBinding
-	instanceVariableNames:'returnType parameters type'
+	instanceVariableNames:'returnType parameterTypes'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'Languages-Tea-Compiler-Bindings'
@@ -11,15 +11,32 @@
 
 !TFunctionBinding methodsFor:'accessing'!
 
-type
-    ^ type
+parameterTypes
+    ^ parameterTypes
+!
 
-    "Created: / 31-08-2015 / 12:03:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+returnType
+    ^ returnType
 !
 
-type: aTType
-    type := aTType
+type
+    ^ returnType
 
-    "Created: / 31-08-2015 / 12:03:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Created: / 31-08-2015 / 12:03:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 02-09-2015 / 17:02:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!TFunctionBinding methodsFor:'initialization'!
+
+parameterTypes: aCollection
+    parameterTypes := aCollection
+
+    "Created: / 02-09-2015 / 17:03:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+returnType: aTType
+    returnType := aTType
+
+    "Created: / 02-09-2015 / 17:03:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
--- a/compiler/TFunctionType.st	Wed Sep 02 09:18:00 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-"{ Package: 'jv:tea/compiler' }"
-
-"{ NameSpace: Smalltalk }"
-
-TType subclass:#TFunctionType
-	instanceVariableNames:'parameterTypes returnType'
-	classVariableNames:''
-	poolDictionaries:''
-	category:'Languages-Tea-Compiler-Types'
-!
-
-!TFunctionType class methodsFor:'queries'!
-
-isAbstract
-    "Return if this class is an abstract class.
-     True is returned here for myself only; false for subclasses.
-     Abstract subclasses must redefine again."
-
-    ^ self == TFunctionType.
-! !
-
--- a/compiler/TMetaDefinition.st	Wed Sep 02 09:18:00 2015 +0100
+++ b/compiler/TMetaDefinition.st	Wed Sep 02 18:15:44 2015 +0100
@@ -12,11 +12,12 @@
 !TMetaDefinition methodsFor:'accessing'!
 
 binding
+    binding isNil ifTrue:[ 
+        binding := TClassBinding clazz: self.
+    ].
     ^ binding
-!
 
-binding:aTClassBinding
-    binding := aTClassBinding.
+    "Modified: / 02-09-2015 / 16:02:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !TMetaDefinition methodsFor:'instance variables'!
--- a/compiler/TMethodBinding.st	Wed Sep 02 09:18:00 2015 +0100
+++ b/compiler/TMethodBinding.st	Wed Sep 02 18:15:44 2015 +0100
@@ -9,34 +9,29 @@
 	category:'Languages-Tea-Compiler-Bindings'
 !
 
+
 !TMethodBinding class methodsFor:'instance creation'!
 
 class: aTClassDefinition selector: aSymbol
     ^ self new initializeWithClass: aTClassDefinition selector: aSymbol
 
     "Created: / 31-08-2015 / 12:04:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-class: aTClassDefinition selector: aSymbol type: type
-    ^ self new initializeWithClass: aTClassDefinition selector: aSymbol type: type
-
-    "Created: / 31-08-2015 / 12:02:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !TMethodBinding methodsFor:'accessing'!
 
-klass
-    ^ mclass
-
-    "Created: / 31-08-2015 / 12:14:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
 mclass
     ^ mclass
 
     "Created: / 31-08-2015 / 12:14:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
+receiverType
+    ^ mclass type
+
+    "Created: / 02-09-2015 / 21:30:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 selector
     ^ selector
 ! !
@@ -56,3 +51,10 @@
     ^ true
 ! !
 
+!TMethodBinding class methodsFor:'documentation'!
+
+version_HG
+
+    ^ '$Changeset: <not expanded> $'
+! !
+
--- a/compiler/TMethodType.st	Wed Sep 02 09:18:00 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-"{ Package: 'jv:tea/compiler' }"
-
-"{ NameSpace: Smalltalk }"
-
-TFunctionType subclass:#TMethodType
-	instanceVariableNames:'receiverType'
-	classVariableNames:''
-	poolDictionaries:''
-	category:'Languages-Tea-Compiler-Types'
-!
-
-!TMethodType class methodsFor:'instance creation'!
-
-receiver: receiverType parameters: parameterTypes returning: returnType
-    ^ self new initializeWithReceiverType: receiverType parameterTypes: parameterTypes returnType: returnType
-
-    "Created: / 31-08-2015 / 10:39:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!TMethodType methodsFor:'conversions'!
-
-asLLVMTypeInModule: aLLVMModule
-
-    ^ LLVMType 
-        function:  { receiverType asLLVMTypeInModule: aLLVMModule } ,
-                   (parameterTypes collect:[ :t | t asLLVMTypeInModule: aLLVMModule ])
-        returning: (returnType asLLVMTypeInModule: aLLVMModule)
-
-    "Created: / 31-08-2015 / 10:43:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!TMethodType methodsFor:'initialization'!
-
-initializeWithReceiverType: receiverTypeArg parameterTypes: parameterTypesArg returnType: returnTypeArg
-    receiverType := receiverTypeArg.
-    parameterTypes := parameterTypesArg.
-    returnType := returnTypeArg
-
-    "Created: / 31-08-2015 / 10:40:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
--- a/compiler/TNamespaceBinding.st	Wed Sep 02 09:18:00 2015 +0100
+++ b/compiler/TNamespaceBinding.st	Wed Sep 02 18:15:44 2015 +0100
@@ -3,17 +3,56 @@
 "{ NameSpace: Smalltalk }"
 
 TBinding subclass:#TNamespaceBinding
-	instanceVariableNames:'elements'
+	instanceVariableNames:'definition elements'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'Languages-Tea-Compiler-Bindings'
 !
 
-!TNamespaceBinding methodsFor:'conversion'!
+
+!TNamespaceBinding class methodsFor:'instance creation'!
+
+namespace: aTNamespaceDefinition
+    ^ self new initializeWithNamespace: aTNamespaceDefinition
 
-asLLVMValueInModule: anLLVMModule
-    ^ self shouldNotImplement
+    "Created: / 02-09-2015 / 15:59:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
 
-    "Created: / 02-09-2015 / 08:34:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+new
+    "return an initialized instance"
+
+    ^ self basicNew initialize.
 ! !
 
+!TNamespaceBinding methodsFor:'initialization'!
+
+initializeWithNamespace: aTNamespaceDefinition
+    "Invoked when a new instance is created."
+
+    definition := aTNamespaceDefinition.
+
+    "Created: / 02-09-2015 / 15:59:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!TNamespaceBinding methodsFor:'lookup'!
+
+lookupClassNamed: name
+    | class |
+
+    class := definition classNamed: name.
+    class notNil ifTrue:[ 
+        ^ class binding
+    ].
+    self error:('Could not resolve class named %1' bindWith: name)
+
+    "Created: / 02-09-2015 / 11:09:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified (format): / 02-09-2015 / 16:00:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!TNamespaceBinding class methodsFor:'documentation'!
+
+version_HG
+
+    ^ '$Changeset: <not expanded> $'
+! !
+
--- a/compiler/TNamespaceDefinition.st	Wed Sep 02 09:18:00 2015 +0100
+++ b/compiler/TNamespaceDefinition.st	Wed Sep 02 18:15:44 2015 +0100
@@ -12,7 +12,12 @@
 !TNamespaceDefinition methodsFor:'accessing'!
 
 binding
+    binding isNil ifTrue:[ 
+        binding := TNamespaceBinding namespace: self.
+    ].
     ^ binding
+
+    "Modified: / 02-09-2015 / 16:03:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 binding:aTNamespaceBinding
@@ -26,7 +31,7 @@
 
     mclassName := method className.
     (mclassName endsWith: ' class') ifTrue:[ 
-        mclassName := mclassName copyTo: mclassName size - 6.
+        mclassName := (mclassName copyTo: mclassName size - 6) asSymbol.
         mclassIsMeta := true.
     ] ifFalse:[ 
         mclassIsMeta := false.
@@ -38,5 +43,6 @@
     mclass addMethod: method.
 
     "Created: / 31-08-2015 / 17:10:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 03-09-2015 / 15:48:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
--- a/compiler/TParser.st	Wed Sep 02 09:18:00 2015 +0100
+++ b/compiler/TParser.st	Wed Sep 02 18:15:44 2015 +0100
@@ -209,20 +209,12 @@
 
 parseType
     "
-    type ::= type_simple ( '|' type )*
+    type ::= type_simple
     "
-
-    | types |
-    types := OrderedCollection with: self parseTypeSimple.
-    [ currentToken isBinary and:[ currentToken value == #| ] ] whileTrue:[ 
-
-        self step. "/ eat bar.
-        types add: self parseTypeSimple.
-    ].
-    ^ types size == 1 ifTrue:[ types anElement ] ifFalse:[ TUnionTypeNode new types: types ]
+    ^ self parseTypeSimple.
 
     "Created: / 20-08-2015 / 17:18:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 21-08-2015 / 21:12:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 02-09-2015 / 17:01:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 parseTypeSimple
--- a/compiler/TSemanticAnalyser.st	Wed Sep 02 09:18:00 2015 +0100
+++ b/compiler/TSemanticAnalyser.st	Wed Sep 02 18:15:44 2015 +0100
@@ -38,25 +38,12 @@
     "Modified: / 02-09-2015 / 07:20:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
-acceptClassDefinition: aTClassDefinition
-    aTClassDefinition binding: (TClassBinding name: aTClassDefinition name).
-    super acceptClassDefinition: aTClassDefinition
-
-    "Created: / 31-08-2015 / 11:46:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
 acceptLiteralNode: aRBLiteralNode
+    super acceptLiteralNode: aRBLiteralNode.
     aRBLiteralNode binding: (TConstantBinding value: aRBLiteralNode value).
-    super acceptLiteralNode: aRBLiteralNode
 
     "Created: / 25-08-2015 / 23:17:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-acceptMetaclassDefinition: aTClassDefinition
-    aTClassDefinition binding: (TClassBinding name: aTClassDefinition name).
-    super acceptMetaclassDefinition: aTClassDefinition
-
-    "Created: / 31-08-2015 / 11:47:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 02-09-2015 / 10:34:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 acceptMethodNode: aMethodNode
--- a/compiler/TSimpleType.st	Wed Sep 02 09:18:00 2015 +0100
+++ b/compiler/TSimpleType.st	Wed Sep 02 18:15:44 2015 +0100
@@ -61,10 +61,10 @@
     name = 'tSmallInteger' ifTrue:[ 
         ^ LLVMType intptr
     ].                  
-    self notYetImplemented
+    ^ LLVMType void pointer
 
     "Created: / 31-08-2015 / 09:06:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 01-09-2015 / 21:53:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 03-09-2015 / 16:31:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !TSimpleType methodsFor:'initialization'!
@@ -95,5 +95,12 @@
 
 isSimpleType
     ^ true
+!
+
+isSubtypeOf: anotherType
+    "/ Hack for now - types must match exactly...
+    ^ anotherType class == self class and:[ anotherType name = name ]
+
+    "Created: / 02-09-2015 / 17:11:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
--- a/compiler/TSourceReader.st	Wed Sep 02 09:18:00 2015 +0100
+++ b/compiler/TSourceReader.st	Wed Sep 02 18:15:44 2015 +0100
@@ -60,9 +60,21 @@
 processClassDefinition
     | superName className class |
 
-    superName := currentChunkTree receiver name.
+    currentChunkTree receiver isVariable ifTrue:[
+        superName := currentChunkTree receiver name.
+    ] ifFalse:[ 
+        currentChunkTree receiver isLiteral ifTrue:[ 
+            currentChunkTree receiver value isNil ifTrue:[ 
+                superName := nil.
+            ] ifFalse:[ 
+                self error:'Invalid superclass'
+            ].
+        ] ifFalse:[ 
+            self error:'Invalid superclass'
+        ].
+    ].
     className := currentChunkTree arguments first value.
-    class := TClassDefinition new.
+    class := TClassDefinition newClass.
     class superclassName: superName.
     class name: className.
     2 to: currentChunkTree selectorParts size do:[:i | 
@@ -88,7 +100,7 @@
     definitions add: class.
 
     "Created: / 28-08-2015 / 07:16:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 31-08-2015 / 16:53:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 03-09-2015 / 15:50:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 processMethodDefinitions
--- a/compiler/TType.st	Wed Sep 02 09:18:00 2015 +0100
+++ b/compiler/TType.st	Wed Sep 02 18:15:44 2015 +0100
@@ -50,12 +50,20 @@
 
 !TType methodsFor:'testing'!
 
+isBlockType
+    ^ false
+
+    "Created: / 02-09-2015 / 17:09:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 isSimpleType
     ^ false
 !
 
-isUnionType
-    ^ false
+isSubtypeOf: anotherType
+    self subclassResponsibility
+
+    "Created: / 02-09-2015 / 17:09:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !TType class methodsFor:'documentation'!
--- a/compiler/TTypechecker.st	Wed Sep 02 09:18:00 2015 +0100
+++ b/compiler/TTypechecker.st	Wed Sep 02 18:15:44 2015 +0100
@@ -9,24 +9,31 @@
 	category:'Languages-Tea-Compiler'
 !
 
-!TTypechecker methodsFor:'visiting'!
-
-visitArgument: anRBVariableNode
-    super visitArgument: anRBVariableNode.
-    anRBVariableNode binding type: anRBVariableNode typeSpec asType
-
-    "Created: / 31-08-2015 / 11:51:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
 !TTypechecker methodsFor:'visitor-double dispatching'!
 
-acceptMethodNode: aMethodNode 
-    super acceptMethodNode: aMethodNode.
-    aMethodNode binding type:
-        (TMethodType receiver: currentMethod binding mclass type
-                     parameters: (aMethodNode arguments collect: [ :arg | arg binding type ])
-                     returning: aMethodNode returnTypeSpec asType)
+acceptMessageNode: aMessageNode 
+    | receiverType receiverBinding methodBinding |
 
-    "Created: / 31-08-2015 / 12:13:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    super acceptMessageNode: aMessageNode.
+    receiverType := aMessageNode receiver binding type.
+    receiverType isSimpleType ifTrue:[ 
+        receiverBinding := context environment binding lookupClassNamed: receiverType name.
+        methodBinding := receiverBinding lookupMethodNamed: aMessageNode selector.
+        1 to: aMessageNode arguments size do:[:paramIdx |  
+            | actualParamType formalParamType |    
+            actualParamType := (aMessageNode arguments at: paramIdx) binding type.
+            formalParamType := methodBinding parameterTypes at: paramIdx.
+            (actualParamType isSubtypeOf: formalParamType) ifFalse:[ 
+                self error: 'Type mismatch'.
+                ^ self.
+            ].
+        ].
+        aMessageNode binding: methodBinding.
+        ^ self.
+    ].
+    self notYetImplemented
+
+    "Created: / 02-09-2015 / 10:34:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 02-09-2015 / 17:11:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/TTypeseeder.st	Wed Sep 02 18:15:44 2015 +0100
@@ -0,0 +1,32 @@
+"{ Package: 'jv:tea/compiler' }"
+
+"{ NameSpace: Smalltalk }"
+
+TCompilerPass subclass:#TTypeseeder
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	category:'Languages-Tea-Compiler'
+!
+
+!TTypeseeder methodsFor:'visiting'!
+
+visitArgument: anRBVariableNode
+    super visitArgument: anRBVariableNode.
+    anRBVariableNode binding type: anRBVariableNode typeSpec asType
+
+    "Created: / 31-08-2015 / 11:51:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!TTypeseeder methodsFor:'visitor-double dispatching'!
+
+acceptMethodNode: aMethodNode 
+    super acceptMethodNode: aMethodNode.
+    aMethodNode binding 
+            returnType: aMethodNode returnTypeSpec asType;
+            parameterTypes: (aMethodNode arguments collect: [ :arg | arg binding type ])
+
+    "Created: / 31-08-2015 / 12:13:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 02-09-2015 / 17:05:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
--- a/compiler/TUnionType.st	Wed Sep 02 09:18:00 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-"{ Package: 'jv:tea/compiler' }"
-
-"{ NameSpace: Smalltalk }"
-
-TType subclass:#TUnionType
-	instanceVariableNames:'types'
-	classVariableNames:''
-	poolDictionaries:''
-	category:'Languages-Tea-Compiler-Types'
-!
-
-!TUnionType class methodsFor:'instance creation'!
-
-with: type1 with: type2
-    ^ self new initializeWith: type1 and: type2
-
-    "Created: / 21-08-2015 / 18:38:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-withAll: types
-    ^ self new initializeWithAll: types
-
-    "Created: / 25-08-2015 / 22:51:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!TUnionType methodsFor:'accessing'!
-
-types
-    ^ types
-! !
-
-!TUnionType methodsFor:'comparing'!
-
-hash
-    | h |
-
-    h := types size.
-    types do:[:type | h := h bitXor: type hash ].
-    ^ h
-
-    "Created: / 25-08-2015 / 23:35:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!TUnionType methodsFor:'initialization'!
-
-initializeWith: type1 with: type2
-    type1 isUnionType 
-        ifTrue: [ types := type1 types copy  ]
-        ifFalse:[ types := Array with: type1 ].
-    type2 isUnionType 
-        ifTrue: [ types := types , type2 types ]
-        ifFalse:[ types := types copyWith: type2 ].
-
-    "Created: / 21-08-2015 / 18:39:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-initializeWithAll: aCollection
-    types := OrderedCollection new: aCollection size.
-    aCollection do:[:type | 
-        type isUnionType 
-            ifTrue:[ types addAll: type types ]
-            ifFalse:[types add: type ].
-    ].
-    types := types asArray.
-
-    "Created: / 25-08-2015 / 22:50:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!TUnionType methodsFor:'testing'!
-
-isUnionType
-    ^ true
-! !
-
--- a/compiler/TUnionTypeNode.st	Wed Sep 02 09:18:00 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-"{ Package: 'jv:tea/compiler' }"
-
-"{ NameSpace: Smalltalk }"
-
-TTypeNode subclass:#TUnionTypeNode
-	instanceVariableNames:'types'
-	classVariableNames:''
-	poolDictionaries:''
-	category:'Languages-Tea-Compiler-AST'
-!
-
-!TUnionTypeNode class methodsFor:'instance creation'!
-
-new
-    "return an initialized instance"
-
-    ^ self basicNew initialize.
-! !
-
-!TUnionTypeNode methodsFor:'accessing'!
-
-start
-    ^ types first start
-
-    "Created: / 21-08-2015 / 21:08:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-stop
-    ^ types last stop
-
-    "Created: / 21-08-2015 / 21:08:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
-types
-    ^ types
-!
-
-types:something
-    types := something.
-! !
-
-!TUnionTypeNode methodsFor:'conversion'!
-
-asType
-    "superclass TTypeNode says that I am responsible to implement this method"
-
-    ^ TUnionType withAll: (types collect:[:e|e asType])
-
-    "Modified: / 25-08-2015 / 22:51:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
-!TUnionTypeNode methodsFor:'visitor'!
-
-acceptVisitor: aProgramNodeVisitor 
-    ^ aProgramNodeVisitor acceptUnionTypeNode: self
-
-    "Created: / 21-08-2015 / 22:15:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-! !
-
--- a/compiler/TVariableBinding.st	Wed Sep 02 09:18:00 2015 +0100
+++ b/compiler/TVariableBinding.st	Wed Sep 02 18:15:44 2015 +0100
@@ -9,6 +9,7 @@
 	category:'Languages-Tea-Compiler-Bindings'
 !
 
+
 !TVariableBinding class methodsFor:'instance creation'!
 
 name:aString 
@@ -36,8 +37,10 @@
 !TVariableBinding methodsFor:'conversion'!
 
 asLLVMValueInModule: aLLVMModule
+    self halt.
 
     "Created: / 02-09-2015 / 08:34:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 03-09-2015 / 07:05:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !TVariableBinding methodsFor:'initialization'!
@@ -62,3 +65,10 @@
     "Modified: / 25-08-2015 / 22:54:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!TVariableBinding class methodsFor:'documentation'!
+
+version_HG
+
+    ^ '$Changeset: <not expanded> $'
+! !
+
--- a/compiler/abbrev.stc	Wed Sep 02 09:18:00 2015 +0100
+++ b/compiler/abbrev.stc	Wed Sep 02 18:15:44 2015 +0100
@@ -14,36 +14,33 @@
 TMethodDefinition TMethodDefinition jv:tea/compiler 'Languages-Tea-Compiler-Model' 0
 TNamespaceDefinition TNamespaceDefinition jv:tea/compiler 'Languages-Tea-Compiler-Model' 0
 TParser TParser jv:tea/compiler 'Languages-Tea-Compiler-AST' 0
-TParserTests TParserTests jv:tea/compiler 'Languages-Tea-Compiler-AST-Tests' 1
 TProgramNodeVisitor TProgramNodeVisitor jv:tea/compiler 'Languages-Tea-Compiler-AST' 0
 TScanner TScanner jv:tea/compiler 'Languages-Tea-Compiler-AST' 0
 TScope TScope jv:tea/compiler 'Languages-Tea-Compiler-Bindings' 0
-TSemanticAnalysisPassTests TSemanticAnalysisPassTests jv:tea/compiler 'Languages-Tea-Compiler-Tests' 1
 TSourceReader TSourceReader jv:tea/compiler 'Languages-Tea-Compiler-Model' 0
 TType TType jv:tea/compiler 'Languages-Tea-Compiler-Types' 0
 TTypeNode TTypeNode jv:tea/compiler 'Languages-Tea-Compiler-AST' 0
 TTypeSpecNode TTypeSpecNode jv:tea/compiler 'Languages-Tea-Compiler-AST' 0
 jv_tea_compiler jv_tea_compiler jv:tea/compiler '* Projects & Packages *' 3
+TBlockType TBlockType jv:tea/compiler 'Languages-Tea-Compiler-Types' 0
 TClassBinding TClassBinding jv:tea/compiler 'Languages-Tea-Compiler-Bindings' 0
 TCompilerPass TCompilerPass jv:tea/compiler 'Languages-Tea-Compiler' 0
 TFunctionBinding TFunctionBinding jv:tea/compiler 'Languages-Tea-Compiler-Bindings' 0
-TFunctionType TFunctionType jv:tea/compiler 'Languages-Tea-Compiler-Types' 0
 TNamespaceBinding TNamespaceBinding jv:tea/compiler 'Languages-Tea-Compiler-Bindings' 0
 TSimpleType TSimpleType jv:tea/compiler 'Languages-Tea-Compiler-Types' 0
 TSimpleTypeNode TSimpleTypeNode jv:tea/compiler 'Languages-Tea-Compiler-AST' 0
-TUnionType TUnionType jv:tea/compiler 'Languages-Tea-Compiler-Types' 0
-TUnionTypeNode TUnionTypeNode jv:tea/compiler 'Languages-Tea-Compiler-AST' 0
 TValueBinding TValueBinding jv:tea/compiler 'Languages-Tea-Compiler-Bindings' 0
 TBlockBinding TBlockBinding jv:tea/compiler 'Languages-Tea-Compiler-Bindings' 0
-TBlockType TBlockType jv:tea/compiler 'Languages-Tea-Compiler-Types' 0
 TCodeGenerator TCodeGenerator jv:tea/compiler 'Languages-Tea-Compiler' 0
 TConstantBinding TConstantBinding jv:tea/compiler 'Languages-Tea-Compiler-Bindings' 0
 TMethodBinding TMethodBinding jv:tea/compiler 'Languages-Tea-Compiler-Bindings' 0
-TMethodType TMethodType jv:tea/compiler 'Languages-Tea-Compiler-Types' 0
 TSemanticAnalyser TSemanticAnalyser jv:tea/compiler 'Languages-Tea-Compiler' 0
 TTypechecker TTypechecker jv:tea/compiler 'Languages-Tea-Compiler' 0
+TTypeseeder TTypeseeder jv:tea/compiler 'Languages-Tea-Compiler' 0
 TVariableBinding TVariableBinding jv:tea/compiler 'Languages-Tea-Compiler-Bindings' 0
 TArgumentBinding TArgumentBinding jv:tea/compiler 'Languages-Tea-Compiler-Bindings' 0
 TLocalBinding TLocalBinding jv:tea/compiler 'Languages-Tea-Compiler-Bindings' 0
 TMethodDefinitionTests TMethodDefinitionTests jv:tea/compiler 'Languages-Tea-Compiler-Model-Tests' 1
+TParserTests TParserTests jv:tea/compiler 'Languages-Tea-Compiler-AST-Tests' 1
+TSemanticAnalysisPassTests TSemanticAnalysisPassTests jv:tea/compiler 'Languages-Tea-Compiler-Tests' 1
 TSourceReaderTests TSourceReaderTests jv:tea/compiler 'Languages-Tea-Compiler-Model-Tests' 1
--- a/compiler/bc.mak	Wed Sep 02 09:18:00 2015 +0100
+++ b/compiler/bc.mak	Wed Sep 02 18:15:44 2015 +0100
@@ -94,24 +94,21 @@
 $(OUTDIR)TTypeNode.$(O) TTypeNode.$(H): TTypeNode.st $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\parser\RBProgramNode.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)TTypeSpecNode.$(O) TTypeSpecNode.$(H): TTypeSpecNode.st $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\parser\RBProgramNode.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)jv_tea_compiler.$(O) jv_tea_compiler.$(H): jv_tea_compiler.st $(INCLUDE_TOP)\stx\libbasic\LibraryDefinition.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libbasic\ProjectDefinition.$(H) $(STCHDR)
+$(OUTDIR)TBlockType.$(O) TBlockType.$(H): TBlockType.st $(INCLUDE_TOP)\jv\tea\compiler\TType.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)TClassBinding.$(O) TClassBinding.$(H): TClassBinding.st $(INCLUDE_TOP)\jv\tea\compiler\TBinding.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)TCompilerPass.$(O) TCompilerPass.$(H): TCompilerPass.st $(INCLUDE_TOP)\jv\tea\compiler\TProgramNodeVisitor.$(H) $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\parser\RBProgramNodeVisitor.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)TFunctionBinding.$(O) TFunctionBinding.$(H): TFunctionBinding.st $(INCLUDE_TOP)\jv\tea\compiler\TBinding.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
-$(OUTDIR)TFunctionType.$(O) TFunctionType.$(H): TFunctionType.st $(INCLUDE_TOP)\jv\tea\compiler\TType.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)TNamespaceBinding.$(O) TNamespaceBinding.$(H): TNamespaceBinding.st $(INCLUDE_TOP)\jv\tea\compiler\TBinding.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)TSimpleType.$(O) TSimpleType.$(H): TSimpleType.st $(INCLUDE_TOP)\jv\tea\compiler\TType.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)TSimpleTypeNode.$(O) TSimpleTypeNode.$(H): TSimpleTypeNode.st $(INCLUDE_TOP)\jv\tea\compiler\TTypeNode.$(H) $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\parser\RBProgramNode.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
-$(OUTDIR)TUnionType.$(O) TUnionType.$(H): TUnionType.st $(INCLUDE_TOP)\jv\tea\compiler\TType.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
-$(OUTDIR)TUnionTypeNode.$(O) TUnionTypeNode.$(H): TUnionTypeNode.st $(INCLUDE_TOP)\jv\tea\compiler\TTypeNode.$(H) $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\parser\RBProgramNode.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)TValueBinding.$(O) TValueBinding.$(H): TValueBinding.st $(INCLUDE_TOP)\jv\tea\compiler\TBinding.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)TBlockBinding.$(O) TBlockBinding.$(H): TBlockBinding.st $(INCLUDE_TOP)\jv\tea\compiler\TBinding.$(H) $(INCLUDE_TOP)\jv\tea\compiler\TFunctionBinding.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
-$(OUTDIR)TBlockType.$(O) TBlockType.$(H): TBlockType.st $(INCLUDE_TOP)\jv\tea\compiler\TFunctionType.$(H) $(INCLUDE_TOP)\jv\tea\compiler\TType.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)TCodeGenerator.$(O) TCodeGenerator.$(H): TCodeGenerator.st $(INCLUDE_TOP)\jv\tea\compiler\TCompilerPass.$(H) $(INCLUDE_TOP)\jv\tea\compiler\TProgramNodeVisitor.$(H) $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\parser\RBProgramNodeVisitor.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)TConstantBinding.$(O) TConstantBinding.$(H): TConstantBinding.st $(INCLUDE_TOP)\jv\tea\compiler\TBinding.$(H) $(INCLUDE_TOP)\jv\tea\compiler\TValueBinding.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)TMethodBinding.$(O) TMethodBinding.$(H): TMethodBinding.st $(INCLUDE_TOP)\jv\tea\compiler\TBinding.$(H) $(INCLUDE_TOP)\jv\tea\compiler\TFunctionBinding.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
-$(OUTDIR)TMethodType.$(O) TMethodType.$(H): TMethodType.st $(INCLUDE_TOP)\jv\tea\compiler\TFunctionType.$(H) $(INCLUDE_TOP)\jv\tea\compiler\TType.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)TSemanticAnalyser.$(O) TSemanticAnalyser.$(H): TSemanticAnalyser.st $(INCLUDE_TOP)\jv\tea\compiler\TCompilerPass.$(H) $(INCLUDE_TOP)\jv\tea\compiler\TProgramNodeVisitor.$(H) $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\parser\RBProgramNodeVisitor.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)TTypechecker.$(O) TTypechecker.$(H): TTypechecker.st $(INCLUDE_TOP)\jv\tea\compiler\TCompilerPass.$(H) $(INCLUDE_TOP)\jv\tea\compiler\TProgramNodeVisitor.$(H) $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\parser\RBProgramNodeVisitor.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)TTypeseeder.$(O) TTypeseeder.$(H): TTypeseeder.st $(INCLUDE_TOP)\jv\tea\compiler\TCompilerPass.$(H) $(INCLUDE_TOP)\jv\tea\compiler\TProgramNodeVisitor.$(H) $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\parser\RBProgramNodeVisitor.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)TVariableBinding.$(O) TVariableBinding.$(H): TVariableBinding.st $(INCLUDE_TOP)\jv\tea\compiler\TBinding.$(H) $(INCLUDE_TOP)\jv\tea\compiler\TValueBinding.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)TArgumentBinding.$(O) TArgumentBinding.$(H): TArgumentBinding.st $(INCLUDE_TOP)\jv\tea\compiler\TBinding.$(H) $(INCLUDE_TOP)\jv\tea\compiler\TValueBinding.$(H) $(INCLUDE_TOP)\jv\tea\compiler\TVariableBinding.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)TLocalBinding.$(O) TLocalBinding.$(H): TLocalBinding.st $(INCLUDE_TOP)\jv\tea\compiler\TBinding.$(H) $(INCLUDE_TOP)\jv\tea\compiler\TValueBinding.$(H) $(INCLUDE_TOP)\jv\tea\compiler\TVariableBinding.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
--- a/compiler/jv_tea_compiler.st	Wed Sep 02 09:18:00 2015 +0100
+++ b/compiler/jv_tea_compiler.st	Wed Sep 02 18:15:44 2015 +0100
@@ -48,7 +48,7 @@
      by searching all classes (and their packages) which are referenced by my classes."
 
     ^ #(
-        #'jv:llvm_s'    "LLVMModule - referenced by TCompilerContext>>module"
+        #'jv:llvm_s'    "LLVMConstant - referenced by TConstantBinding>>asLLVMValueInModule:"
         #'stx:libbasic3'    "ChangeSet - referenced by TSourceReader>>read:"
     )
 !
@@ -86,38 +86,35 @@
         TMethodDefinition
         TNamespaceDefinition
         TParser
-        (TParserTests autoload)
         TProgramNodeVisitor
         TScanner
         TScope
-        (TSemanticAnalysisPassTests autoload)
         TSourceReader
         TType
         TTypeNode
         TTypeSpecNode
         #'jv_tea_compiler'
+        TBlockType
         TClassBinding
         TCompilerPass
         TFunctionBinding
-        TFunctionType
         TNamespaceBinding
         TSimpleType
         TSimpleTypeNode
-        TUnionType
-        TUnionTypeNode
         TValueBinding
         TBlockBinding
-        TBlockType
         TCodeGenerator
         TConstantBinding
         TMethodBinding
-        TMethodType
         TSemanticAnalyser
         TTypechecker
+        TTypeseeder
         TVariableBinding
         TArgumentBinding
         TLocalBinding
         (TMethodDefinitionTests autoload)
+        (TParserTests autoload)
+        (TSemanticAnalysisPassTests autoload)
         (TSourceReaderTests autoload)
     )
 !
--- a/compiler/libInit.cc	Wed Sep 02 09:18:00 2015 +0100
+++ b/compiler/libInit.cc	Wed Sep 02 18:15:44 2015 +0100
@@ -47,24 +47,21 @@
 _TTypeNode_Init(pass,__pRT__,snd);
 _TTypeSpecNode_Init(pass,__pRT__,snd);
 _jv_137tea_137compiler_Init(pass,__pRT__,snd);
+_TBlockType_Init(pass,__pRT__,snd);
 _TClassBinding_Init(pass,__pRT__,snd);
 _TCompilerPass_Init(pass,__pRT__,snd);
 _TFunctionBinding_Init(pass,__pRT__,snd);
-_TFunctionType_Init(pass,__pRT__,snd);
 _TNamespaceBinding_Init(pass,__pRT__,snd);
 _TSimpleType_Init(pass,__pRT__,snd);
 _TSimpleTypeNode_Init(pass,__pRT__,snd);
-_TUnionType_Init(pass,__pRT__,snd);
-_TUnionTypeNode_Init(pass,__pRT__,snd);
 _TValueBinding_Init(pass,__pRT__,snd);
 _TBlockBinding_Init(pass,__pRT__,snd);
-_TBlockType_Init(pass,__pRT__,snd);
 _TCodeGenerator_Init(pass,__pRT__,snd);
 _TConstantBinding_Init(pass,__pRT__,snd);
 _TMethodBinding_Init(pass,__pRT__,snd);
-_TMethodType_Init(pass,__pRT__,snd);
 _TSemanticAnalyser_Init(pass,__pRT__,snd);
 _TTypechecker_Init(pass,__pRT__,snd);
+_TTypeseeder_Init(pass,__pRT__,snd);
 _TVariableBinding_Init(pass,__pRT__,snd);
 _TArgumentBinding_Init(pass,__pRT__,snd);
 _TLocalBinding_Init(pass,__pRT__,snd);