nu ook shallow dsl
authorcharlie <charlie.gerhardus@student.ru.nl>
Sun, 29 Nov 2015 17:49:50 +0000 (18:49 +0100)
committercharlie <charlie.gerhardus@student.ru.nl>
Sun, 29 Nov 2015 17:49:50 +0000 (18:49 +0100)
a10/charlie/matcher_shallow.icl [new file with mode: 0644]
a10/charlie/matcher_shallow.prj [new file with mode: 0644]

diff --git a/a10/charlie/matcher_shallow.icl b/a10/charlie/matcher_shallow.icl
new file mode 100644 (file)
index 0000000..6901305
--- /dev/null
@@ -0,0 +1,45 @@
+module matcher_shallow\r
+\r
+import StdEnv\r
+\r
+EqualTo :: a a -> Bool | == a\r
+EqualTo x y = x == y\r
+\r
+LessThen :: a a -> Bool | < a\r
+LessThen x y = y < x\r
+\r
+Not :: (a -> Bool) a -> Bool\r
+Not f x = not (f x)\r
+\r
+Is :: (a -> Bool) a -> Bool\r
+Is f x = f x\r
+\r
+(Or) infixl 2 :: (a -> Bool) (a -> Bool) -> (a -> Bool)\r
+(Or) f g = \x . f x || g x\r
+\r
+AssertThat :: String a (a -> Bool) -> [String]\r
+AssertThat id x f | f x = [id : " " : "PASS" : []]\r
+                  | otherwise = [id : " " : "FAIL": []]\r
+\r
+instance * [String] where\r
+       (*) x y = x ++ ["\n":y]\r
+\r
+test :: [String] -> [String]\r
+test x = x ++ ["\n"]\r
+\r
+a1 = AssertThat "(2*2) (Is (EqualTo (2+2)))" (2*2) (Is(EqualTo (2+2)))\r
+a2 = AssertThat "(3*3) (EqualTo (3+3))" (3*3) (EqualTo (3+3))\r
+a3 = AssertThat "(length [0..3]) is not 4" (length [0..3]) (Not(EqualTo 4))\r
+\r
+report = test (a1*a2*a3)\r
+\r
+instance <<< [String] where\r
+       (<<<) file [] = file\r
+       (<<<) file [s:ss] = file <<< s <<< ss\r
+\r
+Start :: !*World -> *World\r
+Start world\r
+       # (file, world) = stdio world\r
+       # file = file <<< report\r
+       # (ok, world) = fclose file world\r
+       | otherwise = world
\ No newline at end of file
diff --git a/a10/charlie/matcher_shallow.prj b/a10/charlie/matcher_shallow.prj
new file mode 100644 (file)
index 0000000..76bea68
--- /dev/null
@@ -0,0 +1,322 @@
+Version: 1.4\r
+Global\r
+       ProjectRoot:    .\r
+       Target: StdEnv\r
+       Exec:   {Project}\matcher_shallow.exe\r
+       CodeGen\r
+               CheckStacks:    False\r
+               CheckIndexes:   True\r
+       Application\r
+               HeapSize:       2097152\r
+               StackSize:      512000\r
+               ExtraMemory:    81920\r
+               IntialHeapSize: 204800\r
+               HeapSizeMultiplier:     4096\r
+               ShowExecutionTime:      False\r
+               ShowGC: False\r
+               ShowStackSize:  False\r
+               MarkingCollector:       False\r
+               StandardRuntimeEnv:     True\r
+               Profile\r
+                       Memory: False\r
+                       MemoryMinimumHeapSize:  0\r
+                       Time:   False\r
+                       Stack:  False\r
+               Output\r
+                       Output: ShowConstructors\r
+                       Font:   Courier\r
+                       FontSize:       9\r
+                       WriteStdErr:    False\r
+       Link\r
+               LinkMethod:     Static\r
+               GenerateRelocations:    False\r
+               GenerateLinkMap:        False\r
+               LinkResources:  False\r
+               ResourceSource: \r
+               GenerateDLL:    False\r
+               ExportedNames:  \r
+       Paths\r
+               Path:   {Project}\r
+       Precompile:     \r
+       Postlink:       \r
+MainModule\r
+       Name:   matcher_shallow\r
+       Dir:    {Project}\r
+       Compiler\r
+               NeverMemoryProfile:     False\r
+               NeverTimeProfile:       False\r
+               StrictnessAnalysis:     True\r
+               ListTypes:      StrictExportTypes\r
+               ListAttributes: True\r
+               Warnings:       True\r
+               Verbose:        True\r
+               ReadableABC:    False\r
+               ReuseUniqueNodes:       True\r
+               Fusion: False\r
+OtherModules\r
+       Module\r
+               Name:   StdArray\r
+               Dir:    {Application}\Libraries\StdEnv\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   StdBool\r
+               Dir:    {Application}\Libraries\StdEnv\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   StdChar\r
+               Dir:    {Application}\Libraries\StdEnv\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   StdCharList\r
+               Dir:    {Application}\Libraries\StdEnv\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   StdClass\r
+               Dir:    {Application}\Libraries\StdEnv\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   StdEnum\r
+               Dir:    {Application}\Libraries\StdEnv\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   StdEnv\r
+               Dir:    {Application}\Libraries\StdEnv\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   StdFile\r
+               Dir:    {Application}\Libraries\StdEnv\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   StdFunc\r
+               Dir:    {Application}\Libraries\StdEnv\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   StdInt\r
+               Dir:    {Application}\Libraries\StdEnv\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   StdList\r
+               Dir:    {Application}\Libraries\StdEnv\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   StdMisc\r
+               Dir:    {Application}\Libraries\StdEnv\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   StdOrdList\r
+               Dir:    {Application}\Libraries\StdEnv\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   StdOverloaded\r
+               Dir:    {Application}\Libraries\StdEnv\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   StdReal\r
+               Dir:    {Application}\Libraries\StdEnv\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   StdString\r
+               Dir:    {Application}\Libraries\StdEnv\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   StdTuple\r
+               Dir:    {Application}\Libraries\StdEnv\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   _SystemArray\r
+               Dir:    {Application}\Libraries\StdEnv\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r
+       Module\r
+               Name:   _SystemEnum\r
+               Dir:    {Application}\Libraries\StdEnv\r
+               Compiler\r
+                       NeverMemoryProfile:     False\r
+                       NeverTimeProfile:       False\r
+                       StrictnessAnalysis:     True\r
+                       ListTypes:      StrictExportTypes\r
+                       ListAttributes: True\r
+                       Warnings:       True\r
+                       Verbose:        True\r
+                       ReadableABC:    False\r
+                       ReuseUniqueNodes:       True\r
+                       Fusion: False\r