git @ Cat's Eye Technologies Burro / d0eabfe
Convenience commands to run and debug after compiling from Kondey. Chris Pressey 5 months ago
4 changed file(s) with 65 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
479479 more concise and readable (such as it is) fashion:
480480
481481 +++++
482 {+++++++++/+++++++++++++/+++++++}
482 {
483 +++++++++
484 /
485 +++++++++++++
486 /
487 +++++++
488 }
483489 -----<<<
484490 ===> +++++(+++++++++>/>)(/)--(<---------+++++++++++++>>/>)--(/)----(<<-------------+++++++>>>/>)----(/)-----<<<
491
492 Once the Kondey program has been compiled to Burro, we can run the Burro, to further confirm
493 the behaviour is what we expect.
494
495 -> Tests for functionality "Compile and Run Kondey Program"
496
497 -> Functionality "Compile and Run Kondey Program" is implemented by
498 -> shell command "bin/burro run-kondey %(test-body-file)"
499
500 +++++
501 {
502 +++++++++
503 /
504 +++++++++++++
505 /
506 +++++++
507 }
508 -----<<<
509 ===> State{ tape=(... [7] ...), stack=(... [0] ...), halt=True }
510
511 -> Tests for functionality "Compile Kondey Program"
485512
486513 Kondey conditional forms can be nested. That was, kind of, the whole point of definition Kondey;
487514 without some syntax and some automatic translation, we would need to write these things by hand
488515 in Burro, and that's horrible and we wanted to avoid that.
489516
490 {+++++++++/>>>>>{+/++}<<<<</+++++++}
517 {
518 +++++++++
519 /
520 >>>>>
521 {
522 +
523 /
524 ++
525 }
526 <<<<<
527 /
528 +++++++
529 }
491530 ===> (+++++++++>/>)(/)--(<--------->>>>>(+>/>)(/)--(<-++>>/>)--(/)<<<<<>>/>)--(/)----(<<>>>>>(/)++(</<<--+>)++(/)(</<-)<<<<<+++++++>>>/>)----(/)
0 +++++
1 {
2 +++++++++
3 /
4 +++++++++++++
5 /
6 +++++++
7 }
8 -----<<<
+0
-3
eg/gencond1.burros less more
0 +++++++++
1 +++++++++++++
2 +++++++
66 import System.Environment
77 import Language.Burro.Definition
88 import qualified Language.Burro.Debugger as Debugger
9 import qualified Language.Kondey.Compiler as Compiler
9 import qualified Language.Kondey.Compiler as KondeyCompiler
1010
1111 main = do
1212 args <- getArgs
2020 putStrLn $ show $ state
2121 ["compile-kondey", fileName] -> do
2222 kondeyText <- readFile fileName
23 let b :: Burro = Compiler.compile kondeyText
24 putStrLn $ show $ trim b
23 let burroProg :: Burro = KondeyCompiler.compile kondeyText
24 putStrLn $ show $ trim burroProg
25 ["run-kondey", fileName] -> do
26 kondeyText <- readFile fileName
27 let burroProg :: Burro = KondeyCompiler.compile kondeyText
28 putStrLn $ show $ run burroProg newstate
29 ["debug-kondey", fileName] -> do
30 kondeyText <- readFile fileName
31 let burroProg :: Burro = KondeyCompiler.compile kondeyText
32 state <- Debugger.run burroProg newstate
33 putStrLn $ show $ state
2534 _ -> do
2635 putStrLn $
2736 "Usage:\n" ++
2837 " burro run <filename.burro>\n" ++
2938 " burro debug <filename.burro>\n" ++
30 " burro compile-kondey <filename.kondey>\n"
39 " burro compile-kondey <filename.kondey>\n" ++
40 " burro run-kondey <filename.kondey>\n" ++
41 " burro debug-kondey <filename.kondey>\n"