parser: add simple parser and tests

This commit is contained in:
2018-04-30 16:33:57 +02:00
parent f76a6c756b
commit 90603a9bb5
16 changed files with 66 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
{
"noMethodMetaData" : true,
"separateMethodMetaAndSource" : false,
"useCypressPropertiesFile" : true }

View File

@@ -0,0 +1 @@
Im a simple Lisp interpreter.

View File

@@ -0,0 +1,4 @@
as yet unclassified
parse: aProgramString
aProgramString ifEmpty: [ ^ #() ].
^ (Scanner new scanTokens: aProgramString) first

View 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" }

View File

@@ -0,0 +1,3 @@
tests
setUp
ph := Phsyche new

View File

@@ -0,0 +1,3 @@
tests
testParseEmptyList
self assert: (ph parse: '()') equals: #()

View File

@@ -0,0 +1,3 @@
tests
testParseFloat
self assert: (ph parse: '12.33') equals: 12.33

View File

@@ -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) #()))

View File

@@ -0,0 +1,5 @@
tests
testParseLambda
self
assert: (ph parse: '(define squared (lambda (x) (* x x)))')
equals: #(#define #squared #(#lambda #(#x) #(* x x)))

View File

@@ -0,0 +1,3 @@
tests
testParseSymbol
self assert: (ph parse: 'r') equals: #r

View File

@@ -0,0 +1,14 @@
{
"category" : "Phsyche",
"classinstvars" : [
],
"classvars" : [
],
"commentStamp" : "",
"instvars" : [
"ph" ],
"name" : "PhsycheTest",
"pools" : [
],
"super" : "TestCase",
"type" : "normal" }

View File

@@ -0,0 +1 @@
SystemOrganization addCategory: #Phsyche!

View File

@@ -0,0 +1 @@
(name 'Phsyche')

View File

@@ -0,0 +1,2 @@
{
}