diff --git a/examples/combinators.modal b/examples/combinators.modal index ef5e15a..03278a0 100644 --- a/examples/combinators.modal +++ b/examples/combinators.modal @@ -1,4 +1,4 @@ -?(?0 ()) (This example demonstrates how to implement combinatory calculus.) +?(?-) (This example demonstrates how to implement combinatory calculus.) <> (M ?x) (?x ?x) <> (KI ?x ?y) (?y) diff --git a/examples/hello.modal b/examples/hello.modal index f2efd69..b341550 100644 --- a/examples/hello.modal +++ b/examples/hello.modal @@ -1,4 +1,4 @@ -?(?0 ()) (This example prints to the console and demonstrates how to delay the execution of a rule.) +?(?-) (This example prints to the console and demonstrates how to delay the execution of a rule.) <> (NAME) (Modal) <> (?: print String) (?:) diff --git a/examples/io_read.modal b/examples/io_read.modal index f148eb7..4b5c11b 100644 --- a/examples/io_read.modal +++ b/examples/io_read.modal @@ -1,4 +1,4 @@ -?(?0 ()) (This example requests 3 line delimited strings from the console.) +?(?-) (This example requests 3 line delimited strings from the console.) <> (read ?~) (?~) <> (?: print ') (?:) diff --git a/examples/io_repl.modal b/examples/io_repl.modal index f02c446..5e96b63 100644 --- a/examples/io_repl.modal +++ b/examples/io_repl.modal @@ -1,4 +1,4 @@ -?(?0 ()) (This example demonstrates how to keep the runtime active between prompts.) +?(?-) (This example demonstrates how to keep the runtime active between prompts.) <> ((You said: quit\n) send) ((You quit.) print ') <> (?: print ') (?:) diff --git a/examples/io_write.modal b/examples/io_write.modal index 19fd488..f0f0c4c 100644 --- a/examples/io_write.modal +++ b/examples/io_write.modal @@ -1,4 +1,4 @@ -?(?0 ()) (This example prints hello world to the console.) +?(?-) (This example prints hello world to the console.) <> (send ?:) (?:) diff --git a/examples/string_reverse.modal b/examples/string_reverse.modal index 4f9eb1b..4e14c75 100644 --- a/examples/string_reverse.modal +++ b/examples/string_reverse.modal @@ -1,4 +1,4 @@ -?(?0 ()) (This example reverses the string modal, into ladom.) +?(?-) (This example reverses the string modal, into ladom.) <> (reverse List () ?*) (?*) <> (reverse (?*)) (reverse List (?*) ()) diff --git a/examples/tests.modal b/examples/tests.modal index fe024f6..a77550b 100644 --- a/examples/tests.modal +++ b/examples/tests.modal @@ -1,3 +1,5 @@ +?(?-) (This example tests various aspects of the implementation.) + <> (explode ?*) (str (?*)) <> (reverse (str (?h ?t))) (reverse/l ?t (?h)) <> (reverse (str (?h))) (?h) diff --git a/examples/tictactoe.modal b/examples/tictactoe.modal index 9ad8c53..d69b1c3 100644 --- a/examples/tictactoe.modal +++ b/examples/tictactoe.modal @@ -1,4 +1,4 @@ -?(?0 ()) (This example demonstrates how to implement a 2-players game of Tic Tac Toe) +?(?-) (This example demonstrates how to implement a 2-players game of Tic Tac Toe) <> (-- ?x) () <> (READ ?~) (?~) diff --git a/src/modal.c b/src/modal.c index 11965aa..6233bd9 100644 --- a/src/modal.c +++ b/src/modal.c @@ -140,12 +140,11 @@ parse_frag(char *s) while((c = *s) && c <= ' ') s++; if(*s != ')' && *s != '<' && s[1] != '>') { ss = walk(s); - if(*s == '('){ + if(*s == '(') { s++; - while(s < ss-1) *dict_++ = *s++; + while(s < ss - 1) *dict_++ = *s++; s++; - } - else + } else while(s < ss) *dict_++ = *s++; } *dict_++ = 0;