# HG changeset patch # User Jan Vrany # Date 1443043304 -3600 # Node ID 10a95d798b36f9ec5c95373a8ed59a0e99166322 # Parent fa42d3f1a57846f701639511fe4ccc16297f284c Added support for local variables and #whileTrue: special form Allocate all local variables in a special basic block named `allocas`. Added support for #whileTrue: special form. diff -r fa42d3f1a578 -r 10a95d798b36 compiler/Make.proto --- a/compiler/Make.proto Tue Sep 22 17:43:38 2015 +0100 +++ b/compiler/Make.proto Wed Sep 23 22:21:44 2015 +0100 @@ -127,7 +127,6 @@ # BEGINMAKEDEPEND --- do not remove this line; make depend needs it -$(OUTDIR)TBinding.$(O) TBinding.$(H): TBinding.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR) $(OUTDIR)TClassDefinition.$(O) TClassDefinition.$(H): TClassDefinition.st $(INCLUDE_TOP)/stx/goodies/ring/RGBehaviorDefinition.$(H) $(INCLUDE_TOP)/stx/goodies/ring/RGClassDefinition.$(H) $(INCLUDE_TOP)/stx/goodies/ring/RGClassDescriptionDefinition.$(H) $(INCLUDE_TOP)/stx/goodies/ring/RGDefinition.$(H) $(INCLUDE_TOP)/stx/goodies/ring/RGGlobalDefinition.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR) $(OUTDIR)TCompilationUnitDefinition.$(O) TCompilationUnitDefinition.$(H): TCompilationUnitDefinition.st $(INCLUDE_TOP)/stx/goodies/ring/RGAbstractContainer.$(H) $(INCLUDE_TOP)/stx/goodies/ring/RGDefinition.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR) $(OUTDIR)TCompiler.$(O) TCompiler.$(H): TCompiler.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR) @@ -138,35 +137,38 @@ $(OUTDIR)TMetaDefinition.$(O) TMetaDefinition.$(H): TMetaDefinition.st $(INCLUDE_TOP)/stx/goodies/ring/RGBehaviorDefinition.$(H) $(INCLUDE_TOP)/stx/goodies/ring/RGClassDescriptionDefinition.$(H) $(INCLUDE_TOP)/stx/goodies/ring/RGDefinition.$(H) $(INCLUDE_TOP)/stx/goodies/ring/RGGlobalDefinition.$(H) $(INCLUDE_TOP)/stx/goodies/ring/RGMetaclassDefinition.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR) $(OUTDIR)TMethodDefinition.$(O) TMethodDefinition.$(H): TMethodDefinition.st $(INCLUDE_TOP)/stx/goodies/ring/RGDefinition.$(H) $(INCLUDE_TOP)/stx/goodies/ring/RGElementDefinition.$(H) $(INCLUDE_TOP)/stx/goodies/ring/RGMethodDefinition.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR) $(OUTDIR)TNamespaceDefinition.$(O) TNamespaceDefinition.$(H): TNamespaceDefinition.st $(INCLUDE_TOP)/stx/goodies/ring/RGAbstractContainer.$(H) $(INCLUDE_TOP)/stx/goodies/ring/RGContainer.$(H) $(INCLUDE_TOP)/stx/goodies/ring/RGDefinition.$(H) $(INCLUDE_TOP)/stx/goodies/ring/RGNamespace.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR) +$(OUTDIR)TObjectWithProperties.$(O) TObjectWithProperties.$(H): TObjectWithProperties.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR) $(OUTDIR)TParser.$(O) TParser.$(H): TParser.st $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/parser/RBParser.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR) $(OUTDIR)TProgramNodeVisitor.$(O) TProgramNodeVisitor.$(H): TProgramNodeVisitor.st $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/parser/RBProgramNodeVisitor.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR) -$(OUTDIR)TScope.$(O) TScope.$(H): TScope.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR) $(OUTDIR)TSourceReader.$(O) TSourceReader.$(H): TSourceReader.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR) $(OUTDIR)TSpecialFormNode.$(O) TSpecialFormNode.$(H): TSpecialFormNode.st $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/parser/RBMessageNode.$(H) $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/parser/RBProgramNode.$(H) $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/parser/RBStatementNode.$(H) $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/parser/RBValueNode.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR) -$(OUTDIR)TType.$(O) TType.$(H): TType.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR) $(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)TBinding.$(O) TBinding.$(H): TBinding.st $(INCLUDE_TOP)/jv/tea/compiler/TObjectWithProperties.$(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)TEnvironment.$(O) TEnvironment.$(H): TEnvironment.st $(INCLUDE_TOP)/jv/tea/compiler/TNamespaceDefinition.$(H) $(INCLUDE_TOP)/stx/goodies/ring/RGAbstractContainer.$(H) $(INCLUDE_TOP)/stx/goodies/ring/RGContainer.$(H) $(INCLUDE_TOP)/stx/goodies/ring/RGDefinition.$(H) $(INCLUDE_TOP)/stx/goodies/ring/RGNamespace.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR) $(OUTDIR)TFilesystemProvider.$(O) TFilesystemProvider.$(H): TFilesystemProvider.st $(INCLUDE_TOP)/jv/tea/compiler/TEnvironmentProvider.$(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)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)TScope.$(O) TScope.$(H): TScope.st $(INCLUDE_TOP)/jv/tea/compiler/TObjectWithProperties.$(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)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)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)TType.$(O) TType.$(H): TType.st $(INCLUDE_TOP)/jv/tea/compiler/TObjectWithProperties.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR) +$(OUTDIR)TAutomaticType.$(O) TAutomaticType.$(H): TAutomaticType.st $(INCLUDE_TOP)/jv/tea/compiler/TObjectWithProperties.$(H) $(INCLUDE_TOP)/jv/tea/compiler/TType.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR) +$(OUTDIR)TBlockType.$(O) TBlockType.$(H): TBlockType.st $(INCLUDE_TOP)/jv/tea/compiler/TObjectWithProperties.$(H) $(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)/jv/tea/compiler/TObjectWithProperties.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR) +$(OUTDIR)TFunctionBinding.$(O) TFunctionBinding.$(H): TFunctionBinding.st $(INCLUDE_TOP)/jv/tea/compiler/TBinding.$(H) $(INCLUDE_TOP)/jv/tea/compiler/TObjectWithProperties.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR) $(OUTDIR)TLLVMCodeGenerator.$(O) TLLVMCodeGenerator.$(H): TLLVMCodeGenerator.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)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)TNamespaceBinding.$(O) TNamespaceBinding.$(H): TNamespaceBinding.st $(INCLUDE_TOP)/jv/tea/compiler/TBinding.$(H) $(INCLUDE_TOP)/jv/tea/compiler/TObjectWithProperties.$(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)TSimpleType.$(O) TSimpleType.$(H): TSimpleType.st $(INCLUDE_TOP)/jv/tea/compiler/TObjectWithProperties.$(H) $(INCLUDE_TOP)/jv/tea/compiler/TType.$(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)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) -$(OUTDIR)extensions.$(O): extensions.st $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/parser/RBBlockNode.$(H) $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/parser/RBMethodNode.$(H) $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/parser/RBProgramNode.$(H) $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/parser/RBReturnNode.$(H) $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/parser/RBStatementNode.$(H) $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/parser/RBToken.$(H) $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/parser/RBValueNode.$(H) $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/parser/RBVariableNode.$(H) $(INCLUDE_TOP)/stx/goodies/ring/RGBehaviorDefinition.$(H) $(INCLUDE_TOP)/stx/goodies/ring/RGClassDefinition.$(H) $(INCLUDE_TOP)/stx/goodies/ring/RGClassDescriptionDefinition.$(H) $(INCLUDE_TOP)/stx/goodies/ring/RGDefinition.$(H) $(INCLUDE_TOP)/stx/goodies/ring/RGElementDefinition.$(H) $(INCLUDE_TOP)/stx/goodies/ring/RGGlobalDefinition.$(H) $(INCLUDE_TOP)/stx/goodies/ring/RGMetaclassDefinition.$(H) $(INCLUDE_TOP)/stx/goodies/ring/RGMethodDefinition.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR) +$(OUTDIR)TValueBinding.$(O) TValueBinding.$(H): TValueBinding.st $(INCLUDE_TOP)/jv/tea/compiler/TBinding.$(H) $(INCLUDE_TOP)/jv/tea/compiler/TObjectWithProperties.$(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)/jv/tea/compiler/TObjectWithProperties.$(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/TObjectWithProperties.$(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)/jv/tea/compiler/TObjectWithProperties.$(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/TObjectWithProperties.$(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/TObjectWithProperties.$(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/TObjectWithProperties.$(H) $(INCLUDE_TOP)/jv/tea/compiler/TValueBinding.$(H) $(INCLUDE_TOP)/jv/tea/compiler/TVariableBinding.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR) +$(OUTDIR)extensions.$(O): extensions.st $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/parser/RBAssignmentNode.$(H) $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/parser/RBBlockNode.$(H) $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/parser/RBMethodNode.$(H) $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/parser/RBProgramNode.$(H) $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/parser/RBReturnNode.$(H) $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/parser/RBStatementNode.$(H) $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/parser/RBToken.$(H) $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/parser/RBValueNode.$(H) $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/parser/RBVariableNode.$(H) $(INCLUDE_TOP)/stx/goodies/ring/RGBehaviorDefinition.$(H) $(INCLUDE_TOP)/stx/goodies/ring/RGClassDefinition.$(H) $(INCLUDE_TOP)/stx/goodies/ring/RGClassDescriptionDefinition.$(H) $(INCLUDE_TOP)/stx/goodies/ring/RGDefinition.$(H) $(INCLUDE_TOP)/stx/goodies/ring/RGElementDefinition.$(H) $(INCLUDE_TOP)/stx/goodies/ring/RGGlobalDefinition.$(H) $(INCLUDE_TOP)/stx/goodies/ring/RGMetaclassDefinition.$(H) $(INCLUDE_TOP)/stx/goodies/ring/RGMethodDefinition.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR) # ENDMAKEDEPEND --- do not remove this line diff -r fa42d3f1a578 -r 10a95d798b36 compiler/Make.spec --- a/compiler/Make.spec Tue Sep 22 17:43:38 2015 +0100 +++ b/compiler/Make.spec Wed Sep 23 22:21:44 2015 +0100 @@ -51,7 +51,6 @@ STCWARNINGS=-warnNonStandard COMMON_CLASSES= \ - TBinding \ TClassDefinition \ TCompilationUnitDefinition \ TCompiler \ @@ -62,31 +61,34 @@ TMetaDefinition \ TMethodDefinition \ TNamespaceDefinition \ + TObjectWithProperties \ TParser \ TProgramNodeVisitor \ - TScope \ TSourceReader \ TSpecialFormNode \ - TType \ TTypeNode \ TTypeSpecNode \ jv_tea_compiler \ - TBlockType \ - TClassBinding \ + TBinding \ TCompilerPass \ TEnvironment \ TFilesystemProvider \ + TScope \ + TSimpleTypeNode \ + TType \ + TAutomaticType \ + TBlockType \ + TClassBinding \ TFunctionBinding \ + TLLVMCodeGenerator \ TNamespaceBinding \ + TSemanticAnalyser \ TSimpleType \ - TSimpleTypeNode \ + TTypechecker \ TValueBinding \ TBlockBinding \ TConstantBinding \ - TLLVMCodeGenerator \ TMethodBinding \ - TSemanticAnalyser \ - TTypechecker \ TVariableBinding \ TArgumentBinding \ TLocalBinding \ @@ -95,7 +97,6 @@ COMMON_OBJS= \ - $(OUTDIR_SLASH)TBinding.$(O) \ $(OUTDIR_SLASH)TClassDefinition.$(O) \ $(OUTDIR_SLASH)TCompilationUnitDefinition.$(O) \ $(OUTDIR_SLASH)TCompiler.$(O) \ @@ -106,31 +107,34 @@ $(OUTDIR_SLASH)TMetaDefinition.$(O) \ $(OUTDIR_SLASH)TMethodDefinition.$(O) \ $(OUTDIR_SLASH)TNamespaceDefinition.$(O) \ + $(OUTDIR_SLASH)TObjectWithProperties.$(O) \ $(OUTDIR_SLASH)TParser.$(O) \ $(OUTDIR_SLASH)TProgramNodeVisitor.$(O) \ - $(OUTDIR_SLASH)TScope.$(O) \ $(OUTDIR_SLASH)TSourceReader.$(O) \ $(OUTDIR_SLASH)TSpecialFormNode.$(O) \ - $(OUTDIR_SLASH)TType.$(O) \ $(OUTDIR_SLASH)TTypeNode.$(O) \ $(OUTDIR_SLASH)TTypeSpecNode.$(O) \ $(OUTDIR_SLASH)jv_tea_compiler.$(O) \ - $(OUTDIR_SLASH)TBlockType.$(O) \ - $(OUTDIR_SLASH)TClassBinding.$(O) \ + $(OUTDIR_SLASH)TBinding.$(O) \ $(OUTDIR_SLASH)TCompilerPass.$(O) \ $(OUTDIR_SLASH)TEnvironment.$(O) \ $(OUTDIR_SLASH)TFilesystemProvider.$(O) \ + $(OUTDIR_SLASH)TScope.$(O) \ + $(OUTDIR_SLASH)TSimpleTypeNode.$(O) \ + $(OUTDIR_SLASH)TType.$(O) \ + $(OUTDIR_SLASH)TAutomaticType.$(O) \ + $(OUTDIR_SLASH)TBlockType.$(O) \ + $(OUTDIR_SLASH)TClassBinding.$(O) \ $(OUTDIR_SLASH)TFunctionBinding.$(O) \ + $(OUTDIR_SLASH)TLLVMCodeGenerator.$(O) \ $(OUTDIR_SLASH)TNamespaceBinding.$(O) \ + $(OUTDIR_SLASH)TSemanticAnalyser.$(O) \ $(OUTDIR_SLASH)TSimpleType.$(O) \ - $(OUTDIR_SLASH)TSimpleTypeNode.$(O) \ + $(OUTDIR_SLASH)TTypechecker.$(O) \ $(OUTDIR_SLASH)TValueBinding.$(O) \ $(OUTDIR_SLASH)TBlockBinding.$(O) \ $(OUTDIR_SLASH)TConstantBinding.$(O) \ - $(OUTDIR_SLASH)TLLVMCodeGenerator.$(O) \ $(OUTDIR_SLASH)TMethodBinding.$(O) \ - $(OUTDIR_SLASH)TSemanticAnalyser.$(O) \ - $(OUTDIR_SLASH)TTypechecker.$(O) \ $(OUTDIR_SLASH)TVariableBinding.$(O) \ $(OUTDIR_SLASH)TArgumentBinding.$(O) \ $(OUTDIR_SLASH)TLocalBinding.$(O) \ diff -r fa42d3f1a578 -r 10a95d798b36 compiler/TAutomaticType.st --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/compiler/TAutomaticType.st Wed Sep 23 22:21:44 2015 +0100 @@ -0,0 +1,41 @@ +"{ Package: 'jv:tea/compiler' }" + +"{ NameSpace: Smalltalk }" + +TType subclass:#TAutomaticType + instanceVariableNames:'' + classVariableNames:'' + poolDictionaries:'' + category:'Languages-Tea-Compiler-Types' +! + +!TAutomaticType methodsFor:'comparing'! + += anotherType + ^ anotherType class == self class + + "Created: / 23-09-2015 / 16:26:46 / Jan Vrany " +! + +hash + ^ self class hash + + "Created: / 23-09-2015 / 16:26:33 / Jan Vrany " +! ! + +!TAutomaticType methodsFor:'printing & storing'! + +printWithoutAnglesOn:aStream + aStream nextPutAll: '#auto' + + "Created: / 23-09-2015 / 16:27:04 / Jan Vrany " +! ! + +!TAutomaticType methodsFor:'testing'! + +isAutomaticType + ^ true + + "Created: / 23-09-2015 / 16:32:41 / Jan Vrany " +! ! + diff -r fa42d3f1a578 -r 10a95d798b36 compiler/TBinding.st --- a/compiler/TBinding.st Tue Sep 22 17:43:38 2015 +0100 +++ b/compiler/TBinding.st Wed Sep 23 22:21:44 2015 +0100 @@ -2,7 +2,7 @@ "{ NameSpace: Smalltalk }" -Object subclass:#TBinding +TObjectWithProperties subclass:#TBinding instanceVariableNames:'' classVariableNames:'' poolDictionaries:'' diff -r fa42d3f1a578 -r 10a95d798b36 compiler/TCompilerPass.st --- a/compiler/TCompilerPass.st Tue Sep 22 17:43:38 2015 +0100 +++ b/compiler/TCompilerPass.st Wed Sep 23 22:21:44 2015 +0100 @@ -3,7 +3,7 @@ "{ NameSpace: Smalltalk }" TProgramNodeVisitor subclass:#TCompilerPass - instanceVariableNames:'context currentClass currentMethod currentScope' + instanceVariableNames:'context' classVariableNames:'' poolDictionaries:'' category:'Languages-Tea-Compiler-Internals' @@ -89,24 +89,14 @@ !TCompilerPass methodsFor:'visitor-double dispatching'! -acceptBlockNode: aBlockNode - currentScope := aBlockNode scope. - super acceptBlockNode: aBlockNode - - "Created: / 02-09-2015 / 07:20:59 / Jan Vrany " -! - acceptClassDefinition: aTClassDefinition self visitDefinition: aTClassDefinition theMetaclass. - - currentClass := aTClassDefinition. aTClassDefinition methodDictionary do:[:each | self visitDefinition: each ]. - currentClass := nil. "Created: / 29-08-2015 / 21:50:36 / Jan Vrany " - "Modified: / 31-08-2015 / 11:03:20 / Jan Vrany " + "Modified: / 23-09-2015 / 06:16:03 / Jan Vrany " ! acceptCompilationUnitDefinition: aTCompilationUnitDefinition @@ -136,39 +126,19 @@ ! acceptMetaclassDefinition: aTClassDefinition - currentClass := aTClassDefinition. aTClassDefinition methodDictionary do:[:each | self visitDefinition: each ]. - currentClass := nil. "Created: / 29-08-2015 / 21:54:24 / Jan Vrany " - "Modified: / 31-08-2015 / 11:03:35 / Jan Vrany " + "Modified: / 23-09-2015 / 06:16:10 / Jan Vrany " ! acceptMethodDefinition: aTMethodDefinition - currentMethod := aTMethodDefinition. self visitNode: aTMethodDefinition parseTree. - currentMethod := nil. "Created: / 29-08-2015 / 21:55:41 / Jan Vrany " - "Modified: / 31-08-2015 / 11:03:51 / Jan Vrany " -! - -acceptMethodNode: aMethodNode - - currentScope := aMethodNode scope. - self visitArguments: aMethodNode arguments. - self visitNode: aMethodNode returnTypeSpec. - "/ If method node contains inline assembly, then visit that inline assembly - "/ node but nothing else!! - aMethodNode body statements first isInlineAssembly ifTrue:[ - self visitNode: aMethodNode body statements first - ] ifFalse:[ - self visitNode: aMethodNode body - ]. - - "Created: / 02-09-2015 / 07:16:37 / Jan Vrany " + "Modified: / 23-09-2015 / 06:17:07 / Jan Vrany " ! acceptSequenceNode: aSequenceNode diff -r fa42d3f1a578 -r 10a95d798b36 compiler/TFunctionBinding.st --- a/compiler/TFunctionBinding.st Tue Sep 22 17:43:38 2015 +0100 +++ b/compiler/TFunctionBinding.st Wed Sep 23 22:21:44 2015 +0100 @@ -26,6 +26,20 @@ "Modified: / 02-09-2015 / 17:02:43 / Jan Vrany " ! ! +!TFunctionBinding methodsFor:'accesssing - llvm'! + +llvmValue + ^ self propertyAt: #llvmValue ifAbsent:[ nil ] + + "Created: / 23-09-2015 / 21:14:27 / Jan Vrany " +! + +llvmValue: anLLVMValue + self propertyAt: #llvmValue put: anLLVMValue + + "Created: / 23-09-2015 / 21:14:10 / Jan Vrany " +! ! + !TFunctionBinding methodsFor:'converting'! asLLVMValueInModule: aLLVMModule diff -r fa42d3f1a578 -r 10a95d798b36 compiler/TLLVMCodeGenerator.st --- a/compiler/TLLVMCodeGenerator.st Tue Sep 22 17:43:38 2015 +0100 +++ b/compiler/TLLVMCodeGenerator.st Wed Sep 23 22:21:44 2015 +0100 @@ -9,6 +9,7 @@ category:'Languages-Tea-Compiler-Internals' ! + !TLLVMCodeGenerator class methodsFor:'initialization'! initialize @@ -79,16 +80,25 @@ !TLLVMCodeGenerator methodsFor:'visiting'! visitArgument: anRBVariableNode - | binding | + | binding value | binding := anRBVariableNode binding. - binding isArgumentBinding ifTrue:[ - (function parameterAt: binding index) name: anRBVariableNode name. + binding isArgumentBinding ifTrue:[ + value := function parameterAt: binding index. + value name: binding name. ] ifFalse:[ - self notYetImplemented. + | block allocas | + + allocas := anRBVariableNode scope llvmAllocas. + block := asm block. + asm block: allocas. + value := asm alloca: (binding type asLLVMTypeInModule: context module) as: binding name. + asm block: block. ]. + binding llvmValue: value. "Created: / 02-09-2015 / 08:43:00 / Jan Vrany " + "Modified: / 23-09-2015 / 21:47:38 / Jan Vrany " ! ! !TLLVMCodeGenerator methodsFor:'visitor-double dispatching'! @@ -100,9 +110,15 @@ ! acceptAssignmentNode: anAssignmentNode - self notYetImplemented + | value binding | + + value := self visitNode: anAssignmentNode value. + binding := anAssignmentNode variable binding. + asm store: value _: binding llvmValue. + ^ value "Created: / 31-08-2015 / 10:14:13 / Jan Vrany " + "Modified: / 23-09-2015 / 21:52:41 / Jan Vrany " ! acceptBlockNode: aBlockNode @@ -151,25 +167,27 @@ "Modified: / 16-09-2015 / 05:28:33 / Jan Vrany " ! -acceptInlineAssemblyNode: aTInlineAssemblyNode - | emitMethodNode emitMethod| +acceptIfTrueNode: node + | condition thenBody thenBlock thenResult joinBlock result | + + condition := self visitNode: node receiver. + thenBody := node arguments first body. + thenBlock := function addBasicBlock. + + joinBlock := function addBasicBlock. - emitMethodNode := RBMethodNode new. - 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:[ - variableNode name: 'zelf'. - ]. + asm if: condition then: thenBlock else: joinBlock. + "/ Code true-branch + asm block: thenBlock. + thenResult := self visitNode: thenBody. + thenResult isReturnInst ifFalse:[ + joinBlock notNil ifTrue:[ joinBlock function addBasicBlock ]. + asm br: joinBlock. ]. - emitMethodNode selector:(String streamContents: [ :s | emitMethodNode arguments size timesRepeat:[s nextPutAll:'_:'] ]). - emitMethod := Compiler compile: emitMethodNode formattedCode forClass: UndefinedObject install: false. - emitMethod - valueWithReceiver: nil - arguments: { asm } , ((1 to: function numArgs) collect: [ :i | function parameterAt: i ]) - "Created: / 02-09-2015 / 06:53:43 / Jan Vrany " - "Modified: / 02-09-2015 / 10:30:22 / Jan Vrany " + asm block: joinBlock. + + "Created: / 23-09-2015 / 21:57:31 / Jan Vrany " ! acceptLiteralNode: aLiteralNode @@ -193,13 +211,20 @@ ! acceptMethodNode: aMethodNode + | allocas entry | + function := aMethodNode binding asLLVMValueInModule: context module. - asm := function builder. - super acceptMethodNode: aMethodNode + allocas := function addBasicBlockNamed: 'allocas'. + entry := function addBasicBlockNamed: 'entry'. + aMethodNode scope llvmAllocas: allocas. + asm := entry builder. + super acceptMethodNode: aMethodNode. + "/ Finally, link allocas to entry. + asm block: allocas. + asm br: entry. "Created: / 31-08-2015 / 09:42:58 / Jan Vrany " - "Modified: / 15-09-2015 / 07:17:09 / Jan Vrany " - "Modified (format): / 15-09-2015 / 08:17:32 / Jan Vrany " + "Modified: / 23-09-2015 / 22:32:04 / Jan Vrany " ! acceptOptimizedNode: anOptimizedNode @@ -214,6 +239,32 @@ "Created: / 31-08-2015 / 10:13:41 / Jan Vrany " ! +acceptPrimitiveNode: aPragmaNode + | primitiveBlock methodIsForMeta emitMethodNode emitMethod | + + primitiveBlock := aPragmaNode arguments first. + methodIsForMeta := aPragmaNode parent binding mclass isMetaclass. + emitMethodNode := RBMethodNode new. + emitMethodNode arguments: + (primitiveBlock arguments collect:[ :e|e copy]) , + (methodIsForMeta ifFalse:[{ RBVariableNode named: 'zelf' }] ifTrue:[#()]) , + (primitiveBlock topNode arguments collect:[ :e|e copy]). + emitMethodNode body: primitiveBlock body copy. + emitMethodNode variableNodesDo:[ :variableNode | + variableNode name = 'self' ifTrue:[ + variableNode name: 'zelf'. + ]. + ]. + emitMethodNode selector:(String streamContents: [ :s | emitMethodNode arguments size timesRepeat:[s nextPutAll:'_:'] ]). + emitMethod := Compiler compile: emitMethodNode formattedCode forClass: UndefinedObject install: false. + emitMethod + valueWithReceiver: nil + arguments: { asm } , ((1 to: function numArgs) collect: [ :i | function parameterAt: i ]) + + "Created: / 22-09-2015 / 18:03:33 / Jan Vrany " + "Modified: / 23-09-2015 / 06:27:56 / Jan Vrany " +! + acceptReturnNode: aReturnNode | value | @@ -237,9 +288,49 @@ ! acceptVariableNode: aVariableNode - self notYetImplemented + | binding | + + binding := aVariableNode binding. + ^ binding isArgumentBinding ifTrue:[ + binding llvmValue. + ] ifFalse:[ + asm load: binding llvmValue. + ]. "Created: / 31-08-2015 / 10:13:08 / Jan Vrany " + "Modified: / 23-09-2015 / 22:30:57 / Jan Vrany " +! + +acceptWhileTrueNode: node + | loopConditionBlock loopConditionBody loopConditionResult loopBodyBody loopBodyBlock loopBodyResult joinBlock | + + loopConditionBody := node receiver body. + loopConditionBlock := function addBasicBlock. + + loopBodyBody := node arguments first body. + loopBodyBlock := function addBasicBlock. + + joinBlock := function addBasicBlock. + + asm br: loopConditionBlock. + asm block: loopConditionBlock. + loopConditionResult := self visitNode: loopConditionBody. + asm if: loopConditionResult then: loopBodyBlock else: joinBlock. + asm block: loopBodyBlock. + loopBodyResult := self visitNode: loopBodyBody. + loopBodyResult isReturnInst ifFalse:[ + asm br: loopConditionBlock + ]. + asm block: joinBlock + + "Created: / 23-09-2015 / 22:02:39 / Jan Vrany " +! ! + +!TLLVMCodeGenerator class methodsFor:'documentation'! + +version_HG + + ^ '$Changeset: $' ! ! diff -r fa42d3f1a578 -r 10a95d798b36 compiler/TObjectWithProperties.st --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/compiler/TObjectWithProperties.st Wed Sep 23 22:21:44 2015 +0100 @@ -0,0 +1,95 @@ +"{ Package: 'jv:tea/compiler' }" + +"{ NameSpace: Smalltalk }" + +Object subclass:#TObjectWithProperties + instanceVariableNames:'properties' + classVariableNames:'' + poolDictionaries:'' + category:'Languages-Tea-Compiler-Internals' +! + +!TObjectWithProperties methodsFor:'accessing-properties'! + +hasProperty: aKey + "Test if the property aKey is present." + + ^ properties notNil and: [ properties includesKey: aKey ] + + "Created: / 20-08-2015 / 18:25:13 / Jan Vrany " +! + +propertyAt: aKey + "Answer the property value associated with aKey." + + ^ self propertyAt: aKey ifAbsent: [ self error: 'Property not found' ] + + "Created: / 20-08-2015 / 18:23:29 / Jan Vrany " +! + +propertyAt: aKey ifAbsent: aBlock + "Answer the property value associated with aKey or, if aKey + isn't found, answer the result of evaluating aBlock." + + ^ properties isNil + ifTrue: [ aBlock value ] + ifFalse: [ properties at: aKey ifAbsent: aBlock ] + + "Created: / 20-08-2015 / 18:23:56 / Jan Vrany " +! + +propertyAt: aKey ifAbsentPut: aBlock + "Answer the property associated with aKey or, if aKey isn't found + store the result of evaluating aBlock as new value." + + ^ self propertyAt: aKey ifAbsent: [ self propertyAt: aKey put: aBlock value ] + + "Created: / 20-08-2015 / 18:24:09 / Jan Vrany " +! + +propertyAt: aKey put: anObject + "Set the property at aKey to be anObject. If aKey is not found, create a new entry + for aKey and set is value to anObject. Answer anObject." + + ^ (properties ifNil: [ properties := RBSmallDictionary new: 1 ]) + at: aKey put: anObject + + "Created: / 20-08-2015 / 18:24:46 / Jan Vrany " +! + +removeProperty: aKey + "Remove the property with aKey. Answer the property or raise + an error if aKey isn't found." + + ^ self removeProperty: aKey ifAbsent: [ self error: 'Property not found' ]. + + "Created: / 20-08-2015 / 18:30:16 / Jan Vrany " +! + +removeProperty: aKey ifAbsent: aBlock + "Remove the property with aKey. Answer the value or, if aKey isn't found, answer the result of evaluating aBlock." + + | answer | + properties isNil ifTrue: [ ^ aBlock value ]. + answer := properties removeKey: aKey ifAbsent: aBlock. + properties isEmpty ifTrue: [ properties := nil ]. + ^ answer + + "Created: / 20-08-2015 / 18:30:41 / Jan Vrany " +! ! + +!TObjectWithProperties methodsFor:'attributes access'! + +objectAttributes + ^ properties + + "Created: / 20-08-2015 / 18:32:48 / Jan Vrany " + "Modified (format): / 23-09-2015 / 21:11:11 / Jan Vrany " +! + +objectAttributes:aCollection + properties := aCollection + + "Created: / 23-09-2015 / 21:11:32 / Jan Vrany " +! ! + diff -r fa42d3f1a578 -r 10a95d798b36 compiler/TScope.st --- a/compiler/TScope.st Tue Sep 22 17:43:38 2015 +0100 +++ b/compiler/TScope.st Wed Sep 23 22:21:44 2015 +0100 @@ -2,7 +2,7 @@ "{ NameSpace: Smalltalk }" -Object subclass:#TScope +TObjectWithProperties subclass:#TScope instanceVariableNames:'node parent children variables' classVariableNames:'' poolDictionaries:'' @@ -45,6 +45,21 @@ "Modified: / 19-09-2015 / 05:56:30 / Jan Vrany " ! ! +!TScope methodsFor:'accesssing - llvm'! + +llvmAllocas + ^ self propertyAt: #llvmAllocas + ifAbsent: [ parent notNil ifTrue:[ parent llvmAllocas ] ifFalse:[nil] ] + + "Created: / 23-09-2015 / 21:42:52 / Jan Vrany " +! + +llvmAllocas: anLLVMBasicBlock + self propertyAt: #llvmAllocas put: anLLVMBasicBlock + + "Created: / 23-09-2015 / 21:40:57 / Jan Vrany " +! ! + !TScope methodsFor:'adding & removing'! addSubScope: aTScope @@ -97,6 +112,12 @@ !TScope methodsFor:'testing'! +hasSelfArgument + ^ (node isMethod and:[node binding mclass isMetaclass not]) + + "Created: / 23-09-2015 / 18:48:30 / Jan Vrany " +! + isBlockScope ^ node isBlock diff -r fa42d3f1a578 -r 10a95d798b36 compiler/TSemanticAnalyser.st --- a/compiler/TSemanticAnalyser.st Tue Sep 22 17:43:38 2015 +0100 +++ b/compiler/TSemanticAnalyser.st Wed Sep 23 22:21:44 2015 +0100 @@ -40,29 +40,69 @@ ] ifFalse:[ binding := TArgumentBinding name:anRBVariableNode name. binding index: (anRBVariableNode parent arguments indexOf: anRBVariableNode) - + (anRBVariableNode parent scope isMethodScope ifTrue:[1] ifFalse:[0]) + + (anRBVariableNode parent scope hasSelfArgument ifTrue:[1] ifFalse:[0]) ]. anRBVariableNode parent scope addVariable: binding. super visitArgument: anRBVariableNode. "Created: / 25-08-2015 / 22:51:40 / Jan Vrany " - "Modified: / 19-09-2015 / 06:17:50 / Jan Vrany " + "Modified: / 23-09-2015 / 18:48:43 / Jan Vrany " ! ! !TSemanticAnalyser methodsFor:'visitor-double dispatching'! acceptBlockNode: aBlockNode - | scope | + | scope binding | aBlockNode parent isSpecialFormNode ifTrue:[ scope := TScope node: aBlockNode parent: aBlockNode parent scope ] ifFalse:[ scope := TScope node: aBlockNode ]. aBlockNode scope: scope. + + binding := TBlockBinding new. + binding parameterTypes: aBlockNode parameterTypes. + binding returnType: aBlockNode returnType. + aBlockNode binding: binding. + super acceptBlockNode: aBlockNode "Created: / 25-08-2015 / 22:30:21 / Jan Vrany " - "Modified: / 19-09-2015 / 06:16:41 / Jan Vrany " + "Modified: / 23-09-2015 / 16:31:36 / Jan Vrany " +! + +acceptIfTrueIfFalseNode: node + node arguments first isBlock ifFalse:[ + context reportSemanticError: 'First argument (true block) of ifTrue:ifFalse: special form is not a block'. + ] ifTrue:[ + node arguments first arguments notEmptyOrNil ifTrue:[ + context reportSemanticError: 'First argument (true block) of ifTrue::ifFalse: special form may not have any arguments'. + ] + ]. + node arguments second isBlock ifFalse:[ + context reportSemanticError: 'Second argument (false block) of ifTrue:ifFalse: special form is not a block'. + ] ifTrue:[ + node arguments second arguments notEmptyOrNil ifTrue:[ + context reportSemanticError: 'Second argument (false block) of ifTrue::ifFalse: special form may not have any arguments'. + ] + ]. + + ^ self acceptMessageNode: node. + + "Created: / 23-09-2015 / 14:20:00 / Jan Vrany " +! + +acceptIfTrueNode: node + node arguments first isBlock ifFalse:[ + context reportSemanticError: 'Argument (true block) of ifTrue: special form is not a block'. + ] ifTrue:[ + node arguments first arguments notEmptyOrNil ifTrue:[ + context reportSemanticError: 'Argument (true block) of ifTrue: special form may not have any arguments'. + ] + ]. + self acceptMessageNode: node + + "Created: / 23-09-2015 / 14:18:49 / Jan Vrany " ! acceptLiteralNode: aRBLiteralNode @@ -89,7 +129,7 @@ scope := TScope node: aMethodNode. bindingForSelf := TArgumentBinding name:'self'. - bindingForSelf index: self. + bindingForSelf index: 1. scope addVariable: bindingForSelf. aMethodNode scope: scope. @@ -97,7 +137,7 @@ super acceptMethodNode: aMethodNode "Created: / 25-08-2015 / 22:29:21 / Jan Vrany " - "Modified: / 13-09-2015 / 09:30:28 / Jan Vrany " + "Modified: / 23-09-2015 / 18:31:07 / Jan Vrany " ! acceptVariableNode: aVariableNode @@ -113,6 +153,26 @@ "Created: / 25-08-2015 / 23:00:34 / Jan Vrany " "Modified: / 20-09-2015 / 06:14:37 / Jan Vrany " +! + +acceptWhileTrueNode: node + node receiver isBlock ifFalse:[ + context reportSemanticError: 'Receiver (condition) of whileTrue: special form is not a block'. + ] ifTrue:[ + node receiver arguments notEmptyOrNil ifTrue:[ + context reportSemanticError: 'Receiver (condition) of whileTrue: special form may not have any arguments'. + ] + ]. + node arguments first isBlock ifFalse:[ + context reportSemanticError: 'Argument (loop body) of whileTrue: special form is not a block'. + ] ifTrue:[ + node arguments first arguments notEmptyOrNil ifTrue:[ + context reportSemanticError: 'Argument (loop body) of whileTrue: special form may not have any arguments'. + ] + ]. + super acceptWhileTrueNode: node + + "Created: / 23-09-2015 / 14:10:40 / Jan Vrany " ! ! !TSemanticAnalyser class methodsFor:'documentation'! diff -r fa42d3f1a578 -r 10a95d798b36 compiler/TSimpleType.st --- a/compiler/TSimpleType.st Tue Sep 22 17:43:38 2015 +0100 +++ b/compiler/TSimpleType.st Wed Sep 23 22:21:44 2015 +0100 @@ -70,14 +70,6 @@ !TSimpleType methodsFor:'printing & storing'! -printOn:aStream - aStream nextPut: $<; space. - self printWithoutAnglesOn:aStream. - aStream space; nextPut: $>. - - "Created: / 25-08-2015 / 23:22:15 / Jan Vrany " -! - printWithoutAnglesOn:aStream aStream nextPutAll: name diff -r fa42d3f1a578 -r 10a95d798b36 compiler/TType.st --- a/compiler/TType.st Tue Sep 22 17:43:38 2015 +0100 +++ b/compiler/TType.st Wed Sep 23 22:21:44 2015 +0100 @@ -2,7 +2,7 @@ "{ NameSpace: Smalltalk }" -Object subclass:#TType +TObjectWithProperties subclass:#TType instanceVariableNames:'' classVariableNames:'' poolDictionaries:'' @@ -37,9 +37,9 @@ printOn:aStream aStream nextPut: $<; space. self printWithoutAnglesOn:aStream. - aStream nextPut: $>; space. + aStream space; nextPut: $>. - "Modified: / 21-08-2015 / 13:46:25 / Jan Vrany " + "Modified: / 23-09-2015 / 16:32:02 / Jan Vrany " ! printWithoutAnglesOn:aStream @@ -50,6 +50,12 @@ !TType methodsFor:'testing'! +isAutomaticType + ^ false + + "Created: / 23-09-2015 / 16:32:28 / Jan Vrany " +! + isBlockType ^ false @@ -73,6 +79,6 @@ ! version_HG - ^ 'Path: jv/tea/compiler/TType.st, Version: 1.0, User: jv, Time: 2015-08-26T07:46:38.380+01' + ^ '$Path: jv/tea/compiler/TType.st, Version: 1.0, User: jv, Time: 2015-08-26T07:46:38.380+01$' ! ! diff -r fa42d3f1a578 -r 10a95d798b36 compiler/TTypechecker.st --- a/compiler/TTypechecker.st Tue Sep 22 17:43:38 2015 +0100 +++ b/compiler/TTypechecker.st Wed Sep 23 22:21:44 2015 +0100 @@ -25,6 +25,24 @@ !TTypechecker methodsFor:'visitor-double dispatching'! +acceptBlockNode: aBlockNode + | formalType actualType | + + super acceptBlockNode: aBlockNode. + + formalType := aBlockNode binding type. + actualType := aBlockNode body statements last binding type. + formalType isAutomaticType ifTrue:[ + aBlockNode binding returnType: actualType. + ] ifFalse:[ + formalType = actualType ifFalse:[ + context reportTypeError: ('Block return type is specified as %1 but actually is %3' bindWith: formalType with: actualType). + ]. + ]. + + "Created: / 23-09-2015 / 16:44:07 / Jan Vrany " +! + acceptIfTrueIfFalseNode: node | receiverType booleanType | @@ -94,6 +112,25 @@ "Created: / 02-09-2015 / 10:34:08 / Jan Vrany " "Modified: / 14-09-2015 / 14:22:41 / Jan Vrany " +! + +acceptWhileTrueNode: node + | receiverType booleanType | + + (node isCascaded not or: [node isFirstCascaded]) ifTrue: [ + self visitNode: node receiver + ]. + node arguments do: [:each | self visitNode: each]. + + receiverType := node receiver binding type. + booleanType := context environment binding lookupClassBoolean type. + + receiverType = booleanType ifFalse:[ + context reportTypeError: 'receiver of ifTrue:ifFalse: special form must be of type tBoolean (is ' , receiverType printString. + ]. + + "Created: / 23-09-2015 / 14:06:22 / Jan Vrany " + "Modified: / 23-09-2015 / 16:46:57 / Jan Vrany " ! ! !TTypechecker class methodsFor:'documentation'! diff -r fa42d3f1a578 -r 10a95d798b36 compiler/TValueBinding.st --- a/compiler/TValueBinding.st Tue Sep 22 17:43:38 2015 +0100 +++ b/compiler/TValueBinding.st Wed Sep 23 22:21:44 2015 +0100 @@ -33,3 +33,17 @@ "Created: / 31-08-2015 / 11:49:14 / Jan Vrany " ! ! +!TValueBinding methodsFor:'accesssing - llvm'! + +llvmValue + ^ self propertyAt: #llvmValue ifAbsent:[ nil ] + + "Created: / 23-09-2015 / 21:14:27 / Jan Vrany " +! + +llvmValue: anLLVMValue + self propertyAt: #llvmValue put: anLLVMValue + + "Created: / 23-09-2015 / 21:14:10 / Jan Vrany " +! ! + diff -r fa42d3f1a578 -r 10a95d798b36 compiler/abbrev.stc --- a/compiler/abbrev.stc Tue Sep 22 17:43:38 2015 +0100 +++ b/compiler/abbrev.stc Wed Sep 23 22:21:44 2015 +0100 @@ -1,48 +1,50 @@ # automagically generated by the project definition # this file is needed for stc to be able to compile modules independently. # it provides information about a classes filename, category and especially namespace. -TBinding TBinding jv:tea/compiler 'Languages-Tea-Compiler-Bindings' 0 TClassDefinition TClassDefinition jv:tea/compiler 'Languages-Tea-Compiler-Model' 0 TCompilationUnitDefinition TCompilationUnitDefinition jv:tea/compiler 'Languages-Tea-Compiler-Model' 0 TCompiler TCompiler jv:tea/compiler 'Languages-Tea-Compiler' 0 TCompilerContext TCompilerContext jv:tea/compiler 'Languages-Tea-Compiler' 0 TCompilerError TCompilerError jv:tea/compiler 'Languages-Tea-Compiler-Exceptions' 1 +TCompilerExamples TCompilerExamples jv:tea/compiler 'Languages-Tea-Compiler-Examples' 1 TEnvironmentProvider TEnvironmentProvider jv:tea/compiler 'Languages-Tea-Compiler-Model-Provider' 0 TFormatter TFormatter jv:tea/compiler 'Languages-Tea-Compiler-AST' 0 TMetaDefinition TMetaDefinition jv:tea/compiler 'Languages-Tea-Compiler-Model' 0 TMethodDefinition TMethodDefinition jv:tea/compiler 'Languages-Tea-Compiler-Model' 0 TNamespaceDefinition TNamespaceDefinition jv:tea/compiler 'Languages-Tea-Compiler-Model' 0 +TObjectWithProperties TObjectWithProperties jv:tea/compiler 'Languages-Tea-Compiler-Internals' 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 -TScope TScope jv:tea/compiler 'Languages-Tea-Compiler-Bindings' 0 TSourceReader TSourceReader jv:tea/compiler 'Languages-Tea-Compiler-Model' 0 TSpecialFormNode TSpecialFormNode jv:tea/compiler 'Languages-Tea-Compiler-AST' 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 +TBinding TBinding jv:tea/compiler 'Languages-Tea-Compiler-Bindings' 0 TCompilerPass TCompilerPass jv:tea/compiler 'Languages-Tea-Compiler-Internals' 0 TEnvironment TEnvironment jv:tea/compiler 'Languages-Tea-Compiler-Model' 0 TFilesystemProvider TFilesystemProvider jv:tea/compiler 'Languages-Tea-Compiler-Model-Provider' 0 +TScope TScope jv:tea/compiler 'Languages-Tea-Compiler-Bindings' 0 +TSimpleTypeNode TSimpleTypeNode jv:tea/compiler 'Languages-Tea-Compiler-AST' 0 +TType TType jv:tea/compiler 'Languages-Tea-Compiler-Types' 0 +TAutomaticType TAutomaticType jv:tea/compiler 'Languages-Tea-Compiler-Types' 0 +TBlockType TBlockType jv:tea/compiler 'Languages-Tea-Compiler-Types' 0 +TClassBinding TClassBinding jv:tea/compiler 'Languages-Tea-Compiler-Bindings' 0 TFunctionBinding TFunctionBinding jv:tea/compiler 'Languages-Tea-Compiler-Bindings' 0 +TLLVMCodeGenerator TLLVMCodeGenerator jv:tea/compiler 'Languages-Tea-Compiler-Internals' 0 TNamespaceBinding TNamespaceBinding jv:tea/compiler 'Languages-Tea-Compiler-Bindings' 0 +TSemanticAnalyser TSemanticAnalyser jv:tea/compiler 'Languages-Tea-Compiler-Internals' 0 TSimpleType TSimpleType jv:tea/compiler 'Languages-Tea-Compiler-Types' 0 -TSimpleTypeNode TSimpleTypeNode jv:tea/compiler 'Languages-Tea-Compiler-AST' 0 +TTypechecker TTypechecker jv:tea/compiler 'Languages-Tea-Compiler-Internals' 0 TValueBinding TValueBinding jv:tea/compiler 'Languages-Tea-Compiler-Bindings' 0 TBlockBinding TBlockBinding jv:tea/compiler 'Languages-Tea-Compiler-Bindings' 0 TConstantBinding TConstantBinding jv:tea/compiler 'Languages-Tea-Compiler-Bindings' 0 -TLLVMCodeGenerator TLLVMCodeGenerator jv:tea/compiler 'Languages-Tea-Compiler-Internals' 0 TMethodBinding TMethodBinding jv:tea/compiler 'Languages-Tea-Compiler-Bindings' 0 -TSemanticAnalyser TSemanticAnalyser jv:tea/compiler 'Languages-Tea-Compiler-Internals' 0 -TTypechecker TTypechecker jv:tea/compiler 'Languages-Tea-Compiler-Internals' 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 -TCompilerExamples TCompilerExamples jv:tea/compiler 'Languages-Tea-Compiler-Examples' 1 TMethodDefinitionTests TMethodDefinitionTests jv:tea/compiler 'Languages-Tea-Compiler-Model-Tests' 1 +TParserTests TParserTests jv:tea/compiler 'Languages-Tea-Compiler-AST-Tests' 1 TSemanticAnalyserTests TSemanticAnalyserTests jv:tea/compiler 'Languages-Tea-Compiler-Internals-Tests' 1 TSourceReaderTests TSourceReaderTests jv:tea/compiler 'Languages-Tea-Compiler-Model-Tests' 1 TTypecheckerTests TTypecheckerTests jv:tea/compiler 'Languages-Tea-Compiler-Internals-Tests' 1 diff -r fa42d3f1a578 -r 10a95d798b36 compiler/bc.mak --- a/compiler/bc.mak Tue Sep 22 17:43:38 2015 +0100 +++ b/compiler/bc.mak Wed Sep 23 22:21:44 2015 +0100 @@ -74,7 +74,6 @@ # BEGINMAKEDEPEND --- do not remove this line; make depend needs it -$(OUTDIR)TBinding.$(O) TBinding.$(H): TBinding.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR) $(OUTDIR)TClassDefinition.$(O) TClassDefinition.$(H): TClassDefinition.st $(INCLUDE_TOP)\stx\goodies\ring\RGBehaviorDefinition.$(H) $(INCLUDE_TOP)\stx\goodies\ring\RGClassDefinition.$(H) $(INCLUDE_TOP)\stx\goodies\ring\RGClassDescriptionDefinition.$(H) $(INCLUDE_TOP)\stx\goodies\ring\RGDefinition.$(H) $(INCLUDE_TOP)\stx\goodies\ring\RGGlobalDefinition.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR) $(OUTDIR)TCompilationUnitDefinition.$(O) TCompilationUnitDefinition.$(H): TCompilationUnitDefinition.st $(INCLUDE_TOP)\stx\goodies\ring\RGAbstractContainer.$(H) $(INCLUDE_TOP)\stx\goodies\ring\RGDefinition.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR) $(OUTDIR)TCompiler.$(O) TCompiler.$(H): TCompiler.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR) @@ -85,35 +84,38 @@ $(OUTDIR)TMetaDefinition.$(O) TMetaDefinition.$(H): TMetaDefinition.st $(INCLUDE_TOP)\stx\goodies\ring\RGBehaviorDefinition.$(H) $(INCLUDE_TOP)\stx\goodies\ring\RGClassDescriptionDefinition.$(H) $(INCLUDE_TOP)\stx\goodies\ring\RGDefinition.$(H) $(INCLUDE_TOP)\stx\goodies\ring\RGGlobalDefinition.$(H) $(INCLUDE_TOP)\stx\goodies\ring\RGMetaclassDefinition.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR) $(OUTDIR)TMethodDefinition.$(O) TMethodDefinition.$(H): TMethodDefinition.st $(INCLUDE_TOP)\stx\goodies\ring\RGDefinition.$(H) $(INCLUDE_TOP)\stx\goodies\ring\RGElementDefinition.$(H) $(INCLUDE_TOP)\stx\goodies\ring\RGMethodDefinition.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR) $(OUTDIR)TNamespaceDefinition.$(O) TNamespaceDefinition.$(H): TNamespaceDefinition.st $(INCLUDE_TOP)\stx\goodies\ring\RGAbstractContainer.$(H) $(INCLUDE_TOP)\stx\goodies\ring\RGContainer.$(H) $(INCLUDE_TOP)\stx\goodies\ring\RGDefinition.$(H) $(INCLUDE_TOP)\stx\goodies\ring\RGNamespace.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR) +$(OUTDIR)TObjectWithProperties.$(O) TObjectWithProperties.$(H): TObjectWithProperties.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR) $(OUTDIR)TParser.$(O) TParser.$(H): TParser.st $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\parser\RBParser.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR) $(OUTDIR)TProgramNodeVisitor.$(O) TProgramNodeVisitor.$(H): TProgramNodeVisitor.st $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\parser\RBProgramNodeVisitor.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR) -$(OUTDIR)TScope.$(O) TScope.$(H): TScope.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR) $(OUTDIR)TSourceReader.$(O) TSourceReader.$(H): TSourceReader.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR) $(OUTDIR)TSpecialFormNode.$(O) TSpecialFormNode.$(H): TSpecialFormNode.st $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\parser\RBMessageNode.$(H) $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\parser\RBProgramNode.$(H) $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\parser\RBStatementNode.$(H) $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\parser\RBValueNode.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR) -$(OUTDIR)TType.$(O) TType.$(H): TType.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR) $(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)TBinding.$(O) TBinding.$(H): TBinding.st $(INCLUDE_TOP)\jv\tea\compiler\TObjectWithProperties.$(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)TEnvironment.$(O) TEnvironment.$(H): TEnvironment.st $(INCLUDE_TOP)\jv\tea\compiler\TNamespaceDefinition.$(H) $(INCLUDE_TOP)\stx\goodies\ring\RGAbstractContainer.$(H) $(INCLUDE_TOP)\stx\goodies\ring\RGContainer.$(H) $(INCLUDE_TOP)\stx\goodies\ring\RGDefinition.$(H) $(INCLUDE_TOP)\stx\goodies\ring\RGNamespace.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR) $(OUTDIR)TFilesystemProvider.$(O) TFilesystemProvider.$(H): TFilesystemProvider.st $(INCLUDE_TOP)\jv\tea\compiler\TEnvironmentProvider.$(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)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)TScope.$(O) TScope.$(H): TScope.st $(INCLUDE_TOP)\jv\tea\compiler\TObjectWithProperties.$(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)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)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)TType.$(O) TType.$(H): TType.st $(INCLUDE_TOP)\jv\tea\compiler\TObjectWithProperties.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR) +$(OUTDIR)TAutomaticType.$(O) TAutomaticType.$(H): TAutomaticType.st $(INCLUDE_TOP)\jv\tea\compiler\TObjectWithProperties.$(H) $(INCLUDE_TOP)\jv\tea\compiler\TType.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR) +$(OUTDIR)TBlockType.$(O) TBlockType.$(H): TBlockType.st $(INCLUDE_TOP)\jv\tea\compiler\TObjectWithProperties.$(H) $(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)\jv\tea\compiler\TObjectWithProperties.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR) +$(OUTDIR)TFunctionBinding.$(O) TFunctionBinding.$(H): TFunctionBinding.st $(INCLUDE_TOP)\jv\tea\compiler\TBinding.$(H) $(INCLUDE_TOP)\jv\tea\compiler\TObjectWithProperties.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR) $(OUTDIR)TLLVMCodeGenerator.$(O) TLLVMCodeGenerator.$(H): TLLVMCodeGenerator.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)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)TNamespaceBinding.$(O) TNamespaceBinding.$(H): TNamespaceBinding.st $(INCLUDE_TOP)\jv\tea\compiler\TBinding.$(H) $(INCLUDE_TOP)\jv\tea\compiler\TObjectWithProperties.$(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)TSimpleType.$(O) TSimpleType.$(H): TSimpleType.st $(INCLUDE_TOP)\jv\tea\compiler\TObjectWithProperties.$(H) $(INCLUDE_TOP)\jv\tea\compiler\TType.$(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)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) -$(OUTDIR)extensions.$(O): extensions.st $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\parser\RBBlockNode.$(H) $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\parser\RBMethodNode.$(H) $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\parser\RBProgramNode.$(H) $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\parser\RBReturnNode.$(H) $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\parser\RBStatementNode.$(H) $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\parser\RBToken.$(H) $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\parser\RBValueNode.$(H) $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\parser\RBVariableNode.$(H) $(INCLUDE_TOP)\stx\goodies\ring\RGBehaviorDefinition.$(H) $(INCLUDE_TOP)\stx\goodies\ring\RGClassDefinition.$(H) $(INCLUDE_TOP)\stx\goodies\ring\RGClassDescriptionDefinition.$(H) $(INCLUDE_TOP)\stx\goodies\ring\RGDefinition.$(H) $(INCLUDE_TOP)\stx\goodies\ring\RGElementDefinition.$(H) $(INCLUDE_TOP)\stx\goodies\ring\RGGlobalDefinition.$(H) $(INCLUDE_TOP)\stx\goodies\ring\RGMetaclassDefinition.$(H) $(INCLUDE_TOP)\stx\goodies\ring\RGMethodDefinition.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR) +$(OUTDIR)TValueBinding.$(O) TValueBinding.$(H): TValueBinding.st $(INCLUDE_TOP)\jv\tea\compiler\TBinding.$(H) $(INCLUDE_TOP)\jv\tea\compiler\TObjectWithProperties.$(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)\jv\tea\compiler\TObjectWithProperties.$(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\TObjectWithProperties.$(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)\jv\tea\compiler\TObjectWithProperties.$(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\TObjectWithProperties.$(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\TObjectWithProperties.$(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\TObjectWithProperties.$(H) $(INCLUDE_TOP)\jv\tea\compiler\TValueBinding.$(H) $(INCLUDE_TOP)\jv\tea\compiler\TVariableBinding.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR) +$(OUTDIR)extensions.$(O): extensions.st $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\parser\RBAssignmentNode.$(H) $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\parser\RBBlockNode.$(H) $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\parser\RBMethodNode.$(H) $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\parser\RBProgramNode.$(H) $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\parser\RBReturnNode.$(H) $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\parser\RBStatementNode.$(H) $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\parser\RBToken.$(H) $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\parser\RBValueNode.$(H) $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\parser\RBVariableNode.$(H) $(INCLUDE_TOP)\stx\goodies\ring\RGBehaviorDefinition.$(H) $(INCLUDE_TOP)\stx\goodies\ring\RGClassDefinition.$(H) $(INCLUDE_TOP)\stx\goodies\ring\RGClassDescriptionDefinition.$(H) $(INCLUDE_TOP)\stx\goodies\ring\RGDefinition.$(H) $(INCLUDE_TOP)\stx\goodies\ring\RGElementDefinition.$(H) $(INCLUDE_TOP)\stx\goodies\ring\RGGlobalDefinition.$(H) $(INCLUDE_TOP)\stx\goodies\ring\RGMetaclassDefinition.$(H) $(INCLUDE_TOP)\stx\goodies\ring\RGMethodDefinition.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR) # ENDMAKEDEPEND --- do not remove this line diff -r fa42d3f1a578 -r 10a95d798b36 compiler/extensions.st --- a/compiler/extensions.st Tue Sep 22 17:43:38 2015 +0100 +++ b/compiler/extensions.st Wed Sep 23 22:21:44 2015 +0100 @@ -1,5 +1,40 @@ "{ Package: 'jv:tea/compiler' }"! +!RBAssignmentNode methodsFor:'accessing'! + +binding + ^ variable binding + + "Created: / 23-09-2015 / 16:45:31 / Jan Vrany " +! ! + +!RBAssignmentNode methodsFor:'accessing'! + +binding: aTBinding + self shouldNotImplement + + "Created: / 23-09-2015 / 16:45:14 / Jan Vrany " +! ! + +!RBBlockNode methodsFor:'accessing'! + +parameterTypes + ^arguments collect:[ :arg | arg type ] + + "Created: / 23-09-2015 / 16:30:07 / Jan Vrany " +! ! + +!RBBlockNode methodsFor:'accessing'! + +returnType + | spec | + + spec := self returnTypeSpec. + ^ spec notNil ifTrue:[ spec asType ] ifFalse:[ TAutomaticType new ] + + "Created: / 23-09-2015 / 16:28:30 / Jan Vrany " +! ! + !RBBlockNode methodsFor:'accessing'! returnTypeSpec @@ -39,6 +74,25 @@ !RBMethodNode methodsFor:'accessing'! +parameterTypes + ^arguments collect:[ :arg | arg type ] + + "Created: / 23-09-2015 / 16:30:07 / Jan Vrany " +! ! + +!RBMethodNode methodsFor:'accessing'! + +returnType + | spec | + + spec := self returnTypeSpec. + ^ spec notNil ifTrue:[ spec asType ] ifFalse:[ TAutomaticType new ] + + "Created: / 23-09-2015 / 16:28:30 / Jan Vrany " +! ! + +!RBMethodNode methodsFor:'accessing'! + returnTypeSpec "Return the TTypeSpecNode describing the return type of the method" @@ -148,6 +202,17 @@ !RBVariableNode methodsFor:'accessing'! +type + | spec | + + spec := self typeSpec. + ^ spec notNil ifTrue:[ spec asType ] ifFalse:[ TAutomaticType new ] + + "Created: / 23-09-2015 / 16:29:32 / Jan Vrany " +! ! + +!RBVariableNode methodsFor:'accessing'! + typeSpec "Return the TTypeSpecNode associated with this variable node (if this node is for variable declaration) or nil (otherwise)" diff -r fa42d3f1a578 -r 10a95d798b36 compiler/jv_tea_compiler.st --- a/compiler/jv_tea_compiler.st Tue Sep 22 17:43:38 2015 +0100 +++ b/compiler/jv_tea_compiler.st Wed Sep 23 22:21:44 2015 +0100 @@ -30,10 +30,10 @@ by searching along the inheritance chain of all of my classes." ^ #( - #'stx:goodies/refactoryBrowser/parser' "RBBlockNode - extended" + #'stx:goodies/refactoryBrowser/parser' "RBAssignmentNode - extended" #'stx:goodies/ring' "RGAbstractContainer - superclass of TCompilationUnitDefinition" #'stx:goodies/sunit' "TestAsserter - superclass of TCompilerExamples" - #'stx:libbasic' "Error - superclass of TCompilerError" + #'stx:libbasic' "Autoload - superclass of TMethodDefinitionTests" ) ! @@ -73,48 +73,50 @@ ^ #( " or ( attributes...) in load order" - TBinding TClassDefinition TCompilationUnitDefinition TCompiler TCompilerContext TCompilerError + (TCompilerExamples autoload) TEnvironmentProvider TFormatter TMetaDefinition TMethodDefinition TNamespaceDefinition + TObjectWithProperties TParser - (TParserTests autoload) TProgramNodeVisitor - TScope TSourceReader TSpecialFormNode - TType TTypeNode TTypeSpecNode #'jv_tea_compiler' - TBlockType - TClassBinding + TBinding TCompilerPass TEnvironment TFilesystemProvider + TScope + TSimpleTypeNode + TType + TAutomaticType + TBlockType + TClassBinding TFunctionBinding + TLLVMCodeGenerator TNamespaceBinding + TSemanticAnalyser TSimpleType - TSimpleTypeNode + TTypechecker TValueBinding TBlockBinding TConstantBinding - TLLVMCodeGenerator TMethodBinding - TSemanticAnalyser - TTypechecker TVariableBinding TArgumentBinding TLocalBinding - (TCompilerExamples autoload) (TMethodDefinitionTests autoload) + (TParserTests autoload) (TSemanticAnalyserTests autoload) (TSourceReaderTests autoload) (TTypecheckerTests autoload) @@ -149,6 +151,13 @@ RBToken isTInlineAssemblyEnd RGDefinition isCompilationUnit RBProgramNode isSpecialFormNode + RBAssignmentNode binding + RBAssignmentNode binding: + RBBlockNode parameterTypes + RBBlockNode returnType + RBMethodNode parameterTypes + RBMethodNode returnType + RBVariableNode type ) ! ! diff -r fa42d3f1a578 -r 10a95d798b36 compiler/libInit.cc --- a/compiler/libInit.cc Tue Sep 22 17:43:38 2015 +0100 +++ b/compiler/libInit.cc Wed Sep 23 22:21:44 2015 +0100 @@ -27,7 +27,6 @@ void _libjv_tea_compiler_Init(pass, __pRT__, snd) OBJ snd; struct __vmData__ *__pRT__; { __BEGIN_PACKAGE2__("libjv_tea_compiler", _libjv_tea_compiler_Init, "jv:tea/compiler"); -_TBinding_Init(pass,__pRT__,snd); _TClassDefinition_Init(pass,__pRT__,snd); _TCompilationUnitDefinition_Init(pass,__pRT__,snd); _TCompiler_Init(pass,__pRT__,snd); @@ -38,31 +37,34 @@ _TMetaDefinition_Init(pass,__pRT__,snd); _TMethodDefinition_Init(pass,__pRT__,snd); _TNamespaceDefinition_Init(pass,__pRT__,snd); +_TObjectWithProperties_Init(pass,__pRT__,snd); _TParser_Init(pass,__pRT__,snd); _TProgramNodeVisitor_Init(pass,__pRT__,snd); -_TScope_Init(pass,__pRT__,snd); _TSourceReader_Init(pass,__pRT__,snd); _TSpecialFormNode_Init(pass,__pRT__,snd); -_TType_Init(pass,__pRT__,snd); _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); +_TBinding_Init(pass,__pRT__,snd); _TCompilerPass_Init(pass,__pRT__,snd); _TEnvironment_Init(pass,__pRT__,snd); _TFilesystemProvider_Init(pass,__pRT__,snd); +_TScope_Init(pass,__pRT__,snd); +_TSimpleTypeNode_Init(pass,__pRT__,snd); +_TType_Init(pass,__pRT__,snd); +_TAutomaticType_Init(pass,__pRT__,snd); +_TBlockType_Init(pass,__pRT__,snd); +_TClassBinding_Init(pass,__pRT__,snd); _TFunctionBinding_Init(pass,__pRT__,snd); +_TLLVMCodeGenerator_Init(pass,__pRT__,snd); _TNamespaceBinding_Init(pass,__pRT__,snd); +_TSemanticAnalyser_Init(pass,__pRT__,snd); _TSimpleType_Init(pass,__pRT__,snd); -_TSimpleTypeNode_Init(pass,__pRT__,snd); +_TTypechecker_Init(pass,__pRT__,snd); _TValueBinding_Init(pass,__pRT__,snd); _TBlockBinding_Init(pass,__pRT__,snd); _TConstantBinding_Init(pass,__pRT__,snd); -_TLLVMCodeGenerator_Init(pass,__pRT__,snd); _TMethodBinding_Init(pass,__pRT__,snd); -_TSemanticAnalyser_Init(pass,__pRT__,snd); -_TTypechecker_Init(pass,__pRT__,snd); _TVariableBinding_Init(pass,__pRT__,snd); _TArgumentBinding_Init(pass,__pRT__,snd); _TLocalBinding_Init(pass,__pRT__,snd);