diff --git a/debug.txt b/debug.txt deleted file mode 100644 index 1b22e41..0000000 --- a/debug.txt +++ /dev/null @@ -1,258 +0,0 @@ -Some( - [ - Declaration { - pos: 44..70, - kind: StructDeclaration( - StructDeclaration { - identifier: "MyOtherStruct", - fields: { - "k": StructField { - typ: Type { - identifier: Primitive( - Int, - ), - pos: 64..67, - children: None, - }, - pos: 61..62, - }, - }, - }, - ), - }, - Declaration { - pos: 79..142, - kind: StructDeclaration( - StructDeclaration { - identifier: "MyStruct", - fields: { - "a": StructField { - typ: Type { - identifier: Primitive( - Int, - ), - pos: 94..97, - children: None, - }, - pos: 91..92, - }, - "o": StructField { - typ: Type { - identifier: Struct( - "MyOtherStruct", - ), - pos: 127..140, - children: None, - }, - pos: 124..125, - }, - }, - }, - ), - }, - Declaration { - pos: 147..176, - kind: FunctionDeclaration( - FunctionDeclaration { - identifier: "main", - identifier_pos: 147..151, - parameters: [ - FunctionDeclarationParameter { - identifier: "argc", - typ: Type { - identifier: Primitive( - Int, - ), - pos: 158..161, - children: None, - }, - pos: 152..156, - }, - FunctionDeclarationParameter { - identifier: "argv", - typ: Type { - identifier: Primitive( - Pointer, - ), - pos: 169..175, - children: Some( - [ - Type { - identifier: Primitive( - Pointer, - ), - pos: 170..175, - children: Some( - [ - Type { - identifier: Primitive( - Char, - ), - pos: 171..175, - children: None, - }, - ], - ), - }, - ], - ), - }, - pos: 163..167, - }, - ], - content: [ - Declaration { - pos: 185..277, - kind: Statement( - Statement { - pos: 185..277, - kind: VariableDeclaration( - VariableDeclaration { - typ: Some( - Type { - identifier: Struct( - "MyStruct", - ), - pos: 188..196, - children: None, - }, - ), - identifier: "s", - identifier_pos: 185..186, - right: Expression { - pos: 199..277, - kind: StructConstruction( - StructConstruction { - identifier: "MyStruct", - identifier_pos: 199..207, - fields: { - "a": StructConstructionField { - pos: 212..213, - expr: Expression { - pos: 215..216, - kind: Primary( - Literal( - Int( - 1, - ), - ), - ), - }, - }, - "o": StructConstructionField { - pos: 242..243, - expr: Expression { - pos: 245..274, - kind: StructConstruction( - StructConstruction { - identifier: "MyOtherStruct", - identifier_pos: 245..258, - fields: { - "k": StructConstructionField { - pos: 264..265, - expr: Expression { - pos: 267..270, - kind: Primary( - Literal( - Int( - 123, - ), - ), - ), - }, - }, - }, - }, - ), - }, - }, - }, - }, - ), - }, - right_pos: 199..277, - }, - ), - }, - ), - }, - Declaration { - pos: 281..297, - kind: Statement( - Statement { - pos: 281..297, - kind: VariableAssignment( - VariableAssignment { - left: Expression { - pos: 281..284, - kind: MemberAccess( - MemberAccess { - left: Expression { - pos: 281..282, - kind: Primary( - Identifier( - "s", - ), - ), - }, - member: "a", - }, - ), - }, - left_pos: 281..284, - right: Expression { - pos: 287..297, - kind: Binary( - Binary { - left: Expression { - pos: 287..292, - kind: MemberAccess( - MemberAccess { - left: Expression { - pos: 287..290, - kind: MemberAccess( - MemberAccess { - left: Expression { - pos: 287..288, - kind: Primary( - Identifier( - "s", - ), - ), - }, - member: "o", - }, - ), - }, - member: "k", - }, - ), - }, - right: Expression { - pos: 295..297, - kind: Primary( - Literal( - Int( - 10, - ), - ), - ), - }, - operator: Plus, - operator_pos: 293..294, - }, - ), - }, - right_pos: 287..297, - }, - ), - }, - ), - }, - ], - return_type: None, - }, - ), - }, - ], -) diff --git a/input.ro b/input.ro index 78f80a8..1393db0 100644 --- a/input.ro +++ b/input.ro @@ -1,3 +1,25 @@ -fn my_func(in: int) {} +__builtin fn printf(format: str, ...args: any); -my_func("abc"); \ No newline at end of file +fn add_two_things(format: str, a: T, b: T) { + let c: T = a + b; + + printf(format, a, b, c); +} + + +let a: int = 1; +let c: int = 5; + +let strvar = "abc"; + +add_two_things( + "%i + %i = %i\n", + a, + c +); + +add_two_things( + "%s + %s = %s\n", + strvar, + "def" +); diff --git a/bootstrap.rost b/legacy/bootstrap.ro similarity index 100% rename from bootstrap.rost rename to legacy/bootstrap.ro diff --git a/build.sh b/legacy/build.sh similarity index 100% rename from build.sh rename to legacy/build.sh diff --git a/compile.sh b/legacy/compile.sh similarity index 100% rename from compile.sh rename to legacy/compile.sh diff --git a/run-entrypoint.sh b/legacy/run-entrypoint.sh similarity index 100% rename from run-entrypoint.sh rename to legacy/run-entrypoint.sh diff --git a/run-release.sh b/legacy/run-release.sh similarity index 100% rename from run-release.sh rename to legacy/run-release.sh diff --git a/run-tests.sh b/legacy/run-tests.sh similarity index 100% rename from run-tests.sh rename to legacy/run-tests.sh diff --git a/run.sh b/legacy/run.sh similarity index 100% rename from run.sh rename to legacy/run.sh diff --git a/std.ro b/legacy/std.ro similarity index 100% rename from std.ro rename to legacy/std.ro diff --git a/tests/array_index.in b/legacy/tests/array_index.in similarity index 100% rename from tests/array_index.in rename to legacy/tests/array_index.in diff --git a/tests/array_index.out b/legacy/tests/array_index.out similarity index 100% rename from tests/array_index.out rename to legacy/tests/array_index.out diff --git a/tests/assignment.in b/legacy/tests/assignment.in similarity index 100% rename from tests/assignment.in rename to legacy/tests/assignment.in diff --git a/tests/assignment.out b/legacy/tests/assignment.out similarity index 100% rename from tests/assignment.out rename to legacy/tests/assignment.out diff --git a/tests/command_line_arg.in b/legacy/tests/command_line_arg.in similarity index 100% rename from tests/command_line_arg.in rename to legacy/tests/command_line_arg.in diff --git a/tests/command_line_arg.out b/legacy/tests/command_line_arg.out similarity index 100% rename from tests/command_line_arg.out rename to legacy/tests/command_line_arg.out diff --git a/tests/command_line_arg_loop.in b/legacy/tests/command_line_arg_loop.in similarity index 100% rename from tests/command_line_arg_loop.in rename to legacy/tests/command_line_arg_loop.in diff --git a/tests/command_line_arg_loop.out b/legacy/tests/command_line_arg_loop.out similarity index 100% rename from tests/command_line_arg_loop.out rename to legacy/tests/command_line_arg_loop.out diff --git a/tests/command_line_arg_optional.in b/legacy/tests/command_line_arg_optional.in similarity index 100% rename from tests/command_line_arg_optional.in rename to legacy/tests/command_line_arg_optional.in diff --git a/tests/command_line_arg_optional.out b/legacy/tests/command_line_arg_optional.out similarity index 100% rename from tests/command_line_arg_optional.out rename to legacy/tests/command_line_arg_optional.out diff --git a/tests/division.in b/legacy/tests/division.in similarity index 100% rename from tests/division.in rename to legacy/tests/division.in diff --git a/tests/division.out b/legacy/tests/division.out similarity index 100% rename from tests/division.out rename to legacy/tests/division.out diff --git a/tests/error_command_line_arg_too_many.in b/legacy/tests/error_command_line_arg_too_many.in similarity index 100% rename from tests/error_command_line_arg_too_many.in rename to legacy/tests/error_command_line_arg_too_many.in diff --git a/tests/error_command_line_arg_too_many.out b/legacy/tests/error_command_line_arg_too_many.out similarity index 100% rename from tests/error_command_line_arg_too_many.out rename to legacy/tests/error_command_line_arg_too_many.out diff --git a/tests/error_function.in b/legacy/tests/error_function.in similarity index 100% rename from tests/error_function.in rename to legacy/tests/error_function.in diff --git a/tests/error_function.out b/legacy/tests/error_function.out similarity index 100% rename from tests/error_function.out rename to legacy/tests/error_function.out diff --git a/tests/error_function_params.in b/legacy/tests/error_function_params.in similarity index 100% rename from tests/error_function_params.in rename to legacy/tests/error_function_params.in diff --git a/tests/error_function_params.out b/legacy/tests/error_function_params.out similarity index 100% rename from tests/error_function_params.out rename to legacy/tests/error_function_params.out diff --git a/tests/error_function_return.in b/legacy/tests/error_function_return.in similarity index 100% rename from tests/error_function_return.in rename to legacy/tests/error_function_return.in diff --git a/tests/error_function_return.out b/legacy/tests/error_function_return.out similarity index 100% rename from tests/error_function_return.out rename to legacy/tests/error_function_return.out diff --git a/tests/error_pointers.in b/legacy/tests/error_pointers.in similarity index 100% rename from tests/error_pointers.in rename to legacy/tests/error_pointers.in diff --git a/tests/error_pointers.out b/legacy/tests/error_pointers.out similarity index 100% rename from tests/error_pointers.out rename to legacy/tests/error_pointers.out diff --git a/tests/error_redeclared.in b/legacy/tests/error_redeclared.in similarity index 100% rename from tests/error_redeclared.in rename to legacy/tests/error_redeclared.in diff --git a/tests/error_redeclared.out b/legacy/tests/error_redeclared.out similarity index 100% rename from tests/error_redeclared.out rename to legacy/tests/error_redeclared.out diff --git a/tests/error_scope.in b/legacy/tests/error_scope.in similarity index 100% rename from tests/error_scope.in rename to legacy/tests/error_scope.in diff --git a/tests/error_scope.out b/legacy/tests/error_scope.out similarity index 100% rename from tests/error_scope.out rename to legacy/tests/error_scope.out diff --git a/tests/error_semicolon.in b/legacy/tests/error_semicolon.in similarity index 100% rename from tests/error_semicolon.in rename to legacy/tests/error_semicolon.in diff --git a/tests/error_semicolon.out b/legacy/tests/error_semicolon.out similarity index 100% rename from tests/error_semicolon.out rename to legacy/tests/error_semicolon.out diff --git a/tests/error_wrong_type.in b/legacy/tests/error_wrong_type.in similarity index 100% rename from tests/error_wrong_type.in rename to legacy/tests/error_wrong_type.in diff --git a/tests/error_wrong_type.out b/legacy/tests/error_wrong_type.out similarity index 100% rename from tests/error_wrong_type.out rename to legacy/tests/error_wrong_type.out diff --git a/tests/function.in b/legacy/tests/function.in similarity index 100% rename from tests/function.in rename to legacy/tests/function.in diff --git a/tests/function.out b/legacy/tests/function.out similarity index 100% rename from tests/function.out rename to legacy/tests/function.out diff --git a/tests/function_par_ref.in b/legacy/tests/function_par_ref.in similarity index 100% rename from tests/function_par_ref.in rename to legacy/tests/function_par_ref.in diff --git a/tests/function_par_ref.out b/legacy/tests/function_par_ref.out similarity index 100% rename from tests/function_par_ref.out rename to legacy/tests/function_par_ref.out diff --git a/tests/function_return.in b/legacy/tests/function_return.in similarity index 100% rename from tests/function_return.in rename to legacy/tests/function_return.in diff --git a/tests/function_return.out b/legacy/tests/function_return.out similarity index 100% rename from tests/function_return.out rename to legacy/tests/function_return.out diff --git a/tests/if.in b/legacy/tests/if.in similarity index 100% rename from tests/if.in rename to legacy/tests/if.in diff --git a/tests/if.out b/legacy/tests/if.out similarity index 100% rename from tests/if.out rename to legacy/tests/if.out diff --git a/tests/member_access.in b/legacy/tests/member_access.in similarity index 100% rename from tests/member_access.in rename to legacy/tests/member_access.in diff --git a/tests/member_access.out b/legacy/tests/member_access.out similarity index 100% rename from tests/member_access.out rename to legacy/tests/member_access.out diff --git a/tests/pointer_short.in b/legacy/tests/pointer_short.in similarity index 100% rename from tests/pointer_short.in rename to legacy/tests/pointer_short.in diff --git a/tests/pointer_short.out b/legacy/tests/pointer_short.out similarity index 100% rename from tests/pointer_short.out rename to legacy/tests/pointer_short.out diff --git a/tests/pointers.in b/legacy/tests/pointers.in similarity index 100% rename from tests/pointers.in rename to legacy/tests/pointers.in diff --git a/tests/pointers.out b/legacy/tests/pointers.out similarity index 100% rename from tests/pointers.out rename to legacy/tests/pointers.out diff --git a/tests/triangle.in b/legacy/tests/triangle.in similarity index 100% rename from tests/triangle.in rename to legacy/tests/triangle.in diff --git a/tests/triangle.out b/legacy/tests/triangle.out similarity index 100% rename from tests/triangle.out rename to legacy/tests/triangle.out diff --git a/tests/while.in b/legacy/tests/while.in similarity index 100% rename from tests/while.in rename to legacy/tests/while.in diff --git a/tests/while.out b/legacy/tests/while.out similarity index 100% rename from tests/while.out rename to legacy/tests/while.out