--- a/compiler/PPCConfiguration.st Tue Aug 18 22:46:10 2015 +0100
+++ b/compiler/PPCConfiguration.st Mon Aug 24 15:56:20 2015 +0100
@@ -32,8 +32,8 @@
!PPCConfiguration methodsFor:'accessing'!
arguments
- arguments isNil ifTrue: [ arguments := self defaultArguments ].
- ^ arguments
+ arguments isNil ifTrue: [ arguments := self defaultArguments ].
+ ^ arguments
!
arguments: args
@@ -46,7 +46,8 @@
input: whatever
ir := whatever.
- self remember: #input.
+
+ self remember: (self copyTree: ir) as: #input
!
ir
@@ -106,10 +107,6 @@
!PPCConfiguration methodsFor:'compiling'!
-buildClass: compiler
- self subclassResponsibility
-!
-
compile: whatever
| time |
self input: whatever.
@@ -133,33 +130,33 @@
!PPCConfiguration methodsFor:'debugging'!
copy: somethingTransformable
+ self deprecated: 'copy on your own, or whatever, but dont use me'.
+ ^ somethingTransformable transform: [ :e | e copy ]
+!
+
+copyTree: somethingTransformable
^ somethingTransformable transform: [ :e | e copy ]
!
remember: key
+ self deprecated: 'use remember:as:'.
+
self arguments debug ifTrue: [
history add: key -> (self copy: ir).
]
-! !
-
-!PPCConfiguration methodsFor:'hooks'!
-
-codeCompiler
- ^ PPCCodeGen on: arguments
!
-codeCompilerOn: args
- ^ PPCCodeGen on: args
-!
-
-codeGeneratorVisitorOn: compiler
- ^ arguments codeGenerator on: compiler
+remember: value as: key
+ self arguments debug ifTrue: [
+ history add: key -> value.
+ ]
! !
!PPCConfiguration methodsFor:'initialization'!
initialize
- history := OrderedCollection new
+ history := OrderedCollection new.
+ arguments := PPCArguments default.
! !
!PPCConfiguration methodsFor:'phases'!
@@ -183,7 +180,8 @@
ir := PPCRecognizerComponentDetector new
arguments: arguments;
visit: ir.
- self remember: #recognizingComponents
+
+ self remember: (self copyTree: ir) as: #recognizingComponents
!
createTokens
@@ -192,24 +190,8 @@
ir := PPCTokenDetector new
arguments: arguments;
visit: ir.
- self remember: #createTokens
-!
-generate
- | compiler rootMethod compiledParser |
- arguments generate ifFalse: [ ^ self ].
-
- compiler := self codeCompiler.
-
- rootMethod := (self codeGeneratorVisitorOn: compiler)
- arguments: arguments;
- visit: ir.
-
- compiledParser := self buildClass: compiler.
- compiledParser startSymbol: rootMethod methodName.
- compiledParser := compiledParser new.
-
- ir := compiledParser.
+ self remember: (self copyTree: ir) as: #createTokens
!
inline
@@ -218,7 +200,8 @@
ir := PPCInliningVisitor new
arguments: arguments;
visit: ir.
- self remember: #inline.
+
+ self remember: (self copyTree: ir) as: #inline.
!
merge
@@ -228,7 +211,8 @@
ir := PPCMergingVisitor new
arguments: arguments;
visit: ir.
- self remember: #merge
+
+ self remember: (self copyTree: ir) as: #merge
!
specialize
@@ -243,13 +227,15 @@
ir := (PPCSpecializingVisitor new
arguments: arguments;
visit: ir).
- self remember: #specialize
+
+ self remember: (self copyTree: ir) as: #specialize
!
toPPCIr
"Creates a PPCNodes from a PPParser"
ir := ir asCompilerTree.
- self remember: #ppcNodes
+
+ self remember: (self copyTree: ir) as: #ppcNodes
! !
!PPCConfiguration methodsFor:'reporting'!