parser: add simple parser and tests
This commit is contained in:
4
src/Phsyche.package/.filetree
Normal file
4
src/Phsyche.package/.filetree
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"noMethodMetaData" : true,
|
||||||
|
"separateMethodMetaAndSource" : false,
|
||||||
|
"useCypressPropertiesFile" : true }
|
1
src/Phsyche.package/Phsyche.class/README.md
Normal file
1
src/Phsyche.package/Phsyche.class/README.md
Normal file
@@ -0,0 +1 @@
|
|||||||
|
I’m a simple Lisp interpreter.
|
4
src/Phsyche.package/Phsyche.class/instance/parse..st
Normal file
4
src/Phsyche.package/Phsyche.class/instance/parse..st
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
as yet unclassified
|
||||||
|
parse: aProgramString
|
||||||
|
aProgramString ifEmpty: [ ^ #() ].
|
||||||
|
^ (Scanner new scanTokens: aProgramString) first
|
14
src/Phsyche.package/Phsyche.class/properties.json
Normal file
14
src/Phsyche.package/Phsyche.class/properties.json
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"category" : "Phsyche",
|
||||||
|
"classinstvars" : [
|
||||||
|
],
|
||||||
|
"classvars" : [
|
||||||
|
],
|
||||||
|
"commentStamp" : "VeitHeller 4/30/2018 16:32",
|
||||||
|
"instvars" : [
|
||||||
|
"env" ],
|
||||||
|
"name" : "Phsyche",
|
||||||
|
"pools" : [
|
||||||
|
],
|
||||||
|
"super" : "Object",
|
||||||
|
"type" : "normal" }
|
0
src/Phsyche.package/PhsycheTest.class/README.md
Normal file
0
src/Phsyche.package/PhsycheTest.class/README.md
Normal file
3
src/Phsyche.package/PhsycheTest.class/instance/setUp.st
Normal file
3
src/Phsyche.package/PhsycheTest.class/instance/setUp.st
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
tests
|
||||||
|
setUp
|
||||||
|
ph := Phsyche new
|
@@ -0,0 +1,3 @@
|
|||||||
|
tests
|
||||||
|
testParseEmptyList
|
||||||
|
self assert: (ph parse: '()') equals: #()
|
@@ -0,0 +1,3 @@
|
|||||||
|
tests
|
||||||
|
testParseFloat
|
||||||
|
self assert: (ph parse: '12.33') equals: 12.33
|
@@ -0,0 +1,8 @@
|
|||||||
|
tests
|
||||||
|
testParseIsNull
|
||||||
|
self
|
||||||
|
assert: (ph parse: '(isNull (cons (quote a) #()))')
|
||||||
|
equals: #(#isNull #(#cons #(#quote #a) #())).
|
||||||
|
self
|
||||||
|
assert: (ph parse: '(isNull (cons (quote a) ()))')
|
||||||
|
equals: #(#isNull #(#cons #(#quote #a) #()))
|
@@ -0,0 +1,5 @@
|
|||||||
|
tests
|
||||||
|
testParseLambda
|
||||||
|
self
|
||||||
|
assert: (ph parse: '(define squared (lambda (x) (* x x)))')
|
||||||
|
equals: #(#define #squared #(#lambda #(#x) #(* x x)))
|
@@ -0,0 +1,3 @@
|
|||||||
|
tests
|
||||||
|
testParseSymbol
|
||||||
|
self assert: (ph parse: 'r') equals: #r
|
14
src/Phsyche.package/PhsycheTest.class/properties.json
Normal file
14
src/Phsyche.package/PhsycheTest.class/properties.json
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"category" : "Phsyche",
|
||||||
|
"classinstvars" : [
|
||||||
|
],
|
||||||
|
"classvars" : [
|
||||||
|
],
|
||||||
|
"commentStamp" : "",
|
||||||
|
"instvars" : [
|
||||||
|
"ph" ],
|
||||||
|
"name" : "PhsycheTest",
|
||||||
|
"pools" : [
|
||||||
|
],
|
||||||
|
"super" : "TestCase",
|
||||||
|
"type" : "normal" }
|
1
src/Phsyche.package/monticello.meta/categories.st
Normal file
1
src/Phsyche.package/monticello.meta/categories.st
Normal file
@@ -0,0 +1 @@
|
|||||||
|
SystemOrganization addCategory: #Phsyche!
|
0
src/Phsyche.package/monticello.meta/initializers.st
Normal file
0
src/Phsyche.package/monticello.meta/initializers.st
Normal file
1
src/Phsyche.package/monticello.meta/package
Normal file
1
src/Phsyche.package/monticello.meta/package
Normal file
@@ -0,0 +1 @@
|
|||||||
|
(name 'Phsyche')
|
2
src/Phsyche.package/properties.json
Normal file
2
src/Phsyche.package/properties.json
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
{
|
||||||
|
}
|
Reference in New Issue
Block a user