From: Simon Forman Date: Thu, 29 Sep 2022 01:18:20 +0000 (-0700) Subject: Improve compiling of step combinator. X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=4200c6708e2141ce0e753ff7e4765d402f4fdc8f;p=joypy%2FThun.git Improve compiling of step combinator. --- diff --git a/implementations/Ocaml/helloworld/bin/main.ml b/implementations/Ocaml/helloworld/bin/main.ml index 10c13ed..335e085 100644 --- a/implementations/Ocaml/helloworld/bin/main.ml +++ b/implementations/Ocaml/helloworld/bin/main.ml @@ -130,14 +130,13 @@ let stack_to_string stack = expression_to_string (List.rev stack) type token = Left_bracket | Right_bracket | Token of string -let delimiter str i = - i >= String.length str || String.contains "[] " (String.get str i) - +let delimiter : char -> bool = String.contains "[] " +let delimits str i = i >= String.length str || delimiter (String.get str i) let make_token str index i = (Token (String.sub str index (i - index)), i) (* string -> int -> int -> token * int *) let rec tokenize1 str index i = - if delimiter str i then make_token str index i else tokenize1 str index (i + 1) + if delimits str i then make_token str index i else tokenize1 str index (i + 1) let rec tokenize0 str index acc = if index >= String.length str then acc diff --git a/implementations/oldlog/source/joy2py.pl b/implementations/oldlog/source/joy2py.pl index 81ed8e5..02382b1 100644 --- a/implementations/oldlog/source/joy2py.pl +++ b/implementations/oldlog/source/joy2py.pl @@ -613,6 +613,8 @@ compile_fn(Name) --> gronk_fn(Name), cg, !. ╚██████╔╝██║ ██║╚██████╔╝██║ ╚████║██║ ██╗ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚═╝ ╚═╝ +(GRONK stands for "I am bad at naming things.") + With gronk we're juggling four things: The incoming joy expression @@ -694,8 +696,8 @@ gronk_fn_list( gronk_fn_list(Js, [Term|Stack], StackOut, CGTail, Ck, IndentLevel). gronk_fn_list( - [list(Body), symbol(step)|Js], - [list(B)|Stack0], + [symbol(step)|Js], + [list(Body), list(B)|Stack0], Stack, CGTail, CodeGens,