From 6b4de4bcb32c1f67a65ec0d7e06daaf9918eac0a Mon Sep 17 00:00:00 2001 From: adri09070 <97704417+adri09070@users.noreply.github.com> Date: Thu, 18 Aug 2022 16:17:30 +0200 Subject: [PATCH 1/5] updating ASTInterpreter and visitors according to nez API for TemporaryVariable and ArgumentVariable --- DebuggableASTInterpreter/DASTInterpreter.class.st | 5 +++++ .../DASTPostOrderTreeVisitor.class.st | 12 ++++++++++++ 2 files changed, 17 insertions(+) diff --git a/DebuggableASTInterpreter/DASTInterpreter.class.st b/DebuggableASTInterpreter/DASTInterpreter.class.st index d0970dd..bff841c 100644 --- a/DebuggableASTInterpreter/DASTInterpreter.class.st +++ b/DebuggableASTInterpreter/DASTInterpreter.class.st @@ -310,6 +310,11 @@ DASTInterpreter >> visitArgumentNode: aRBArgumentNode [ self stackPush: (currentContext findVariable: aRBArgumentNode name) ] +{ #category : #visiting } +DASTInterpreter >> visitArgumentVariableNode: aRBVariableNode [ + self visitVariableNode: aRBVariableNode . +] + { #category : #visiting } DASTInterpreter >> visitArrayNode: aRBArrayNode [ | literals size arrayMirror | diff --git a/DebuggableASTInterpreter/DASTPostOrderTreeVisitor.class.st b/DebuggableASTInterpreter/DASTPostOrderTreeVisitor.class.st index 75436db..1716250 100644 --- a/DebuggableASTInterpreter/DASTPostOrderTreeVisitor.class.st +++ b/DebuggableASTInterpreter/DASTPostOrderTreeVisitor.class.st @@ -37,6 +37,12 @@ DASTPostOrderTreeVisitor >> visitArgumentNode: aRBArgumentNode [ ^ stack push: aRBArgumentNode ] +{ #category : #visiting } +DASTPostOrderTreeVisitor >> visitArgumentVariableNode: aRBVariableNode [ + + stack push: aRBVariableNode +] + { #category : #visiting } DASTPostOrderTreeVisitor >> visitArrayNode: aRBArrayNode [ stack push: aRBArrayNode. @@ -138,6 +144,12 @@ DASTPostOrderTreeVisitor >> visitTemporaryNode: aRBTemporaryNode [ stack push: aRBTemporaryNode ] +{ #category : #visiting } +DASTPostOrderTreeVisitor >> visitTemporaryVariableNode: aRBVariableNode [ + + stack push: aRBVariableNode +] + { #category : #visiting } DASTPostOrderTreeVisitor >> visitThisContextNode: aRBThisContextNode [ stack push: aRBThisContextNode From 474dbd3c6efa8a550d614b3e05cbdc87de81f56e Mon Sep 17 00:00:00 2001 From: adri09070 <97704417+adri09070@users.noreply.github.com> Date: Tue, 30 Aug 2022 12:08:04 +0200 Subject: [PATCH 2/5] updating ASTInterpreter and ASTPostOrderTreeVisitor according to new AST Visitor API --- .../DASTInterpreter.class.st | 27 +++++++++++++++++ .../DASTPostOrderTreeVisitor.class.st | 29 ++++++++++++++++++- 2 files changed, 55 insertions(+), 1 deletion(-) diff --git a/DebuggableASTInterpreter/DASTInterpreter.class.st b/DebuggableASTInterpreter/DASTInterpreter.class.st index bff841c..2efd49c 100644 --- a/DebuggableASTInterpreter/DASTInterpreter.class.st +++ b/DebuggableASTInterpreter/DASTInterpreter.class.st @@ -347,6 +347,12 @@ DASTInterpreter >> visitCascadeNode: aRBCascadeNode [ self flag: 'I do nothing'. ] +{ #category : #visiting } +DASTInterpreter >> visitClassVariableNode: aNode [ + + ^ self visitLiteralVariableNode: aNode +] + { #category : #visiting } DASTInterpreter >> visitGlobalNode: aRBGlobalNode [ @@ -354,6 +360,12 @@ DASTInterpreter >> visitGlobalNode: aRBGlobalNode [ ] +{ #category : #visiting } +DASTInterpreter >> visitGlobalVariableNode: aNode [ + + ^ self visitLiteralVariableNode: aNode +] + { #category : #visiting } DASTInterpreter >> visitInstanceVariableNode: aRBInstanceVariableNode [ self stackPush: (self readInstanceVariableNamed: aRBInstanceVariableNode name) @@ -379,6 +391,21 @@ DASTInterpreter >> visitLiteralValueNode: aRBLiteralValueNode [ self visitLiteralNode: aRBLiteralValueNode ] +{ #category : #visiting } +DASTInterpreter >> visitLiteralVariableNode: aNode [ + "to be backward compatible, we visit for Gloabls here (there used to be no difference)" + + ^ self visitGlobalNode: aNode +] + +{ #category : #visiting } +DASTInterpreter >> visitLocalVariableNode: aNode [ + + "call visitTemporaryNode: for backward compatibility" + + ^ self visitTemporaryNode: aNode +] + { #category : #visiting } DASTInterpreter >> visitMessageNode: aRBMessageNode [ | arguments receiver method newContext | diff --git a/DebuggableASTInterpreter/DASTPostOrderTreeVisitor.class.st b/DebuggableASTInterpreter/DASTPostOrderTreeVisitor.class.st index 1716250..4e8af2e 100644 --- a/DebuggableASTInterpreter/DASTPostOrderTreeVisitor.class.st +++ b/DebuggableASTInterpreter/DASTPostOrderTreeVisitor.class.st @@ -67,11 +67,23 @@ DASTPostOrderTreeVisitor >> visitCascadeNode: aRBCascadeNode [ aRBCascadeNode children reverse do: [ :e | e acceptVisitor: self ] ] +{ #category : #visiting } +DASTPostOrderTreeVisitor >> visitClassVariableNode: aNode [ + + ^ self visitLiteralVariableNode: aNode +] + { #category : #visiting } DASTPostOrderTreeVisitor >> visitGlobalNode: aRBGlobalNode [ stack push: aRBGlobalNode ] +{ #category : #visiting } +DASTPostOrderTreeVisitor >> visitGlobalVariableNode: aNode [ + + ^ self visitLiteralVariableNode: aNode +] + { #category : #visiting } DASTPostOrderTreeVisitor >> visitInstanceVariableNode: aRBInstanceVariableNode [ stack push: aRBInstanceVariableNode @@ -95,6 +107,21 @@ DASTPostOrderTreeVisitor >> visitLiteralValueNode: aRBLiteralValueNode [ ^ self visitLiteralNode: aRBLiteralValueNode ] +{ #category : #visiting } +DASTPostOrderTreeVisitor >> visitLiteralVariableNode: aNode [ + "to be backward compatible, we visit for Gloabls here (there used to be no difference)" + + ^ self visitGlobalNode: aNode +] + +{ #category : #visiting } +DASTPostOrderTreeVisitor >> visitLocalVariableNode: aNode [ + + "call visitTemporaryNode: for backward compatibility" + + ^ self visitTemporaryNode: aNode +] + { #category : #visiting } DASTPostOrderTreeVisitor >> visitMessageNode: aRBMessageNode [ @@ -139,7 +166,7 @@ DASTPostOrderTreeVisitor >> visitSuperNode: aRBSuperNode [ ^ stack push: aRBSuperNode ] -{ #category : #'as yet unclassified' } +{ #category : #visiting } DASTPostOrderTreeVisitor >> visitTemporaryNode: aRBTemporaryNode [ stack push: aRBTemporaryNode ] From 91d5689100516379577dcfb0bfb45da09d3e488e Mon Sep 17 00:00:00 2001 From: adri09070 <97704417+adri09070@users.noreply.github.com> Date: Tue, 6 Sep 2022 16:45:29 +0200 Subject: [PATCH 3/5] removing deprecated spec-debugger dependency + adding espell dependency to the baseline --- ...aselineOfDebuggableASTInterpreter.class.st | 45 ++++++++++--------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/BaselineOfDebuggableASTInterpreter/BaselineOfDebuggableASTInterpreter.class.st b/BaselineOfDebuggableASTInterpreter/BaselineOfDebuggableASTInterpreter.class.st index 442f871..803bc35 100644 --- a/BaselineOfDebuggableASTInterpreter/BaselineOfDebuggableASTInterpreter.class.st +++ b/BaselineOfDebuggableASTInterpreter/BaselineOfDebuggableASTInterpreter.class.st @@ -8,27 +8,28 @@ Class { BaselineOfDebuggableASTInterpreter >> baseline: spec [ - spec - for: #common - do: [ - "Dependencies" - spec - baseline: 'SpecDebugger' - with: [ spec repository: 'github://dupriezt/Spec-Debugger' ]. - spec - baseline: 'Ghost' - with: [ spec repository: 'gitlab://gitlab.inria.fr:RMOD/Ghost' ]. - - "Packages" - spec - package: 'DebuggableASTInterpreter'; - package: 'DebuggableASTDebugger' with: [ spec requires: #('DebuggableASTInterpreter' 'SpecDebugger') ]; - package: 'DebuggableASTInterpreterOverlays' with: [ spec requires: #('DebuggableASTDebugger' 'Ghost') ]]. + spec for: #common do: [ "Dependencies" + spec + baseline: 'Espell' + with: [ spec repository: 'github://guillep/espell' ]. + spec + baseline: 'Ghost' + with: [ spec repository: 'gitlab://gitlab.inria.fr:RMOD/Ghost' ]. + + "Packages" + spec + package: 'DebuggableASTInterpreter' + with: [ spec requires: #( 'Espell' ) ]; + package: 'DebuggableASTDebugger' + with: [ spec requires: #( 'DebuggableASTInterpreter' ) ]; + package: 'DebuggableASTInterpreterOverlays' + with: [ spec requires: #( 'DebuggableASTDebugger' + 'Ghost' ) ] ]. - "Groups" - spec - group: 'default' with: #('Model'); - group: 'Model' with: #('DebuggableASTInterpreter'); - group: 'Debugger' with: #('DebuggableASTDebugger'); - group: 'Overlay' with: #('DebuggableASTInterpreterOverlays') + "Groups" + spec + group: 'default' with: #( 'Model' ); + group: 'Model' with: #( 'DebuggableASTInterpreter' ); + group: 'Debugger' with: #( 'DebuggableASTDebugger' ); + group: 'Overlay' with: #( 'DebuggableASTInterpreterOverlays' ) ] From 21444f567e2f7ef93876ec40cb87243c15f00149 Mon Sep 17 00:00:00 2001 From: adri09070 <97704417+adri09070@users.noreply.github.com> Date: Fri, 23 Sep 2022 11:05:23 +0200 Subject: [PATCH 4/5] synch with RMODINRIA/DebuggableASTInterpreter --- ...aselineOfDebuggableASTInterpreter.class.st | 21 +++++-------------- .../DASTInterpreter.class.st | 13 ++++++------ .../DASTPostOrderTreeVisitor.class.st | 14 ++++++------- 3 files changed, 19 insertions(+), 29 deletions(-) diff --git a/BaselineOfDebuggableASTInterpreter/BaselineOfDebuggableASTInterpreter.class.st b/BaselineOfDebuggableASTInterpreter/BaselineOfDebuggableASTInterpreter.class.st index 803bc35..deeab82 100644 --- a/BaselineOfDebuggableASTInterpreter/BaselineOfDebuggableASTInterpreter.class.st +++ b/BaselineOfDebuggableASTInterpreter/BaselineOfDebuggableASTInterpreter.class.st @@ -8,28 +8,17 @@ Class { BaselineOfDebuggableASTInterpreter >> baseline: spec [ - spec for: #common do: [ "Dependencies" - spec - baseline: 'Espell' - with: [ spec repository: 'github://guillep/espell' ]. - spec - baseline: 'Ghost' - with: [ spec repository: 'gitlab://gitlab.inria.fr:RMOD/Ghost' ]. + spec for: #common do: [ "Packages" spec - package: 'DebuggableASTInterpreter' - with: [ spec requires: #( 'Espell' ) ]; - package: 'DebuggableASTDebugger' - with: [ spec requires: #( 'DebuggableASTInterpreter' ) ]; - package: 'DebuggableASTInterpreterOverlays' - with: [ spec requires: #( 'DebuggableASTDebugger' - 'Ghost' ) ] ]. + package: 'DebuggableASTInterpreter'; + package: 'DebuggableASTDebugger' with: [ + spec requires: #( 'DebuggableASTInterpreter' ) ] ]. "Groups" spec group: 'default' with: #( 'Model' ); group: 'Model' with: #( 'DebuggableASTInterpreter' ); - group: 'Debugger' with: #( 'DebuggableASTDebugger' ); - group: 'Overlay' with: #( 'DebuggableASTInterpreterOverlays' ) + group: 'Debugger' with: #( 'DebuggableASTDebugger' ) ] diff --git a/DebuggableASTInterpreter/DASTInterpreter.class.st b/DebuggableASTInterpreter/DASTInterpreter.class.st index 2abbed5..8d9365d 100644 --- a/DebuggableASTInterpreter/DASTInterpreter.class.st +++ b/DebuggableASTInterpreter/DASTInterpreter.class.st @@ -311,8 +311,9 @@ DASTInterpreter >> visitArgumentNode: aRBArgumentNode [ ] { #category : #visiting } -DASTInterpreter >> visitArgumentVariableNode: aRBVariableNode [ - self visitVariableNode: aRBVariableNode . +DASTInterpreter >> visitArgumentVariableNode: aRBVariableNode [ + + ^ self visitTemporaryNode: aRBVariableNode ] { #category : #visiting } @@ -348,9 +349,9 @@ DASTInterpreter >> visitCascadeNode: aRBCascadeNode [ ] { #category : #visiting } -DASTInterpreter >> visitClassVariableNode: aNode [ +DASTInterpreter >> visitClassVariableNode: aRBVariableNode [ - ^ self visitLiteralVariableNode: aNode + ^ self visitGlobalNode: aRBVariableNode ] { #category : #visiting } @@ -361,9 +362,9 @@ DASTInterpreter >> visitGlobalNode: aRBGlobalNode [ ] { #category : #visiting } -DASTInterpreter >> visitGlobalVariableNode: aNode [ +DASTInterpreter >> visitGlobalVariableNode: aRBVariableNode [ - ^ self visitLiteralVariableNode: aNode + ^ self visitGlobalNode: aRBVariableNode ] { #category : #visiting } diff --git a/DebuggableASTInterpreter/DASTPostOrderTreeVisitor.class.st b/DebuggableASTInterpreter/DASTPostOrderTreeVisitor.class.st index 4e8af2e..acc1791 100644 --- a/DebuggableASTInterpreter/DASTPostOrderTreeVisitor.class.st +++ b/DebuggableASTInterpreter/DASTPostOrderTreeVisitor.class.st @@ -40,7 +40,7 @@ DASTPostOrderTreeVisitor >> visitArgumentNode: aRBArgumentNode [ { #category : #visiting } DASTPostOrderTreeVisitor >> visitArgumentVariableNode: aRBVariableNode [ - stack push: aRBVariableNode + ^ self visitTemporaryNode: aRBVariableNode ] { #category : #visiting } @@ -68,9 +68,9 @@ DASTPostOrderTreeVisitor >> visitCascadeNode: aRBCascadeNode [ ] { #category : #visiting } -DASTPostOrderTreeVisitor >> visitClassVariableNode: aNode [ +DASTPostOrderTreeVisitor >> visitClassVariableNode: aRBVariableNode [ - ^ self visitLiteralVariableNode: aNode + ^ self visitGlobalNode: aRBVariableNode ] { #category : #visiting } @@ -79,9 +79,9 @@ DASTPostOrderTreeVisitor >> visitGlobalNode: aRBGlobalNode [ ] { #category : #visiting } -DASTPostOrderTreeVisitor >> visitGlobalVariableNode: aNode [ +DASTPostOrderTreeVisitor >> visitGlobalVariableNode: aRBVariableNode [ - ^ self visitLiteralVariableNode: aNode + ^ self visitGlobalNode: aRBVariableNode ] { #category : #visiting } @@ -172,9 +172,9 @@ DASTPostOrderTreeVisitor >> visitTemporaryNode: aRBTemporaryNode [ ] { #category : #visiting } -DASTPostOrderTreeVisitor >> visitTemporaryVariableNode: aRBVariableNode [ +DASTPostOrderTreeVisitor >> visitTemporaryVariableNode: aRBVariableNode [ - stack push: aRBVariableNode + ^ self visitTemporaryNode: aRBVariableNode ] { #category : #visiting } From c01c0cbdd5b5985935e563fa414c4d5993e49469 Mon Sep 17 00:00:00 2001 From: adri09070 <97704417+adri09070@users.noreply.github.com> Date: Thu, 15 Jun 2023 09:58:11 +0200 Subject: [PATCH 5/5] replacing a call to a missing method in P12, by a call to another method present in P11 and P12 --- DebuggableASTInterpreter/DASTInterpreterTests.class.st | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DebuggableASTInterpreter/DASTInterpreterTests.class.st b/DebuggableASTInterpreter/DASTInterpreterTests.class.st index ee27ea3..381f512 100644 --- a/DebuggableASTInterpreter/DASTInterpreterTests.class.st +++ b/DebuggableASTInterpreter/DASTInterpreterTests.class.st @@ -146,7 +146,7 @@ DASTInterpreterTests >> testEnsure [ { #category : #tests } DASTInterpreterTests >> testEvaluateArgumentOrder [ - self assert: (self evaluateProgram: 'Array braceWith: 1 with: 2' ) + self assert: (self evaluateProgram: 'Array with: 1 with: 2' ) equals: #(1 2) ]