Skip to content

Commit

Permalink
A few more things are parsing correctly.
Browse files Browse the repository at this point in the history
Notably: The implied ^self is now working, some things have gotten simpler, and variables now work.
Reformatted the odd formatting of testSourceParseMethodKeyword.
  • Loading branch information
martinmcclure committed Sep 15, 2015
1 parent 3ff14b3 commit 6311a4b
Show file tree
Hide file tree
Showing 19 changed files with 48 additions and 23 deletions.
@@ -0,0 +1,3 @@
as yet unclassified
allowUnderscoreAssignment
^ false
@@ -1,3 +1,3 @@
grammar
methodSequence
^ super methodSequence ", (return / impliedReturnSelf)"
^ super methodSequence , (return / impliedReturnSelf)
@@ -1,10 +1,10 @@
{
"class" : {
},
"allowUnderscoreAssignment" : "MartinMcClure 9/14/2015 22:34" },
"instance" : {
"impliedReturnSelf" : "MartinMcClure 9/13/2015 21:29",
"method" : "MartinMcClure 1/12/2015 22:17",
"methodSequence" : "MartinMcClure 9/13/2015 22:00",
"methodSequence" : "MartinMcClure 9/14/2015 21:41",
"primitiveMethodBody" : "MartinMcClure 1/12/2015 22:17",
"primitivePragma" : "MartinMcClure 1/11/2015 23:49",
"restOfText" : "MartinMcClure 1/11/2015 23:55",
Expand Down
@@ -0,0 +1,3 @@
grammar
identifierToken
^ super identifierToken map: [ :token | token inputValue ]
@@ -0,0 +1,3 @@
grammar
impliedReturnSelf
^ super impliedReturnSelf ==> [ :nodes | FogVariableReferenceNode variableName: 'self' ]
@@ -0,0 +1,3 @@
grammar
keywordToken
^ super keywordToken map: [ :token | token inputValue ]
Expand Up @@ -2,5 +2,5 @@ grammar
methodDeclaration
^ super methodDeclaration
==> [ :decl |
{(decl first collect: [ :each | each inputValue ]).
(decl last collect: [ :each | each inputValue ])} ]
{(decl first).
(decl last)} ]
@@ -1,4 +1,8 @@
grammar
methodSequence
^ super methodSequence
map: [ :a :pragmas :b :temporaries :c :morePragmas :d :statements ":returnStatement" | FogTempVarScopeNode temporaries: temporaries statements: statements "asOrderedCollection addLast: returnStatement" ]
map: [ :a :pragmas :b :temporaries :c :morePragmas :d :statements :returnStatement |
| allStatments |
allStatements := statements asOrderedCollection.
allStatements addLast: returnStatement.
FogTempVarScopeNode temporaries: temporaries statements: allStatements ]
@@ -1,3 +1,3 @@
grammar
temporaries
^ super temporaries ==> [ :nodes | nodes second collect: [ :each | each inputValue ] ]
^ super temporaries ==> [ :nodes | nodes second ]
Expand Up @@ -2,7 +2,10 @@
"class" : {
},
"instance" : {
"identifierToken" : "MartinMcClure 9/14/2015 22:40",
"impliedReturnSelf" : "MartinMcClure 9/14/2015 22:05",
"keywordToken" : "MartinMcClure 9/14/2015 22:48",
"method" : "MartinMcClure 9/13/2015 11:47",
"methodDeclaration" : "MartinMcClure 9/13/2015 13:29",
"methodSequence" : "MartinMcClure 9/13/2015 22:01",
"temporaries" : "MartinMcClure 9/13/2015 20:28" } }
"methodDeclaration" : "MartinMcClure 9/14/2015 22:43",
"methodSequence" : "MartinMcClure 9/14/2015 21:57",
"temporaries" : "MartinMcClure 9/14/2015 22:44" } }
2 changes: 1 addition & 1 deletion packages/Mist-Compiler.package/monticello.meta/version
@@ -1 +1 @@
(name 'Mist-Compiler-MartinMcClure.4' message ' Got a bit further on parsing.' id '5ff2bc39-00bf-4cc1-a49c-86ec570c053b' date '13 September 2015' time '10:04:13.299036 pm' author 'MartinMcClure' ancestors ((name 'Mist-Compiler-MartinMcClure.3' message 'The beginnings of a parser to parse into Macro Fog nodes.' id '5e15043e-4f73-4334-8699-f9918acf1461' date '13 September 2015' time '1:31:16.991295 pm' author 'MartinMcClure' ancestors ((name 'Mist-Compiler-MartinMcClure.2' message 'A sketch of the compiler structure for modules, classes, behaviors, and methods. It''s now ready to have more work done on the grammar and parser.' id 'fb3d8d8b-bfac-4790-b673-49c6c7cde93e' date '25 January 2015' time '11:07:56.693885 pm' author 'MartinMcClure' ancestors ((name 'Mist-Compiler-MartinMcClure.1' message 'The very very small beginnings of a Mist parser, based on PetitSmalltalk''s grammar.' id 'f9b0bfa0-2762-481c-8635-dafd4010e901' date '14 January 2015' time '7:29:44.834529 pm' author 'MartinMcClure' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())
(name 'Mist-Compiler-MartinMcClure.5' message 'A few more things are parsing correctly.Notably: The implied ^self is now working, some things have gotten simpler, and variables now work.' id 'f1c7366b-57fd-4f64-a0f1-24cd484c5b64' date '14 September 2015' time '10:56:08.448405 pm' author 'MartinMcClure' ancestors ((name 'Mist-Compiler-MartinMcClure.4' message ' Got a bit further on parsing.' id '5ff2bc39-00bf-4cc1-a49c-86ec570c053b' date '13 September 2015' time '10:04:13.299036 pm' author 'MartinMcClure' ancestors ((name 'Mist-Compiler-MartinMcClure.3' message 'The beginnings of a parser to parse into Macro Fog nodes.' id '5e15043e-4f73-4334-8699-f9918acf1461' date '13 September 2015' time '1:31:16.991295 pm' author 'MartinMcClure' ancestors ((name 'Mist-Compiler-MartinMcClure.2' message 'A sketch of the compiler structure for modules, classes, behaviors, and methods. It''s now ready to have more work done on the grammar and parser.' id 'fb3d8d8b-bfac-4790-b673-49c6c7cde93e' date '25 January 2015' time '11:07:56.693885 pm' author 'MartinMcClure' ancestors ((name 'Mist-Compiler-MartinMcClure.1' message 'The very very small beginnings of a Mist parser, based on PetitSmalltalk''s grammar.' id 'f9b0bfa0-2762-481c-8635-dafd4010e901' date '14 January 2015' time '7:29:44.834529 pm' author 'MartinMcClure' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())
Expand Down
@@ -0,0 +1,3 @@
instance creation
variableName: aString
^ self new variableName: aString
@@ -0,0 +1,3 @@
initialization
variableName: aString
variableName := aString
@@ -1,5 +1,5 @@
{
"class" : {
},
"variableName:" : "MartinMcClure 9/14/2015 22:03" },
"instance" : {
} }
"variableName:" : "MartinMcClure 9/14/2015 22:04" } }
Expand Up @@ -6,7 +6,7 @@
],
"commentStamp" : "",
"instvars" : [
],
"variableName" ],
"name" : "FogVariableReferenceNode",
"pools" : [
],
Expand Down
2 changes: 1 addition & 1 deletion packages/Mist-MacroFog.package/monticello.meta/version
@@ -1 +1 @@
(name 'Mist-MacroFog-MartinMcClure.2' message 'Got a bit further on parsing.' id '4070ac8f-0837-4d2d-aa91-bd81f6b2fcd0' date '13 September 2015' time '10:04:25.258538 pm' author 'MartinMcClure' ancestors ((name 'Mist-MacroFog-MartinMcClure.1' message 'The beginnings of a parser to parse into Macro Fog nodes.' id '1374cf2f-f54c-4e7d-9bbb-c56d835a6c84' date '13 September 2015' time '1:32:09.395157 pm' author 'MartinMcClure' ancestors () stepChildren ())) stepChildren ())
(name 'Mist-MacroFog-MartinMcClure.3' message 'A few more things are parsing correctly.' id 'b3706c66-05e9-4ee1-acaf-82e967672700' date '14 September 2015' time '10:53:59.871746 pm' author 'MartinMcClure' ancestors ((name 'Mist-MacroFog-MartinMcClure.2' message 'Got a bit further on parsing.' id '4070ac8f-0837-4d2d-aa91-bd81f6b2fcd0' date '13 September 2015' time '10:04:25.258538 pm' author 'MartinMcClure' ancestors ((name 'Mist-MacroFog-MartinMcClure.1' message 'The beginnings of a parser to parse into Macro Fog nodes.' id '1374cf2f-f54c-4e7d-9bbb-c56d835a6c84' date '13 September 2015' time '1:32:09.395157 pm' author 'MartinMcClure' ancestors () stepChildren ())) stepChildren ())) stepChildren ())
@@ -1,9 +1,10 @@
as yet unclassified
testSourceParseMethodKeyword
| parser result |
parser :=
MistParser new.
result := parser parse: '
parser := MistParser new.
result := parser
parse:
'
foo: aFoo bar: aBar
"A test method with a keyword selector and just about everything else except blocks.
Assumes instvars inst1 and inst2 exist in the context, and other variable AClass exists."
Expand All @@ -15,6 +16,5 @@ foo: aFoo bar: aBar
inst2 := inst1 fnord: #( #[ 65 66 67 ] #someSymbol nil true false ).
aFoo + (aBar resumeExistenceWith: 12 with: 3.0 with: 16r6e42).
"Implied return self."
'.
"Make this thing fail for now for debugging."
self assert: result equals: nil.
'. "Make this thing fail for now for debugging."
self assert: result equals: nil
Expand Up @@ -2,4 +2,4 @@
"class" : {
},
"instance" : {
"testSourceParseMethodKeyword" : "MartinMcClure 9/13/2015 11:33" } }
"testSourceParseMethodKeyword" : "MartinMcClure 9/14/2015 21:44" } }
2 changes: 1 addition & 1 deletion packages/Mist-Tests.package/monticello.meta/version
@@ -1 +1 @@
(name 'Mist-Tests-MartinMcClure.18' message 'Added a parser test of a simple Smalltalk method.' id '618d9fc3-7925-4725-a38b-e37e81abc34c' date '13 September 2015' time '1:33:52.509135 pm' author 'MartinMcClure' ancestors ((name 'Mist-Tests-MartinMcClure.17' message 'Image tests now use the correct 64-bit subclass.' id '1010397b-50ec-4b33-ad78-e272d0fb5639' date '29 August 2015' time '7:59:34.92434 am' author 'MartinMcClure' ancestors ((name 'Mist-Tests-MartinMcClure.16' message 'Very beginnings of 32-bit x86 Fog.' id 'afc020dd-8773-4945-bd79-197226770eaf' date '28 August 2015' time '5:15:21.142342 pm' author 'MartinMcClure' ancestors ((name 'Mist-Tests-MartinMcClure.15' message 'Simple ELF32 files can now be written.' id '3032acea-7bd3-4ed7-8ccd-a0244bcb1ec3' date '22 August 2015' time '1:52:48.419349 pm' author 'MartinMcClure' ancestors ((name 'Mist-Tests-MartinMcClure.14' message 'Refactored the tests to allow reinstatement of the very simple ELF output test, without depending on Fog.' id 'af3b3541-2677-4b40-b358-0630077a38e1' date '21 August 2015' time '7:17:48.070053 pm' author 'MartinMcClure' ancestors ((name 'Mist-Tests-MartinMcClure.13' message 'One last shadowed ''image'' identifier refactored away.' id '067f7db0-ecdf-4e08-bab2-a2243ab91f5e' date '10 May 2015' time '3:25:30.649013 pm' author 'MartinMcClure' ancestors ((name 'Mist-Tests-MartinMcClure.12' message 'Tests - Refactored away the shadowed variable ''image''.' id 'c9945c68-b090-4e65-8b43-94f6d044f3bc' date '10 May 2015' time '3:20:06.747404 pm' author 'MartinMcClure' ancestors ((name 'Mist-Tests-MartinMcClure.11' message 'A sketch of the compiler structure for modules, classes, behaviors, and methods. It''s now ready to have more work done on the grammar and parser.' id '3da27c9b-a48a-4fa1-81fa-88dfa10c415b' date '25 January 2015' time '11:07:24.023884 pm' author 'MartinMcClure' ancestors ((name 'Mist-Tests-MartinMcClure.10' message 'Changes to tests:MethodSpecs now take a name.Some spec creation methods were not actually returning the spec (oops).Replaced smallIntegerPlusFog (which answered a Fog tree) to smallIntegerPlusFogSource, which answers the source string to build the Fog tree.' id 'b4368c47-e4c8-4b26-9d6a-3ffb1d2022cb' date '14 January 2015' time '7:28:21.288528 pm' author 'MartinMcClure' ancestors ((name 'Mist-Tests-MartinMcClure.9' message 'More work on the tests for, and the implementation of, classes and modules.' id 'd1562893-44d7-4c85-ba51-cd81bfde04ee' date '17 February 2014' time '12:42:01.744004 am' author 'MartinMcClure' ancestors ((name 'Mist-Tests-MartinMcClure.8' message 'Bare beginnings of a test case that creates an image with the class SmallInteger with two primitives.' id '56e2574f-5666-45ea-9ed6-b9043e95632c' date '7 January 2014' time '10:14:43.502303 pm' author 'MartinMcClure' ancestors ((name 'Mist-Tests-MartinMcClure.7' message 'Disassembler tests were trying to remove executable files that they never created, which caused an error in Pharo 3.0.' id '27be48dc-60a3-4e42-b427-14e754f6f2e4' date '5 January 2014' time '3:28:49.358945 pm' author 'MartinMcClure' ancestors ((name 'Mist-Tests-MartinMcClure.6' message 'Updated the echoMany test to expect the machine code generated in the new world of Method nodes.' id '9776e82d-551c-4fce-97ec-459d7ab43f9f' date '4 January 2014' time '12:08:04.228 pm' author 'MartinMcClure' ancestors ((name 'Mist-Tests-MartinMcClure.5' message 'Updated remaining tests to be methods that return rather than programs. Updated disassembler tests to account for minor differences due to location assignment changes.' id 'd7997867-d57e-49a0-a629-fc0301a27cc0' date '1 January 2014' time '10:40:44.359 pm' author 'MartinMcClure' ancestors ((name 'Mist-Tests-MartinMcClure.4' message 'Partially done updating tests for the new call/return world.' id '9b311a99-78ec-468c-8fe0-d85e2ec7b8eb' date '29 December 2013' time '10:45:33.822 pm' author 'MartinMcClure' ancestors ((name 'Mist-Tests-MartinMcClure.3' message 'Many little changes. Most are connected with getting call and return to work, and handling args and temps of methods correctly with call and return.' id 'f9013366-f016-4326-be7e-81ce54783861' date '28 December 2013' time '5:43:50.88 pm' author 'MartinMcClure' ancestors ((name 'Mist-Tests-MartinMcClure.2' message 'Modifications for Pharo 2.0.' id '26e13003-4573-4713-8e7f-45b611db017a' date '3 November 2013' time '11:23:32.755 am' author 'MartinMcClure' ancestors ((name 'Mist-Tests-MartinMcClure.1' message 'Rework of the previous Disassembler Tests and Fog Tests for the new world of objects and images. The PrintH test has been dropped since it depended on the absolute address of the code to work, and the later, longer, tests cover all of that functionality.' id 'df7b8da2-f2cf-4048-9830-38cce5131ad0' date '12 August 2013' time '10:50:46.029 am' author 'MartinMcClure' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())
(name 'Mist-Tests-MartinMcClure.19' message 'Reformatted the odd formatting of testSourceParseMethodKeyword.' id '74754531-c04a-43ec-9c94-091938e264ac' date '14 September 2015' time '10:52:51.60378 pm' author 'MartinMcClure' ancestors ((name 'Mist-Tests-MartinMcClure.18' message 'Added a parser test of a simple Smalltalk method.' id '618d9fc3-7925-4725-a38b-e37e81abc34c' date '13 September 2015' time '1:33:52.509135 pm' author 'MartinMcClure' ancestors ((name 'Mist-Tests-MartinMcClure.17' message 'Image tests now use the correct 64-bit subclass.' id '1010397b-50ec-4b33-ad78-e272d0fb5639' date '29 August 2015' time '7:59:34.92434 am' author 'MartinMcClure' ancestors ((name 'Mist-Tests-MartinMcClure.16' message 'Very beginnings of 32-bit x86 Fog.' id 'afc020dd-8773-4945-bd79-197226770eaf' date '28 August 2015' time '5:15:21.142342 pm' author 'MartinMcClure' ancestors ((name 'Mist-Tests-MartinMcClure.15' message 'Simple ELF32 files can now be written.' id '3032acea-7bd3-4ed7-8ccd-a0244bcb1ec3' date '22 August 2015' time '1:52:48.419349 pm' author 'MartinMcClure' ancestors ((name 'Mist-Tests-MartinMcClure.14' message 'Refactored the tests to allow reinstatement of the very simple ELF output test, without depending on Fog.' id 'af3b3541-2677-4b40-b358-0630077a38e1' date '21 August 2015' time '7:17:48.070053 pm' author 'MartinMcClure' ancestors ((name 'Mist-Tests-MartinMcClure.13' message 'One last shadowed ''image'' identifier refactored away.' id '067f7db0-ecdf-4e08-bab2-a2243ab91f5e' date '10 May 2015' time '3:25:30.649013 pm' author 'MartinMcClure' ancestors ((name 'Mist-Tests-MartinMcClure.12' message 'Tests - Refactored away the shadowed variable ''image''.' id 'c9945c68-b090-4e65-8b43-94f6d044f3bc' date '10 May 2015' time '3:20:06.747404 pm' author 'MartinMcClure' ancestors ((name 'Mist-Tests-MartinMcClure.11' message 'A sketch of the compiler structure for modules, classes, behaviors, and methods. It''s now ready to have more work done on the grammar and parser.' id '3da27c9b-a48a-4fa1-81fa-88dfa10c415b' date '25 January 2015' time '11:07:24.023884 pm' author 'MartinMcClure' ancestors ((name 'Mist-Tests-MartinMcClure.10' message 'Changes to tests:MethodSpecs now take a name.Some spec creation methods were not actually returning the spec (oops).Replaced smallIntegerPlusFog (which answered a Fog tree) to smallIntegerPlusFogSource, which answers the source string to build the Fog tree.' id 'b4368c47-e4c8-4b26-9d6a-3ffb1d2022cb' date '14 January 2015' time '7:28:21.288528 pm' author 'MartinMcClure' ancestors ((name 'Mist-Tests-MartinMcClure.9' message 'More work on the tests for, and the implementation of, classes and modules.' id 'd1562893-44d7-4c85-ba51-cd81bfde04ee' date '17 February 2014' time '12:42:01.744004 am' author 'MartinMcClure' ancestors ((name 'Mist-Tests-MartinMcClure.8' message 'Bare beginnings of a test case that creates an image with the class SmallInteger with two primitives.' id '56e2574f-5666-45ea-9ed6-b9043e95632c' date '7 January 2014' time '10:14:43.502303 pm' author 'MartinMcClure' ancestors ((name 'Mist-Tests-MartinMcClure.7' message 'Disassembler tests were trying to remove executable files that they never created, which caused an error in Pharo 3.0.' id '27be48dc-60a3-4e42-b427-14e754f6f2e4' date '5 January 2014' time '3:28:49.358945 pm' author 'MartinMcClure' ancestors ((name 'Mist-Tests-MartinMcClure.6' message 'Updated the echoMany test to expect the machine code generated in the new world of Method nodes.' id '9776e82d-551c-4fce-97ec-459d7ab43f9f' date '4 January 2014' time '12:08:04.228 pm' author 'MartinMcClure' ancestors ((name 'Mist-Tests-MartinMcClure.5' message 'Updated remaining tests to be methods that return rather than programs. Updated disassembler tests to account for minor differences due to location assignment changes.' id 'd7997867-d57e-49a0-a629-fc0301a27cc0' date '1 January 2014' time '10:40:44.359 pm' author 'MartinMcClure' ancestors ((name 'Mist-Tests-MartinMcClure.4' message 'Partially done updating tests for the new call/return world.' id '9b311a99-78ec-468c-8fe0-d85e2ec7b8eb' date '29 December 2013' time '10:45:33.822 pm' author 'MartinMcClure' ancestors ((name 'Mist-Tests-MartinMcClure.3' message 'Many little changes. Most are connected with getting call and return to work, and handling args and temps of methods correctly with call and return.' id 'f9013366-f016-4326-be7e-81ce54783861' date '28 December 2013' time '5:43:50.88 pm' author 'MartinMcClure' ancestors ((name 'Mist-Tests-MartinMcClure.2' message 'Modifications for Pharo 2.0.' id '26e13003-4573-4713-8e7f-45b611db017a' date '3 November 2013' time '11:23:32.755 am' author 'MartinMcClure' ancestors ((name 'Mist-Tests-MartinMcClure.1' message 'Rework of the previous Disassembler Tests and Fog Tests for the new world of objects and images. The PrintH test has been dropped since it depended on the absolute address of the code to work, and the later, longer, tests cover all of that functionality.' id 'df7b8da2-f2cf-4048-9830-38cce5131ad0' date '12 August 2013' time '10:50:46.029 am' author 'MartinMcClure' ancestors () stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())) stepChildren ())
Expand Down

0 comments on commit 6311a4b

Please sign in to comment.