diff --git a/examples/error.sp b/examples/error.sp index 93b1037..665741e 100644 --- a/examples/error.sp +++ b/examples/error.sp @@ -1,5 +1,5 @@ -import core/flow; +const { exit } from @'core/os'; -@main { - flow.exit(1); +let @main in { + exit(1); } \ No newline at end of file diff --git a/examples/file.sp b/examples/file.sp index 72922c9..0ec83f8 100644 --- a/examples/file.sp +++ b/examples/file.sp @@ -1,10 +1,10 @@ -import core/io; -import core/fs; +const io from @'core/io'; +const { open } from @'core/fs'; -@main { - io.out('What\'s your name? '); - str name = io.in(); - fs.File nameFile = fs.open('name.txt'); - nameFile.write(name); - nameFile.close(); +let @main in { + io.out("What is your name? "); + let name = io.in(); + let file = open("name.txt"); + file.write(name); + file.close(); } \ No newline at end of file diff --git a/examples/float128.sp b/examples/float128.sp index 23482db..e0421f2 100644 --- a/examples/float128.sp +++ b/examples/float128.sp @@ -1,8 +1,9 @@ -import core/io; -import core/string; +const io from @'core/io'; +const { concat } from @'core/string'; +const { toString } from @'core/float_utils'; -@main { - f128 float1 = 234.6; - f128 float2 = 2934748348291930404.5; - io.outln(string.concat('Result is: ',(str)(float1 + float2))); +let @main in { + let float1 : f128 = 234.6; + f128 float2 : f128 = 2934748348291930404.5; + io.outln(concat('Result is: ',toString(float1 + float2))); } \ No newline at end of file diff --git a/examples/hello-world.sp b/examples/hello-world.sp index 5b5aaad..31037d1 100644 --- a/examples/hello-world.sp +++ b/examples/hello-world.sp @@ -1,5 +1,5 @@ -import core/io; +const io from @'core/io'; -@main { +let @main in { io.outln('Hello world!'); } \ No newline at end of file diff --git a/examples/input.sp b/examples/input.sp index 1209e09..d83ceae 100644 --- a/examples/input.sp +++ b/examples/input.sp @@ -1,8 +1,8 @@ -import core/io; +const io from @'core/io'; -@main { +let @main in { io.out('What\'s your name? '); - str name = io.in(); + let name = io.in(); io.out('Hello, '); io.out(name); io.out('!!'); diff --git a/examples/new-syntax.sp b/examples/new-syntax.sp index 77a1e60..f7e3b2d 100644 --- a/examples/new-syntax.sp +++ b/examples/new-syntax.sp @@ -1,12 +1,10 @@ -let { io } in @'core/io'; +const { io } from @'core/io'; -let good_food : String = 'watermelon'; +const good_food : String = 'watermelon'; -let @main : i32 in { +let @main in { io.outln('Hello world!'); io.outf('My favorite food is %s\n',good_food); - - return 0; } \ No newline at end of file diff --git a/examples/variables.sp b/examples/variables.sp index be4ac7a..da6d30a 100644 --- a/examples/variables.sp +++ b/examples/variables.sp @@ -1,7 +1,7 @@ -import core/io; +const io from @'core/io'; @main { - i32 age = 64; + let age : i32 = 64; io.out('I am '); io.out(age); io.outln(' years old.');