mirror of
https://github.com/azur1s/bobbylisp.git
synced 2024-10-16 02:37:40 -05:00
remove semicolons part 2
This commit is contained in:
parent
6b984f8711
commit
6d41cc4ded
|
@ -1,14 +0,0 @@
|
|||
fun add2 (lhs: int) (rhs: int): int = do
|
||||
return lhs + rhs
|
||||
end
|
||||
|
||||
fun main: void = do
|
||||
let result: int = add2(34, 35)
|
||||
@write(result)
|
||||
@write("\n")
|
||||
if result == 69 then
|
||||
@write("big cool")
|
||||
else
|
||||
@write("not cool")
|
||||
end
|
||||
end
|
|
@ -1,3 +1,3 @@
|
|||
let foo: int = "123";
|
||||
let bar: string = 69;
|
||||
let baz: bool = "true";
|
||||
let foo: int = "123"
|
||||
let bar: string = 69
|
||||
let baz: bool = "true"
|
|
@ -1,7 +1,7 @@
|
|||
fun main: void = do
|
||||
do
|
||||
let foo: string = "Hello";
|
||||
@write(foo);
|
||||
end;
|
||||
@write(foo); -- TODO: This is a runtime error
|
||||
end;
|
||||
let foo: string = "Hello"
|
||||
@write(foo)
|
||||
end
|
||||
@write(foo) -- TODO: This is a runtime error
|
||||
end
|
|
@ -1,12 +0,0 @@
|
|||
fun main: void = do
|
||||
let foo: int = 69;
|
||||
|
||||
match foo with
|
||||
| 1 -> @write("One");
|
||||
| 2 -> @write("Two");
|
||||
| 3 -> do
|
||||
@write("Three");
|
||||
end;
|
||||
-- \ @write("idk");
|
||||
end;
|
||||
end;
|
|
@ -1,3 +1,3 @@
|
|||
fun main: void = do
|
||||
@throw("woopsie");
|
||||
end;
|
||||
@throw("woopsie")
|
||||
end
|
|
@ -1,3 +1,3 @@
|
|||
fun main: void = do
|
||||
@writse(); -- Unknown intrinsic
|
||||
end;
|
||||
@writse() -- Unknown intrinsic
|
||||
end
|
|
@ -1,4 +1,3 @@
|
|||
pub fun print_something: void = @emit("console.log('something')");
|
||||
pub fun print_something: void = @emit("console.log('something')")
|
||||
|
||||
fun main: void = do
|
||||
end;
|
||||
fun main: void = do end
|
|
@ -1,11 +1,11 @@
|
|||
fun fib (n: int): int = do
|
||||
if n < 2 then
|
||||
return n;
|
||||
return n
|
||||
else
|
||||
return fib(n - 1) + fib(n - 2);
|
||||
end;
|
||||
end;
|
||||
return fib(n - 1) + fib(n - 2)
|
||||
end
|
||||
end
|
||||
|
||||
fun main: void = do
|
||||
fib(5) |> @write(_);
|
||||
end;
|
||||
fib(5) |> @write(_)
|
||||
end
|
|
@ -1,15 +1,15 @@
|
|||
fun main: void = do
|
||||
if true then
|
||||
@write("True");
|
||||
@write("True")
|
||||
else
|
||||
@write("False");
|
||||
end;
|
||||
@write("False")
|
||||
end
|
||||
|
||||
if true then
|
||||
do
|
||||
@write("True");
|
||||
end;
|
||||
@write("True")
|
||||
end
|
||||
else
|
||||
@write("False");
|
||||
end;
|
||||
end;
|
||||
@write("False")
|
||||
end
|
||||
end
|
|
@ -1,23 +1,23 @@
|
|||
fun iter_ (vec: vec_int) (current: int): void = do
|
||||
if current == @len(vec) then
|
||||
do end;
|
||||
do end
|
||||
else
|
||||
do
|
||||
-- iter logic
|
||||
-- TODO: function as argument
|
||||
@get(vec current) |> @write(_);
|
||||
@write("\n");
|
||||
@get(vec, current) |> @write(_)
|
||||
@write("\n")
|
||||
|
||||
iter_(vec, current + 1);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
iter_(vec, current + 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
fun iter (vec: vec_int): void = do
|
||||
iter_(vec, 0);
|
||||
end;
|
||||
iter_(vec, 0)
|
||||
end
|
||||
|
||||
fun main: void = do
|
||||
let foo: vec_int = [69, 420, 727, 1337, 42069, 69420];
|
||||
iter(foo);
|
||||
end;
|
||||
let foo: vec_int = [69, 420, 727, 1337, 42069, 69420]
|
||||
iter(foo)
|
||||
end
|
|
@ -1,14 +1,14 @@
|
|||
fun foo (xs: int): int = return xs + 1;
|
||||
fun bar (xs: int) (x: int): int = return xs - x;
|
||||
fun foo (xs: int): int = return xs + 1
|
||||
fun bar (xs: int) (x: int): int = return xs - x
|
||||
|
||||
fun main: void = do
|
||||
foo(69) -- 69 + 1 => 70
|
||||
|> bar(_, 1) -- '70 - 1 => 69
|
||||
|> @write(_); -- '69 => stdout
|
||||
|> @write(_) -- '69 => stdout
|
||||
|
||||
@write("\n");
|
||||
@write("\n")
|
||||
|
||||
foo(60) -- 60 + 1 => 61
|
||||
|> bar(130, _) -- 130 - '61 => 69
|
||||
|> @write(_); -- '69 => stdout
|
||||
end;
|
||||
|> @write(_) -- '69 => stdout
|
||||
end
|
|
@ -1,8 +1,8 @@
|
|||
fun foo (xs: int) : int = return xs + 1;
|
||||
fun bar (xs: int) (ys: int) : int = return xs + ys;
|
||||
fun baz (xs: int) (ys: int) (zs: int): int = return xs + ys + zs;
|
||||
fun qux (xs: int) : int = return xs - 1;
|
||||
fun quux (xs: int) (xy: int) : int = return xs - 2 + xy;
|
||||
fun foo (xs: int) : int = return xs + 1
|
||||
fun bar (xs: int) (ys: int) : int = return xs + ys
|
||||
fun baz (xs: int) (ys: int) (zs: int): int = return xs + ys + zs
|
||||
fun qux (xs: int) : int = return xs - 1
|
||||
fun quux (xs: int) (xy: int) : int = return xs - 2 + xy
|
||||
|
||||
fun main: void = do
|
||||
66
|
||||
|
@ -11,9 +11,9 @@ fun main: void = do
|
|||
|> baz(1, 2, _)
|
||||
|> qux(_)
|
||||
|> quux(1, _)
|
||||
|> @write(_);
|
||||
|> @write(_)
|
||||
|
||||
210
|
||||
|> bar(_, _)
|
||||
|> @write(_);
|
||||
end;
|
||||
|> @write(_)
|
||||
end
|
Loading…
Reference in a new issue