Showing preview only (2,191K chars total). Download the full file or copy to clipboard to get everything.
Repository: egranata/aria
Branch: master
Commit: d3e204e68cb0
Files: 900
Total size: 1.9 MB
Directory structure:
gitextract_91w9n8tq/
├── .github/
│ ├── dependabot.yml
│ └── workflows/
│ ├── clippy.yml
│ ├── fmt.yml
│ ├── linux_build_test.yml
│ ├── macos_build_test.yml
│ ├── release.yml
│ ├── slash_clippy.yml
│ └── slash_fmt.yml
├── .gitignore
├── .pre-commit-config.yaml
├── CHANGELOG.md
├── CODEOWNERS
├── Cargo.toml
├── Dockerfile
├── LICENSE
├── README.md
├── add_license_marker.sh
├── aria
├── aria-bin/
│ ├── Cargo.toml
│ ├── src/
│ │ ├── error_reporting.rs
│ │ ├── error_reporting_test/
│ │ │ ├── expected.txt
│ │ │ ├── main.aria
│ │ │ └── util.aria
│ │ ├── file_eval.rs
│ │ ├── main.rs
│ │ ├── repl_eval.rs
│ │ ├── repl_preamble.aria
│ │ └── test.rs
│ ├── test_assert.aria
│ └── test_uncaught_exception.aria
├── b
├── ci_tests.sh
├── compiler-lib/
│ ├── Cargo.toml
│ └── src/
│ ├── bc_reader.rs
│ ├── bc_writer.rs
│ ├── builder/
│ │ ├── block.rs
│ │ ├── compiler_opcodes.rs
│ │ ├── func.rs
│ │ └── mod.rs
│ ├── constant_value.rs
│ ├── do_compile/
│ │ ├── mod.rs
│ │ ├── nodes/
│ │ │ ├── add_operation.rs
│ │ │ ├── assert_statement.rs
│ │ │ ├── assign_statement.rs
│ │ │ ├── break_statement.rs
│ │ │ ├── code_block.rs
│ │ │ ├── comp_operation.rs
│ │ │ ├── continue_statement.rs
│ │ │ ├── enum_case_decl.rs
│ │ │ ├── enum_decl.rs
│ │ │ ├── expression.rs
│ │ │ ├── expression_list.rs
│ │ │ ├── expression_statement.rs
│ │ │ ├── extension_decl.rs
│ │ │ ├── float_literal.rs
│ │ │ ├── for_statement.rs
│ │ │ ├── function_body.rs
│ │ │ ├── function_decl.rs
│ │ │ ├── identifier.rs
│ │ │ ├── if_statement.rs
│ │ │ ├── import_from_statement.rs
│ │ │ ├── import_statement.rs
│ │ │ ├── int_literal.rs
│ │ │ ├── lambda.rs
│ │ │ ├── list_literal.rs
│ │ │ ├── logical_operation.rs
│ │ │ ├── match_pattern.rs
│ │ │ ├── match_pattern_comp.rs
│ │ │ ├── match_pattern_enum_case.rs
│ │ │ ├── match_pattern_rel.rs
│ │ │ ├── match_statement.rs
│ │ │ ├── method_decl.rs
│ │ │ ├── mixin_decl.rs
│ │ │ ├── mod.rs
│ │ │ ├── mul_operation.rs
│ │ │ ├── paren_expression.rs
│ │ │ ├── parsed_module.rs
│ │ │ ├── postfix_rvalue.rs
│ │ │ ├── primary.rs
│ │ │ ├── rel_operation.rs
│ │ │ ├── return_statement.rs
│ │ │ ├── shift_operation.rs
│ │ │ ├── statement.rs
│ │ │ ├── string_literal.rs
│ │ │ ├── struct_decl.rs
│ │ │ ├── ternary_expression.rs
│ │ │ ├── throw_statement.rs
│ │ │ ├── try_block.rs
│ │ │ ├── try_unwrap_expression.rs
│ │ │ ├── unary_operation.rs
│ │ │ ├── val_decl_entry.rs
│ │ │ ├── val_decl_statement.rs
│ │ │ ├── while_statement.rs
│ │ │ └── write_opeq_statement.rs
│ │ └── postfix.rs
│ ├── dump/
│ │ ├── mod.rs
│ │ └── opcodes.rs
│ ├── lib.rs
│ ├── line_table.rs
│ ├── module.rs
│ └── scope.rs
├── docker/
│ └── release/
│ └── Dockerfile
├── docs/
│ └── index.html
├── examples/
│ ├── 99bottles.aria
│ ├── add_license_marker.aria
│ ├── advent_of_code_2024_day1.aria
│ ├── advent_of_code_2024_day2.aria
│ ├── advent_of_code_2024_day3.aria
│ ├── command_line_args.aria
│ ├── currency.aria
│ ├── dir.aria
│ ├── fibonacci.aria
│ ├── fibonacci_memoized.aria
│ ├── fizzbuzz.aria
│ ├── github_user.aria
│ ├── hello.aria
│ ├── parser.aria
│ ├── peano.aria
│ ├── pi.aria
│ ├── sieve.aria
│ └── string_escapes.aria
├── lib/
│ └── aria/
│ ├── core/
│ │ ├── arity.aria
│ │ ├── bool.aria
│ │ ├── box.aria
│ │ ├── builtin.aria
│ │ ├── float.aria
│ │ ├── int.aria
│ │ ├── list.aria
│ │ ├── maybe.aria
│ │ ├── nothing.aria
│ │ ├── result.aria
│ │ ├── runtime_error.aria
│ │ ├── string.aria
│ │ ├── unimplemented.aria
│ │ └── unit.aria
│ ├── date/
│ │ ├── instant.aria
│ │ └── timezone.aria
│ ├── io/
│ │ ├── file.aria
│ │ └── path.aria
│ ├── iterator/
│ │ ├── enumerate.aria
│ │ ├── mixin.aria
│ │ └── zip.aria
│ ├── json/
│ │ ├── parser.aria
│ │ ├── value.aria
│ │ └── writer.aria
│ ├── network/
│ │ ├── request.aria
│ │ └── retry.aria
│ ├── numerics/
│ │ ├── complex.aria
│ │ ├── decimal.aria
│ │ ├── float/
│ │ │ ├── exp.aria
│ │ │ └── trig.aria
│ │ ├── int/
│ │ │ └── pow.aria
│ │ └── matrix.aria
│ ├── ordering/
│ │ ├── compare.aria
│ │ └── utils.aria
│ ├── range/
│ │ ├── int_extension.aria
│ │ └── range.aria
│ ├── rng/
│ │ ├── mixin.aria
│ │ ├── msws.aria
│ │ └── xorshift.aria
│ ├── string/
│ │ ├── classes.aria
│ │ └── regex.aria
│ ├── structures/
│ │ ├── hash/
│ │ │ ├── algo/
│ │ │ │ └── sip.aria
│ │ │ └── list.aria
│ │ ├── map.aria
│ │ ├── queue.aria
│ │ ├── set.aria
│ │ └── stack.aria
│ ├── system/
│ │ ├── coloring.aria
│ │ └── platform.aria
│ ├── test/
│ │ └── test.aria
│ └── utils/
│ └── guard.aria
├── lib-test/
│ ├── README.md
│ ├── all/
│ │ └── source.aria
│ ├── attributes/
│ │ └── things.aria
│ ├── base_module/
│ │ └── nested_module/
│ │ └── content.aria
│ ├── circular/
│ │ ├── one.aria
│ │ ├── two.aria
│ │ └── zero.aria
│ ├── cool_widget/
│ │ ├── buzz.aria
│ │ ├── lib.aria
│ │ └── widget.json
│ ├── example/
│ │ ├── pair/
│ │ │ └── Pair.aria
│ │ └── two/
│ │ └── things.aria
│ ├── exported_var/
│ │ └── source.aria
│ ├── ext/
│ │ └── string.aria
│ ├── extensible/
│ │ ├── base.aria
│ │ └── ext.aria
│ ├── multiple/
│ │ └── module.aria
│ ├── other_widget/
│ │ ├── a.aria
│ │ ├── mod/
│ │ │ └── b.aria
│ │ └── widget.json
│ ├── same_root/
│ │ └── part1/
│ │ ├── file1.aria
│ │ ├── file2.aria
│ │ └── file3.aria
│ ├── test_things.aria
│ └── with_err/
│ └── error.aria
├── lsp/
│ ├── Cargo.toml
│ └── src/
│ ├── document.rs
│ ├── lexer.rs
│ ├── lib.rs
│ ├── main.rs
│ └── parser.rs
├── microbenchmarks/
│ ├── attribute_read.aria
│ ├── attribute_write.aria
│ ├── enum_case.aria
│ ├── infra.aria
│ ├── int_arith.aria
│ ├── list_filled.aria
│ ├── list_from_closure.aria
│ ├── list_read.aria
│ ├── list_write.aria
│ ├── map_loop.aria
│ ├── method_call.aria
│ └── sieve.aria
├── native-libs/
│ ├── file/
│ │ ├── Cargo.toml
│ │ └── src/
│ │ └── lib.rs
│ ├── network/
│ │ ├── Cargo.toml
│ │ └── src/
│ │ └── lib.rs
│ ├── path/
│ │ ├── Cargo.toml
│ │ └── src/
│ │ └── lib.rs
│ ├── platform/
│ │ ├── Cargo.toml
│ │ └── src/
│ │ └── lib.rs
│ ├── regex/
│ │ ├── Cargo.toml
│ │ └── src/
│ │ └── lib.rs
│ ├── timezone/
│ │ ├── Cargo.toml
│ │ └── src/
│ │ └── lib.rs
│ └── unicode/
│ ├── Cargo.toml
│ └── src/
│ └── lib.rs
├── opcodes-lib/
│ ├── Cargo.toml
│ └── src/
│ └── lib.rs
├── package.sh
├── parser-lib/
│ ├── Cargo.toml
│ └── src/
│ ├── ast/
│ │ ├── derive/
│ │ │ └── mod.rs
│ │ ├── mod.rs
│ │ ├── nodes/
│ │ │ ├── add_eq_symbol.rs
│ │ │ ├── add_operation.rs
│ │ │ ├── add_symbol.rs
│ │ │ ├── argument_decl.rs
│ │ │ ├── argument_list.rs
│ │ │ ├── assert_statement.rs
│ │ │ ├── assign_statement.rs
│ │ │ ├── break_statement.rs
│ │ │ ├── code_block.rs
│ │ │ ├── comp_operation.rs
│ │ │ ├── comp_symbol.rs
│ │ │ ├── continue_statement.rs
│ │ │ ├── declaration_id.rs
│ │ │ ├── else_piece.rs
│ │ │ ├── elsif_piece.rs
│ │ │ ├── enum_case_decl.rs
│ │ │ ├── enum_decl.rs
│ │ │ ├── enum_decl_entry.rs
│ │ │ ├── expression.rs
│ │ │ ├── expression_list.rs
│ │ │ ├── expression_statement.rs
│ │ │ ├── extension_decl.rs
│ │ │ ├── float_literal.rs
│ │ │ ├── for_statement.rs
│ │ │ ├── function_body.rs
│ │ │ ├── function_decl.rs
│ │ │ ├── identifier.rs
│ │ │ ├── identifier_list.rs
│ │ │ ├── if_cond_piece.rs
│ │ │ ├── if_piece.rs
│ │ │ ├── if_statement.rs
│ │ │ ├── import_from_statement.rs
│ │ │ ├── import_path.rs
│ │ │ ├── import_statement.rs
│ │ │ ├── import_target.rs
│ │ │ ├── int_literal.rs
│ │ │ ├── lambda_body.rs
│ │ │ ├── lambda_function.rs
│ │ │ ├── list_literal.rs
│ │ │ ├── log_operation.rs
│ │ │ ├── log_symbol.rs
│ │ │ ├── match_pattern.rs
│ │ │ ├── match_pattern_comp.rs
│ │ │ ├── match_pattern_enum_case.rs
│ │ │ ├── match_pattern_rel.rs
│ │ │ ├── match_rule.rs
│ │ │ ├── match_statement.rs
│ │ │ ├── method_access.rs
│ │ │ ├── method_decl.rs
│ │ │ ├── mixin_decl.rs
│ │ │ ├── mixin_include_decl.rs
│ │ │ ├── mod.rs
│ │ │ ├── module_flag.rs
│ │ │ ├── module_flags.rs
│ │ │ ├── mul_operation.rs
│ │ │ ├── mul_symbol.rs
│ │ │ ├── operator_decl.rs
│ │ │ ├── operator_symbol.rs
│ │ │ ├── paren_expression.rs
│ │ │ ├── parsed_module.rs
│ │ │ ├── postfix_expression.rs
│ │ │ ├── postfix_rvalue.rs
│ │ │ ├── postfix_term.rs
│ │ │ ├── postfix_term_attribute.rs
│ │ │ ├── postfix_term_call.rs
│ │ │ ├── postfix_term_enum_case.rs
│ │ │ ├── postfix_term_field_write.rs
│ │ │ ├── postfix_term_index.rs
│ │ │ ├── postfix_term_index_write.rs
│ │ │ ├── postfix_term_object_write.rs
│ │ │ ├── postfix_term_try_protocol.rs
│ │ │ ├── postfix_term_write.rs
│ │ │ ├── postfix_term_write_list.rs
│ │ │ ├── primary.rs
│ │ │ ├── rel_operation.rs
│ │ │ ├── rel_symbol.rs
│ │ │ ├── return_statement.rs
│ │ │ ├── shift_operation.rs
│ │ │ ├── shift_symbol.rs
│ │ │ ├── statement.rs
│ │ │ ├── string_literal.rs
│ │ │ ├── struct_decl.rs
│ │ │ ├── struct_entry.rs
│ │ │ ├── ternary_expression.rs
│ │ │ ├── throw_statement.rs
│ │ │ ├── top_level_entry.rs
│ │ │ ├── try_block.rs
│ │ │ ├── try_unwrap_expression.rs
│ │ │ ├── unary_operation.rs
│ │ │ ├── unary_symbol.rs
│ │ │ ├── val_decl_entry.rs
│ │ │ ├── val_decl_statement.rs
│ │ │ ├── while_statement.rs
│ │ │ └── write_op_eq_statement.rs
│ │ └── prettyprint/
│ │ ├── mod.rs
│ │ └── printout_accumulator.rs
│ ├── grammar/
│ │ ├── grammar.pest
│ │ └── mod.rs
│ └── lib.rs
├── pgo
├── run_doc_script_tests.sh
├── t
├── test-bin/
│ ├── Cargo.toml
│ └── src/
│ └── main.rs
├── tests/
│ ├── alloc_builtin_type.aria
│ ├── and.aria
│ ├── and_shortcircuit.aria
│ ├── arg_isa_mixin.aria
│ ├── arg_typehint.aria
│ ├── argc_mismatch_error.aria
│ ├── aria_version.aria
│ ├── arity_of_callable.aria
│ ├── as_user_printable.aria
│ ├── assert_id_func.aria
│ ├── bind_call_enum_instance_method.aria
│ ├── bind_call_enum_type_method.aria
│ ├── bind_of_free_func.aria
│ ├── bind_of_func_on_builtin.aria
│ ├── box_type.aria
│ ├── break_in_forloop.aria
│ ├── build_mixin.aria
│ ├── builtin_isa_mixin.aria
│ ├── builtin_maybe_enum.aria
│ ├── builtin_type_func_takes_This.aria
│ ├── builtin_type_type.aria
│ ├── builtins_list_attributes.aria
│ ├── bw_ops.aria
│ ├── call_op_call.aria
│ ├── call_struct_func.aria
│ ├── chained_try_unwrap.aria
│ ├── closure_range_list.aria
│ ├── closure_with_body.aria
│ ├── cmp_utils.aria
│ ├── complex_hash.aria
│ ├── complex_numbers.aria
│ ├── complex_of_self.aria
│ ├── complex_reverse_minus.aria
│ ├── continue_in_forloop.aria
│ ├── cross_func_exception.aria
│ ├── cross_module_mixin_import.aria
│ ├── cross_module_var.aria
│ ├── cross_module_var_write.aria
│ ├── custom_is_unwrap.aria
│ ├── custom_to_json_value.aria
│ ├── custom_try_unwrap_protocol.aria
│ ├── decimal.aria
│ ├── decimal_hash.aria
│ ├── decimal_prettyprint.aria
│ ├── deep_nested_struct.aria
│ ├── default_arg_is_immutable.aria
│ ├── dir_entries.aria
│ ├── div_by_zero_error.aria
│ ├── dot_write_of_local.aria
│ ├── double_import_from.aria
│ ├── double_module_import.aria
│ ├── empty_expr_stmt.aria
│ ├── empty_func.aria
│ ├── enum_case_as_mixin.aria
│ ├── enum_case_check_no_payload.aria
│ ├── enum_equals.aria
│ ├── enum_extend_mixin.aria
│ ├── enum_in_struct.aria
│ ├── enum_isa_mixn.aria
│ ├── enum_list_attributes.aria
│ ├── enum_match_case_first_wins.aria
│ ├── enum_match_case_typehint.aria
│ ├── enum_op_equals.aria
│ ├── enum_prettyprint.aria
│ ├── enum_with_struct_case.aria
│ ├── enum_without_payload.aria
│ ├── except_in_op_is_caught.aria
│ ├── exception_backtrace.aria
│ ├── extend_imported.aria
│ ├── extend_included_mixin.aria
│ ├── extend_struct.aria
│ ├── extension_nested_struct.aria
│ ├── extension_on_list.aria
│ ├── extension_type_func.aria
│ ├── file_io.aria
│ ├── file_io.txt
│ ├── file_lines_iter.aria
│ ├── file_lines_iter.txt
│ ├── flatten_results.aria
│ ├── float_atan.aria
│ ├── float_exp.aria
│ ├── float_ln.aria
│ ├── float_log_exp.aria
│ ├── float_parse_scientific.aria
│ ├── float_pow.aria
│ ├── float_pretyprint.aria
│ ├── float_sqrt.aria
│ ├── flt_attrib.aria
│ ├── for_else.aria
│ ├── for_loop_test.aria
│ ├── format_of_nested_brace.aria
│ ├── format_with_opt_arg.aria
│ ├── fp_arith.aria
│ ├── fp_cmp_greater.aria
│ ├── fp_cmp_gt_eq.aria
│ ├── fp_cmp_lt_eq.aria
│ ├── fp_cmp_smaller.aria
│ ├── fp_consts.aria
│ ├── fp_eq.aria
│ ├── fp_ext_notation.aria
│ ├── fp_int_arith.aria
│ ├── fp_no_suffix.aria
│ ├── from_import_two_things.aria
│ ├── func_arg_type_mismatch.aria
│ ├── func_as_arg.aria
│ ├── func_has_multiple_optionals.aria
│ ├── func_has_only_vararg.aria
│ ├── func_has_vararg.aria
│ ├── func_multiple_fixed_vararg.aria
│ ├── func_only_takes_opt.aria
│ ├── func_order_of_vararg.aria
│ ├── func_returns_int.aria
│ ├── func_returns_unit.aria
│ ├── func_takes_args.aria
│ ├── func_type_equals.aria
│ ├── func_union_type_mismatch.aria
│ ├── func_with_opt_vararg.aria
│ ├── func_with_struct.aria
│ ├── function_arity.aria
│ ├── function_list_attributes.aria
│ ├── getenv.aria
│ ├── guard_on_return.aria
│ ├── guards_exit_on_throw.aria
│ ├── has_attr.aria
│ ├── hash_builtins.aria
│ ├── hash_instant.aria
│ ├── hash_maybe.aria
│ ├── hex_escapes.aria
│ ├── http_get_headers.aria
│ ├── http_post.aria
│ ├── http_post_json.aria
│ ├── http_request_custom_status.aria
│ ├── http_simple_get.aria
│ ├── identifier_casing.aria
│ ├── identifier_syntax.aria
│ ├── if_assign_val.aria
│ ├── if_false.aria
│ ├── if_postfix_obj.aria
│ ├── if_takes_else.aria
│ ├── if_takes_elsif.aria
│ ├── if_takes_if.aria
│ ├── if_true.aria
│ ├── implicit_is_X.aria
│ ├── import_all.aria
│ ├── import_from.aria
│ ├── import_pair_struct.aria
│ ├── import_string_extension.aria
│ ├── import_test_things.aria
│ ├── import_two_things.aria
│ ├── include_trivial_mixin.aria
│ ├── index_get.aria
│ ├── index_operators_empty.aria
│ ├── index_out_of_bounds_error.aria
│ ├── index_set.aria
│ ├── index_vararg.aria
│ ├── inner_function.aria
│ ├── inner_function_redef.aria
│ ├── inner_is_closure.aria
│ ├── inner_outer_loop.aria
│ ├── inner_val.aria
│ ├── instant_from_unix_2024_12_29.aria
│ ├── instant_from_unix_ts.aria
│ ├── instant_now.aria
│ ├── instant_offset_breaks_eq.aria
│ ├── instant_with_tz_offset.aria
│ ├── int_abs.aria
│ ├── int_arith.aria
│ ├── int_fp_int.aria
│ ├── int_index_operator.aria
│ ├── int_notations.aria
│ ├── int_prettyprint_style.aria
│ ├── int_range.aria
│ ├── int_range_ops.aria
│ ├── int_range_step.aria
│ ├── int_range_where_iter.aria
│ ├── int_shift_test.aria
│ ├── int_wraps.aria
│ ├── invalid_fileopen_throws.aria
│ ├── invalid_utf8_bytes.aria
│ ├── isa_intersection.aria
│ ├── isa_match.aria
│ ├── isa_mixin_union.aria
│ ├── isa_operator.aria
│ ├── iter_enum.aria
│ ├── iter_zip.aria
│ ├── iterable_skip.aria
│ ├── iterable_truncate.aria
│ ├── iterator_mixin.aria
│ ├── iterator_type_mismatch.aria
│ ├── json_flatten.aria
│ ├── json_parse_array.aria
│ ├── json_parse_nested.aria
│ ├── json_parse_wellknown.aria
│ ├── lambda_f_block.aria
│ ├── lambda_f_define.aria
│ ├── lambda_f_global.aria
│ ├── lambda_refers_to_uplevel.aria
│ ├── large_hex_int.aria
│ ├── large_negative_literal.aria
│ ├── list_append.aria
│ ├── list_as_map_key.aria
│ ├── list_contains.aria
│ ├── list_custom_write.aria
│ ├── list_drop.aria
│ ├── list_equals.aria
│ ├── list_filled.aria
│ ├── list_for_loop.aria
│ ├── list_functional.aria
│ ├── list_hash.aria
│ ├── list_iter_map.aria
│ ├── list_join.aria
│ ├── list_length.aria
│ ├── list_mul_op.aria
│ ├── list_negative_index.aria
│ ├── list_op_add.aria
│ ├── list_prettyprint.aria
│ ├── list_product_negative.aria
│ ├── list_search.aria
│ ├── list_sorting.aria
│ ├── list_sorting_with_cmp.aria
│ ├── list_where_iterator.aria
│ ├── list_write_out_of_bounds.aria
│ ├── local_define_type_mismatch.aria
│ ├── local_typehint_any.aria
│ ├── local_write_type_mismatch.aria
│ ├── lr_shift_custom_op.aria
│ ├── lt_gt_comp.aria
│ ├── lte_gte_comp.aria
│ ├── map_0_capacity.aria
│ ├── map_frequency_map.aria
│ ├── map_hash_negative.aria
│ ├── map_index_init.aria
│ ├── map_insert.aria
│ ├── map_iter.aria
│ ├── map_iterator_where.aria
│ ├── map_key_ops.aria
│ ├── map_keys.aria
│ ├── map_load_factor.aria
│ ├── map_remove.aria
│ ├── map_set_get.aria
│ ├── match_equals.aria
│ ├── match_extract_enum_payload.aria
│ ├── match_isa_case.aria
│ ├── match_not_eq.aria
│ ├── match_payload_fails_with_no_payload.aria
│ ├── match_rel.aria
│ ├── match_uses_custom_op_equals.aria
│ ├── match_without_commas.aria
│ ├── matrix.aria
│ ├── matrix_add.aria
│ ├── matrix_det.aria
│ ├── matrix_mul.aria
│ ├── matrix_transpose.aria
│ ├── max_min_empty.aria
│ ├── maybe_unwrap.aria
│ ├── method_arg_type_mismatch.aria
│ ├── method_as_arg.aria
│ ├── method_has_vararg.aria
│ ├── method_on_type.aria
│ ├── method_order_of_vararg.aria
│ ├── mismatch_payload.aria
│ ├── mix_int_fp_mod.aria
│ ├── mix_object_init.aria
│ ├── mixin_extension.aria
│ ├── mixin_func_This.aria
│ ├── mixin_has_enum.aria
│ ├── mixin_has_struct.aria
│ ├── mixin_in_extension.aria
│ ├── mixin_include_mixin.aria
│ ├── mixin_include_type_func.aria
│ ├── mixin_multiple_commas.aria
│ ├── mixin_of_builtin_type.aria
│ ├── mixin_of_enum.aria
│ ├── mixin_order.aria
│ ├── mixin_refers_to_self_method.aria
│ ├── mixin_shared_between_types.aria
│ ├── mixin_val_decl.aria
│ ├── mod_by_zero.aria
│ ├── module_level_val.aria
│ ├── module_level_var_fdeps.aria
│ ├── module_list_attributes.aria
│ ├── module_var_isa_mixin.aria
│ ├── msrng.aria
│ ├── mul_eq_ops.aria
│ ├── multidecl_order.aria
│ ├── multiple_imports_from.aria
│ ├── multiwrite_multiple.aria
│ ├── multiwrite_nesting.aria
│ ├── multiwrite_of_attribute.aria
│ ├── multiwrite_repeat.aria
│ ├── multiwrite_side_effecting.aria
│ ├── multiwrite_swap.aria
│ ├── naked_return.aria
│ ├── neg.aria
│ ├── nested_closure.aria
│ ├── nested_enum_in_func.aria
│ ├── nested_enum_with_entries.aria
│ ├── nested_extension.aria
│ ├── nested_forloop.aria
│ ├── nested_guard.aria
│ ├── nested_guards_order.aria
│ ├── nested_if.aria
│ ├── nested_lambda_f.aria
│ ├── nested_list.aria
│ ├── nested_obj_write.aria
│ ├── nested_struct_new.aria
│ ├── new_path.aria
│ ├── new_range_api.aria
│ ├── no_such_case.aria
│ ├── no_such_identifier.aria
│ ├── not.aria
│ ├── nothing_type.aria
│ ├── now.aria
│ ├── obj_box_read_write.aria
│ ├── obj_prettyprint.aria
│ ├── obj_write_comprehensive.aria
│ ├── obj_write_in_expr.aria
│ ├── obj_write_order.aria
│ ├── one_guard.aria
│ ├── one_line_function.aria
│ ├── op_add.aria
│ ├── op_call.aria
│ ├── op_div.aria
│ ├── op_equals.aria
│ ├── op_gt.aria
│ ├── op_gteq.aria
│ ├── op_index_throws.aria
│ ├── op_lt.aria
│ ├── op_lteq.aria
│ ├── op_mul.aria
│ ├── op_rem.aria
│ ├── op_sub.aria
│ ├── operator_overload.aria
│ ├── opt_args_this_usage.aria
│ ├── or.aria
│ ├── or_shortcircuit.aria
│ ├── ordering_mixin.aria
│ ├── paren_expression.aria
│ ├── parse_enum_cases.aria
│ ├── parse_fp.aria
│ ├── parse_int.aria
│ ├── pass_lambda.aria
│ ├── path_canonical.aria
│ ├── path_checks.aria
│ ├── path_common_ancestor.aria
│ ├── path_glob.aria
│ ├── path_hash.aria
│ ├── path_io.aria
│ ├── path_io.txt
│ ├── path_manipulation.aria
│ ├── path_manipulation.txt
│ ├── phi.aria
│ ├── platform.aria
│ ├── plus_minus_eq.aria
│ ├── postfix_obj_write.aria
│ ├── prettyprint_two_arg.aria
│ ├── queue.aria
│ ├── queue_with_cmp.aria
│ ├── range_hash.aria
│ ├── range_to_list.aria
│ ├── read_index_multiple.aria
│ ├── read_list_index.aria
│ ├── read_write_val_of_function.aria
│ ├── readattr.aria
│ ├── redundant_local_loads.aria
│ ├── redundant_named_loads.aria
│ ├── regex_api.aria
│ ├── result.aria
│ ├── result_helpers.aria
│ ├── result_to_exception.aria
│ ├── result_unwrap.aria
│ ├── retry_test.aria
│ ├── return_paren_expr.aria
│ ├── return_stops_eval.aria
│ ├── rng_oneof.aria
│ ├── rw_int_attrib.aria
│ ├── rw_str_attrib.aria
│ ├── set.aria
│ ├── set_ops.aria
│ ├── setenv.aria
│ ├── shape_failed_read_works.aria
│ ├── shift_eq_ops.aria
│ ├── simple_closure.aria
│ ├── simple_default_args.aria
│ ├── simple_json_parse.aria
│ ├── simple_json_parse_err.aria
│ ├── simple_try_unwrap.aria
│ ├── sip_hash_test.aria
│ ├── sleep.aria
│ ├── stack.aria
│ ├── str_chr_bytes.aria
│ ├── str_encoding.aria
│ ├── str_equality.aria
│ ├── str_int_mul.aria
│ ├── str_len_vs_index.aria
│ ├── string_classes.aria
│ ├── string_concat.aria
│ ├── string_contains.aria
│ ├── string_format.aria
│ ├── string_format_errors.aria
│ ├── string_from_bytes.aria
│ ├── string_index.aria
│ ├── string_join.aria
│ ├── string_negative_index.aria
│ ├── string_prefix_suffix.aria
│ ├── string_product_negative.aria
│ ├── string_remove.aria
│ ├── string_replace.aria
│ ├── string_split.aria
│ ├── string_trim.aria
│ ├── strings_anagram_hash.aria
│ ├── strlen.aria
│ ├── struct_field.aria
│ ├── struct_func_redecl.aria
│ ├── struct_in_enum.aria
│ ├── struct_in_struct.aria
│ ├── struct_isa_mixin.aria
│ ├── struct_list_attributes.aria
│ ├── struct_methods_refer_each_other.aria
│ ├── struct_methods_refer_outoforder.aria
│ ├── struct_mixin_multiple.aria
│ ├── struct_takes_self_arg.aria
│ ├── struct_with_opt_args.aria
│ ├── substring.aria
│ ├── successive_ifs.aria
│ ├── system_of_no_such_cmd_err.aria
│ ├── ternary_operator.aria
│ ├── ternary_operator_nested.aria
│ ├── ternary_operator_precedence.aria
│ ├── test_module.aria
│ ├── test_shell_command.aria
│ ├── test_with_no_main.aria
│ ├── throw_in_catch.aria
│ ├── throws_func.aria
│ ├── to_json_string.aria
│ ├── to_json_value.aria
│ ├── top_level_assign.aria
│ ├── top_level_code_block.aria
│ ├── top_level_expr_stmt.aria
│ ├── top_level_guard.aria
│ ├── top_level_plus_eq.aria
│ ├── top_level_shift_eq.aria
│ ├── top_level_try.aria
│ ├── trig.aria
│ ├── trivial_if.aria
│ ├── trivial_try_block.aria
│ ├── try_nothrow.aria
│ ├── try_unwinds_guard.aria
│ ├── try_unwrap_coalesce.aria
│ ├── try_unwrap_maybe.aria
│ ├── try_unwrap_non_result.aria
│ ├── type_func_takes_This.aria
│ ├── type_root.aria
│ ├── type_val_in_enum.aria
│ ├── typecheck_as_struct.aria
│ ├── unexpected_type_error.aria
│ ├── union_type_passes.aria
│ ├── unit_type.aria
│ ├── unused_local_typechecks.aria
│ ├── unused_local_value.aria
│ ├── unused_typed_local.aria
│ ├── unwrap_single_eval.aria
│ ├── uplevel_can_write_attrib.aria
│ ├── uplevel_write_before_read.aria
│ ├── upper_lower.aria
│ ├── while_break.aria
│ ├── while_continue.aria
│ ├── while_else.aria
│ ├── while_missed.aria
│ ├── while_taken.aria
│ ├── widget_test.aria
│ ├── write_attrib_struct.aria
│ ├── write_index.aria
│ ├── write_index_multiple.aria
│ ├── write_list_index.aria
│ ├── writeattr.aria
│ ├── xor.aria
│ └── xorshift.aria
├── tree_check.sh
├── vm-lib/
│ ├── Cargo.toml
│ ├── benches/
│ │ └── control_flow.rs
│ └── src/
│ ├── arity.rs
│ ├── builtins/
│ │ ├── alloc.rs
│ │ ├── arity.rs
│ │ ├── boolean.rs
│ │ ├── cmdline_args.rs
│ │ ├── exit.rs
│ │ ├── float.rs
│ │ ├── getenv.rs
│ │ ├── hasattr.rs
│ │ ├── integer.rs
│ │ ├── list.rs
│ │ ├── listattrs.rs
│ │ ├── maybe.rs
│ │ ├── mod.rs
│ │ ├── native_iterator.rs
│ │ ├── now.rs
│ │ ├── prettyprint.rs
│ │ ├── print.rs
│ │ ├── println.rs
│ │ ├── readattr.rs
│ │ ├── readln.rs
│ │ ├── result.rs
│ │ ├── runtime_error.rs
│ │ ├── setenv.rs
│ │ ├── sleep.rs
│ │ ├── string.rs
│ │ ├── system.rs
│ │ ├── test_exit.aria
│ │ ├── typ.rs
│ │ ├── typeof_builtin.rs
│ │ ├── unimplemented.rs
│ │ ├── unit.rs
│ │ └── writeattr.rs
│ ├── console.rs
│ ├── error/
│ │ ├── backtrace.rs
│ │ ├── dylib_load.rs
│ │ ├── exception.rs
│ │ ├── mod.rs
│ │ └── vm_error.rs
│ ├── frame.rs
│ ├── lib.rs
│ ├── mixin_includer.rs
│ ├── opcodes/
│ │ ├── mod.rs
│ │ ├── prettyprint.rs
│ │ └── sidecar.rs
│ ├── runtime_module.rs
│ ├── runtime_value/
│ │ ├── boolean.rs
│ │ ├── bound_function.rs
│ │ ├── builtin_value.rs
│ │ ├── enum_case.rs
│ │ ├── enumeration.rs
│ │ ├── float.rs
│ │ ├── function.rs
│ │ ├── integer.rs
│ │ ├── isa.rs
│ │ ├── kind.rs
│ │ ├── list.rs
│ │ ├── mixin.rs
│ │ ├── mod.rs
│ │ ├── object.rs
│ │ ├── opaque.rs
│ │ ├── runtime_code_object.rs
│ │ ├── rust_native_type.rs
│ │ ├── string.rs
│ │ └── structure.rs
│ ├── shape.rs
│ ├── stack.rs
│ ├── symbol.rs
│ ├── test.rs
│ └── vm.rs
└── vscode/
└── aria/
├── .vscodeignore
├── LICENSE
├── README.md
├── build.sh
├── language-configuration.json
├── package.json
├── src/
│ └── extension.ts
├── syntaxes/
│ └── aria.tmLanguage.json
├── tsconfig.json
└── tsconfig.tsbuildinfo
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/dependabot.yml
================================================
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
version: 2
updates:
- package-ecosystem: "cargo" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
================================================
FILE: .github/workflows/clippy.yml
================================================
name: Run Clippy on PR
on:
repository_dispatch:
types: [clippy-command]
permissions:
contents: write
pull-requests: write
jobs:
clippy:
runs-on: ubuntu-latest
steps:
- name: Resolve PR head
id: pr
run: |
echo "repo=${{ github.event.client_payload.pull_request.head.repo.full_name }}" >> "$GITHUB_OUTPUT"
echo "ref=${{ github.event.client_payload.pull_request.head.ref }}" >> "$GITHUB_OUTPUT"
echo "number=${{ github.event.client_payload.pull_request.number }}" >> "$GITHUB_OUTPUT"
- name: Set token
id: token
run: |
if [ -n "${{ secrets.REPO_SCOPED_TOKEN }}" ]; then
echo "token=${{ secrets.REPO_SCOPED_TOKEN }}" >> "$GITHUB_OUTPUT"
else
echo "token=${{ secrets.GITHUB_TOKEN }}" >> "$GITHUB_OUTPUT"
fi
- name: Checkout PR head
uses: actions/checkout@v4
with:
repository: ${{ steps.pr.outputs.repo }}
ref: ${{ steps.pr.outputs.ref }}
token: ${{ steps.token.outputs.token }}
fetch-depth: 0
- name: Install Rust (stable + clippy)
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Run cargo clippy
id: clippy
run: |
set +e
cargo clippy --all-targets --no-deps -- -D warnings > clippy_output.txt 2>&1
status=$?
echo "status=$status" >> $GITHUB_OUTPUT
exit 0
- name: Upload Clippy output
uses: actions/upload-artifact@v4
with:
name: clippy-log
path: clippy_output.txt
- name: Comment results on PR
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ steps.token.outputs.token }}
issue-number: ${{ steps.pr.outputs.number }}
body: |
🧹 `cargo clippy` has completed on `${{ steps.pr.outputs.ref }}`.
${{ steps.clippy.outputs.status == '0' && '✅ No issues found!' || '⚠️ Warnings or errors detected – see Clippy log artifact.' }}
================================================
FILE: .github/workflows/fmt.yml
================================================
name: Check PR Formatting with cargo fmt
on:
repository_dispatch:
types: [fmt-command]
permissions:
contents: read
pull-requests: write
jobs:
fmt:
runs-on: ubuntu-latest
steps:
- name: Resolve PR head
id: pr
run: |
echo "repo=${{ github.event.client_payload.pull_request.head.repo.full_name }}" >> "$GITHUB_OUTPUT"
echo "ref=${{ github.event.client_payload.pull_request.head.ref }}" >> "$GITHUB_OUTPUT"
echo "number=${{ github.event.client_payload.pull_request.number }}" >> "$GITHUB_OUTPUT"
- name: Checkout PR head
uses: actions/checkout@v4
with:
repository: ${{ steps.pr.outputs.repo }}
ref: ${{ steps.pr.outputs.ref }}
fetch-depth: 0
- name: Install Rust (stable + rustfmt)
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Run cargo fmt
id: fmt
run: |
cargo fmt --all -- --check || echo "changes_needed=true" >> "$GITHUB_OUTPUT"
- name: Comment on PR
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ steps.pr.outputs.number }}
body: |
✅ `cargo fmt` completed on `${{ steps.pr.outputs.ref }}`.
${{
steps.fmt.outputs.changes_needed == 'true' && '❌ Formatting issues detected. Please run `cargo fmt --all` locally and push the fixes.' ||
'🎉 Code is properly formatted. No action needed.'
}}
================================================
FILE: .github/workflows/linux_build_test.yml
================================================
name: LinuxBuildAndTest
permissions:
contents: read
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check tree
run: ./tree_check.sh
- name: Build
run: cargo build --verbose
- name: Run tests
run: ./ci_tests.sh
================================================
FILE: .github/workflows/macos_build_test.yml
================================================
name: MacOSBuildAndTest
permissions:
contents: read
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Check tree
run: ./tree_check.sh
- name: Build
run: cargo build --verbose
- name: Run tests
run: ./ci_tests.sh
================================================
FILE: .github/workflows/release.yml
================================================
permissions:
contents: write
name: release
on:
push:
tags: ["v*.*.*"]
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
env:
BIN_TARGETS: "aria"
DYLIB_CRATES: "aria_file aria_http aria_path aria_platform aria_regex aria_timezone aria_unicode"
EXTRA_FILES: "CHANGELOG.md"
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Get version
id: version
run: echo "VERSION=${GITHUB_REF##refs/tags/}" >> "$GITHUB_ENV"
- name: Build + package
shell: bash
run: ./package.sh
- name: Upload release assets
uses: softprops/action-gh-release@v2
with:
files: |
*.tgz
*.tgz.sha256
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
================================================
FILE: .github/workflows/slash_clippy.yml
================================================
name: SlashClippy
on:
issue_comment:
types: [created]
permissions:
contents: write
issues: write
pull-requests: read
jobs:
dispatch:
if: ${{ github.event.issue.pull_request && startsWith(github.event.comment.body, '/clippy') }}
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: peter-evans/slash-command-dispatch@v4
with:
token: ${{ secrets.SLASH_COMMAND_PAT }}
reaction-token: ${{ secrets.SLASH_COMMAND_PAT }}
commands: clippy
dispatch-type: repository
issue-type: pull-request
repository: ${{ github.repository }}
================================================
FILE: .github/workflows/slash_fmt.yml
================================================
name: SlashFmt
on:
issue_comment:
types: [created]
# Needed:
# - issues: write → add 👍 reaction
# - contents: write → fire repository_dispatch
permissions:
contents: write
issues: write
pull-requests: read
jobs:
dispatch:
if: ${{ github.event.issue.pull_request && startsWith(github.event.comment.body, '/fmt') }}
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: peter-evans/slash-command-dispatch@v4
with:
# Use GITHUB_TOKEN now that it has write perms
token: ${{ secrets.SLASH_COMMAND_PAT }}
reaction-token: ${{ secrets.SLASH_COMMAND_PAT }}
commands: fmt
dispatch-type: repository
issue-type: pull-request
repository: ${{ github.repository }}
================================================
FILE: .gitignore
================================================
# Rust & Cargo
/target
# Profilers
callgrind.out.*
perf.*
# IDEs and Editors
.vscode/
.idea/
*.swp
*.swo
# NPM
node_modules/
out/
# Aria-specific
history.aria
/vscode/aria/*.vsix
# OS-specific
.DS_Store
Thumbs.db
.env
================================================
FILE: .pre-commit-config.yaml
================================================
repos:
- repo: https://github.com/doublify/pre-commit-rust
rev: v1.0
hooks:
- id: fmt
- id: cargo-check
- id: clippy
- repo: http://github.com/Quard/license-header-checker
rev: v0.1
hooks:
- id: license-header-checker
files: \.rs$
args:
- --comment-style
- "//"
- --license
- "SPDX-License-Identifier: Apache-2.0\n"
- repo: http://github.com/Quard/license-header-checker
rev: v0.1
hooks:
- id: license-header-checker
files: \.aria$
args:
- --license
- "SPDX-License-Identifier: Apache-2.0\n"
================================================
FILE: CHANGELOG.md
================================================
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
For information on Aria's versioning scheme and release policy refer to [our Release Policy](https://arialang.github.io/release_policy.html).
## [0.9.20251222]
### Added
- Values of builtin types can now be checked for `mixin`
- Lists and strings allow wraparound indexing (e.g. `foo[-1]`)
- shift-equal operators (`<<=` and `=>>`)
- `\r` is now recognized as a valid escape sequence
- `JSONValue` prettyprints
### Fixed
- Multiplying a list or string by a negative integer returns an empty value
- `File.writeln` now actually writes a newline
- REPL input can now contain comments
- `MixinRng.one_of` will fail if passed an empty list as input
- String classes API now supports Unicode
- Negative timestamps are now resolved correctly by `Instant`
### Changed
- in `match` statements, `case Foo(blah)` will fail if `Foo` does not have a payload instead of throwing a VM error
- `String.hash` will return different values for anagrams
### Deprecated
None
### Removed
None
## [0.9.20251118]
### Added
- Add support for `??` and `!!` operators to `Maybe` objects
- Support for skipping and truncating iterators
- `SipHash` support has been added to the standard library
- Benchmarking utilities have been introduced to measure performance of code snippets
- `List` can now be hashed if all its values are hashable
- `Path.glob`
- Initial support for widgets as a code organizing structure
- Draft language server protocol (LSP) support for better IDE integration
- It is now possible to write `x,y = y,x` for swapping values (multiple assignment) and to declare multiple variables in one statement (`val x = 1, y = 2;`)
- `Map.frequency_map` has been added to create frequency maps from iterables
- Intersection types (`TypeA & TypeB`) have been introduced
### Fixed
- `Map` would error if an object's `hash` returned a negative value; it now handles this correctly
- It is now possible to write to a captured value without reading it
- `isa` now works with mixins
### Changed
- `Path.entries()` returns an iterator instead of a list for better performance
- `Path` operations consistently return `Maybe` / `Result` types for improved error handling
- `Iterator` uses `Maybe` instead of `.done` for its iteration protocol
- Hexadecimal literals are treated as unsigned integers
- Aria now lives under the `arialang` GitHub organization (https://github.com/arialang/aria)
### Deprecated
None
### Removed
None
================================================
FILE: CODEOWNERS
================================================
# Failsafe, if nobody else can pick up a review, I can
* @egranata
# List more specific code owners here
.github/workflows/macos* @enricobolzonello
native-libs/path @ZocoLini
lib/aria/io/path.aria @ZocoLini
.github/workflows/slash* @dlkritter
.github/workflows/clippy.yml @dlkritter
.github/workflows/fmt.yml @dlkritter
lsp @feznyng
vscode/aria @feznyng
================================================
FILE: Cargo.toml
================================================
[workspace]
members = [
"aria-bin",
"compiler-lib",
"lsp",
"native-libs/*",
"opcodes-lib",
"parser-lib",
"test-bin",
"vm-lib",
]
resolver = "2"
[profile.dist]
inherits = "release"
codegen-units = 1
lto = "fat"
debug = true
[profile.pgo]
inherits = "release"
lto = "thin"
debug = true
================================================
FILE: Dockerfile
================================================
# syntax=docker/dockerfile:1
# This Docker container installs Aria from prebuilt binaries on Ubuntu 24.04.
# It can be used as a base image for Aria development or to run Aria in CI.
FROM ubuntu:24.04
# To build with a specific version, use:
# docker build --build-arg ARIA_VERSION=<version> --build-arg ARIA_BUILD_TIMESTAMP=<timestamp> --build-arg ARIA_EXPECTED_SHA256=<sha256> -t aria:<version> .
# Example:
# docker build --build-arg ARIA_VERSION=0.9.20251220 --build-arg ARIA_BUILD_TIMESTAMP=20251220123456 --build-arg ARIA_EXPECTED_SHA256=47cb8d9de3a2229f1a403e1c616679811f085e819c1743e263c16c2c2d001d50 -t aria:0.9.20251220 .
ARG ARIA_VERSION=0.9.20251222
ARG ARIA_BUILD_TIMESTAMP=20251222174650
ARG ARIA_EXPECTED_SHA256=47cb8d9de3a2229f1a403e1c616679811f085e819c1743e263c16c2c2d001d50
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates curl tar findutils \
&& rm -rf /var/lib/apt/lists/*
RUN set -eux; \
url="https://github.com/arialang/aria/releases/download/v${ARIA_VERSION}/aria-${ARIA_VERSION}-x86_64-unknown-linux-gnu-${ARIA_BUILD_TIMESTAMP}.tgz"; \
mkdir -p /usr/aria; \
curl -fsSL "$url" -o /tmp/aria.tgz; \
echo "$ARIA_EXPECTED_SHA256 /tmp/aria.tgz" | sha256sum -c -; \
tar -xzf /tmp/aria.tgz -C /usr/aria; \
rm -f /tmp/aria.tgz; \
if [ ! -x /usr/aria/aria ]; then \
aria_path="$(find /usr/aria -maxdepth 4 -type f -name aria -perm -111 | head -n1 || true)"; \
if [ -n "$aria_path" ] && [ "$aria_path" != "/usr/aria/aria" ]; then \
ln -sf "$aria_path" /usr/aria/aria; \
fi; \
fi; \
if [ ! -x /usr/aria/aria ]; then \
echo "Error: 'aria' executable not found under /usr/aria after extraction from $url" >&2; \
exit 1; \
fi; \
ln -sf /usr/aria/aria /usr/local/bin/aria
CMD ["bash", "-lc", "printf 'Aria is available in your environment. Start it by running \"aria\"\\n'; exec bash -i"]
================================================
FILE: LICENSE
================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2025 Enrico Granata
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
================================================
FILE: README.md
================================================
# Aria: A Fresh, Safe, and Flexible Language for High-Level Development
[](https://github.com/arialang/aria/actions/workflows/linux_build_test.yml)
[](https://github.com/arialang/aria/actions/workflows/macos_build_test.yml)
[](https://opensource.org/licenses/Apache-2.0)
[](https://arialang.github.io/)
[](https://github.com/arialang/aria/graphs/contributors)
Please read [this post](https://arialang.github.io/blog/2026_02/post.html) for the latest update on Aria.
Welcome to Aria. Aria is a modern, dynamic scripting language. It is meant to be a "sweet spot" language, easy to pick-up and with a good balance between ease of use, safety, and flexibility. Aria's design choices help you build great programs quickly.
Aria has modern, safer error handling: Aria replaces unreliable `None` pointer checks with a modern, multi-tiered approach to error handling. By emphasizing algebraic data types (e.g. `Maybe`), Aria makes errors explicit, safer, and easier to manage, with fewer runtime surprises.
`null`, the [billion dollar mistake](https://softwareengineering.stackexchange.com/questions/413149/if-null-is-a-billion-dollar-mistake-what-is-the-solution-to-represent-a-non-ini) just does not exist in Aria, making code safer, easier to maintain and error handling more robust.
```aria
func main() {
val x = Int.parse("abc123");
match x {
case Ok(val) => {
println("Parsed value: {0}".format(val));
},
case Err(err) => {
println("Failed to parse integer: {0}".format(err));
}
}
}
```
Aria is memory safe from the start: Aria’s virtual machine, built on the Rust ecosystem, ensures memory safety out of the box, protecting you from common pitfalls like data corruption and security vulnerabilities. This lets you focus on building without worrying about risks you cannot manage.
Memory safety protects your code from issues such as memory corruption and dangling pointers. These issues can be hard to track down in large, complex systems. Aria brings these guarantees right from the start, so you can focus on building, not debugging.
Aria is designed for flexibility: Whether you need (some) type checks, an intuitive module system, or want to avoid the complexity of inheritance while still working with a modern object-based design, Aria adapts to your needs. It provides just enough structure to keep your code clean, without the overhead.
Aria’s object-based design uses composition instead of inheritance, which removes a lot of complexity from the language. This makes Aria easier to learn, your code easier to understand and maintain, and libraries more composable. Many parts of the Aria library adopt `mixin`s to bring code reuse, and you can too.
```aria
mixin Double {
func double() {
return this + this;
}
}
extension Int {
include Double
}
extension Float {
include Double
}
func main() {
println(3.double());
println(3.14.double());
}
```
Aria has a simple yet usable standard library, with date/time handling, networking, file system access, JSON support and more.
```aria
import Instant from aria.date.instant;
func main() {
val now = Instant.now();
println("The current date and time is: {0}".format(now));
}
```
```aria
import JsonValue from aria.json.parser;
func main() {
val json_data = JsonValue.parse('{"name": "Aria", "version": "0.9"}')!.flatten();
println("Language: {0}, Version: {1}".format(json_data["name"], json_data["version"]));
}
```
Aria is currently supported on Linux and macOS. Contributions for other operating systems are welcome and encouraged!
## A Taste of Aria
Aria is easy to learn. Here's a [quick example](https://github.com/arialang/aria/blob/master/examples/github_user.aria) that fetches data from a web API and prints the result.
In this example, Aria fetches user data from GitHub’s API and prints the number of public repositories for a given user. This shows how simple it is to interact with external APIs and handle dynamic data in Aria.
```aria
# github_user.aria
import Request from aria.network.request;
import JsonValue from aria.json.parser;
val whoami = "egranata";
func main() {
val request = Request.new("https://api.github.com/users/{0}".format(whoami));
request.headers["User-Agent"] = "AriaLang/1.0";
val response = request.get();
if response.status_code == 200 {
val user_data = JsonValue.parse(response.content)!.flatten();
println("User {1} has {0} public repositories.".format(user_data["public_repos"], whoami));
} else {
println("Failed to fetch user data. Status: {0}".format(response.status_code));
}
}
```
Running this is as simple as:
```shell
$ aria github_user.aria
User egranata has 5 public repositories.
```
## Getting Started
Ready to try Aria? Want to contribute to the language? Great! Whether you’re fixing bugs, adding features, or improving the documentation, we’d love your help!
If it's your first time contributing, check out [good starter bugs](https://github.com/arialang/aria/issues?q=is%3Aissue%20state%3Aopen%20label%3A%22good%20first%20issue%22) or [help wanted](https://github.com/arialang/aria/issues?q=is%3Aissue%20state%3Aopen%20label%3A%22help%20wanted%22) on GitHub.
For all this and more, visit [our website](https://arialang.github.io/)!
================================================
FILE: add_license_marker.sh
================================================
#!/bin/bash
set -euo pipefail
rust_license_comment="// SPDX-License-Identifier: Apache-2.0"
aria_license_comment="# SPDX-License-Identifier: Apache-2.0"
check_mode=false
[[ "${1:-}" == "--check" ]] && check_mode=true
missing=0
handle_file() {
local file="$1" license="$2"
if ! grep -qF "$license" "$file"; then
if $check_mode; then
echo "Missing license in $file"
missing=1
else
echo "Adding license to $file"
tmp="$(mktemp "${file}.XXXX")"
{ printf '%s\n' "$license"; cat -- "$file"; } >"$tmp"
chmod --reference="$file" "$tmp" 2>/dev/null || true
mv -f -- "$tmp" "$file"
fi
fi
}
while IFS= read -r -d '' file; do
case "$file" in
*.rs) handle_file "$file" "$rust_license_comment" ;;
*.aria) handle_file "$file" "$aria_license_comment" ;;
esac
done < <(
find . -type d -name target -prune -o \
-type f \( -name '*.rs' -o -name '*.aria' \) -print0
)
if $check_mode; then
if (( missing == 1 )); then exit 1; fi
echo "All files have license info"
fi
================================================
FILE: aria
================================================
#!/bin/sh
cargo build --workspace --profile ${ARIA_BUILD_CONFIG:-"release"}
SELF_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
ARIA_LIB_DIR=${ARIA_LIB_DIR:-"${SELF_DIR}/lib:${SELF_DIR}/lib-test"} cargo run --profile ${ARIA_BUILD_CONFIG:-"release"} --package aria-bin -- $@
================================================
FILE: aria-bin/Cargo.toml
================================================
[package]
name = "aria-bin"
version = "0.9.20251222"
edition = "2024"
[dependencies]
opcodes-lib = { path = "../opcodes-lib" }
parser-lib = { path = "../parser-lib" }
compiler-lib = { path = "../compiler-lib" }
vm-lib = { path = "../vm-lib" }
clap = { version = "4.5.57", features = ["derive"] }
ariadne = { git = "https://github.com/zesterer/ariadne.git", rev="b60b500" }
reedline = "0.45.0"
pprof = { version = "0.15.0", features = ["cpp", "default", "flamegraph", "framehop", "framehop-unwinder", "perfmaps", "_protobuf", "prost-codec"] }
[[bin]]
name = "aria"
path = "src/main.rs"
================================================
FILE: aria-bin/src/error_reporting.rs
================================================
// SPDX-License-Identifier: Apache-2.0
use std::{collections::HashMap, vec};
use aria_compiler::do_compile::CompilationError;
use aria_parser::ast::{ParserError, SourcePointer};
use ariadne::{Color, Label, Report, ReportKind, Source};
use haxby_vm::{
error::{exception::VmException, vm_error::VmError},
vm::VirtualMachine,
};
#[derive(Default, Debug, Clone)]
pub struct StringCache {
buffers: HashMap<String, Source>,
}
impl ariadne::Cache<String> for StringCache {
type Storage = String;
fn fetch(
&mut self,
path: &String,
) -> Result<&Source<<Self as ariadne::Cache<String>>::Storage>, impl std::fmt::Debug> {
Ok::<&Source, Source>(&self.buffers[path])
}
#[allow(refining_impl_trait)]
fn display<'a>(&self, path: &'a String) -> Option<impl std::fmt::Display + 'a> {
Some(Box::new((*path).clone()))
}
}
pub(crate) type PrintableReport<'a> = (
ariadne::Report<'a, (std::string::String, std::ops::Range<usize>)>,
StringCache,
);
fn build_report_from_msg_and_location<'a>(
msg: &str,
locations: Vec<SourcePointer>,
) -> PrintableReport<'a> {
let config = ariadne::Config::default().with_index_type(ariadne::IndexType::Byte);
let magenta = Color::Magenta;
let mut report = Report::build(ReportKind::Error, ("unknown".to_owned(), 0..0))
.with_message(msg)
.with_config(config);
let mut cache = StringCache::default();
for (idx, loc) in locations.iter().enumerate() {
let loc = loc.clone();
report = report.with_label(
Label::new((
loc.buffer.name.clone(),
loc.location.start..loc.location.stop,
))
.with_message("here")
.with_order(idx as i32)
.with_color(magenta),
);
if !cache.buffers.contains_key(&loc.buffer.name) {
cache.buffers.insert(
loc.buffer.name.clone(),
Source::from((*loc.buffer.content).clone()),
);
}
}
(report.finish(), cache)
}
pub(crate) fn print_report_from_vm_exception(vm: &mut VirtualMachine, exc: &VmException) {
let (report, cache) = build_report_from_vm_exception(vm, exc);
report.eprint(cache).unwrap();
}
pub(crate) fn print_report_from_compiler_error(err: &CompilationError) {
let (report, cache) = build_report_from_compiler_error(err);
report.eprint(cache).unwrap();
}
pub(crate) fn print_report_from_parser_error(err: &ParserError) {
let (report, cache) = build_report_from_parser_error(err);
report.eprint(cache).unwrap();
}
pub(crate) fn print_report_from_vm_error(err: &VmError) {
let (report, cache) = build_report_from_vm_error(err);
report.eprint(cache).unwrap();
}
pub(crate) fn build_report_from_vm_error<'a>(err: &VmError) -> PrintableReport<'a> {
let msg = err.reason.to_string();
if err.backtrace.is_empty() {
if let Some(loc) = &err.loc {
build_report_from_msg_and_location(&msg, vec![loc.clone()])
} else {
build_report_from_msg_and_location(&msg, vec![])
}
} else {
let backtraces: Vec<_> = err.backtrace.entries_iter().cloned().collect();
build_report_from_msg_and_location(&msg, backtraces)
}
}
pub(crate) fn build_report_from_vm_exception<'a>(
vm: &mut VirtualMachine,
exc: &'a VmException,
) -> PrintableReport<'a> {
let mut cur_frame = Default::default();
let msg = exc.value.prettyprint(&mut cur_frame, vm);
let backtraces: Vec<_> = exc.backtrace.entries_iter().cloned().collect();
build_report_from_msg_and_location(&msg, backtraces)
}
pub(crate) fn build_report_from_compiler_error<'a>(
err: &'a CompilationError,
) -> PrintableReport<'a> {
let msg = err.reason.to_string();
let loc = &err.loc;
build_report_from_msg_and_location(&msg, vec![loc.clone()])
}
pub(crate) fn build_report_from_parser_error<'a>(err: &'a ParserError) -> PrintableReport<'a> {
let msg = &err.msg;
let loc = &err.loc;
build_report_from_msg_and_location(msg, vec![loc.clone()])
}
================================================
FILE: aria-bin/src/error_reporting_test/expected.txt
================================================
main.aria:6:9
util.aria:3:13
main.aria:14:8
================================================
FILE: aria-bin/src/error_reporting_test/main.aria
================================================
# SPDX-License-Identifier: Apache-2.0
import foo from util;
func op(x,y) {
if x > 0 {
throw "x is positive :(";
}
return y + x;
}
func main() {
# this is reported as 6:9 (the location of the throw, not the location of the call)
# which is a bug, but I need to fix that orthogonally to this test
foo(op,3);
}
================================================
FILE: aria-bin/src/error_reporting_test/util.aria
================================================
# SPDX-License-Identifier: Apache-2.0
func foo(f, n) {
return f(3,n);
}
================================================
FILE: aria-bin/src/file_eval.rs
================================================
// SPDX-License-Identifier: Apache-2.0
use aria_compiler::{CompilationOptions, compile_from_ast};
use aria_parser::ast::{
SourceBuffer,
prettyprint::{PrettyPrintable, printout_accumulator::PrintoutAccumulator},
source_to_ast,
};
use haxby_vm::{
runtime_module::RuntimeModule,
vm::{VirtualMachine, VmOptions},
};
use crate::{
Args,
error_reporting::{
print_report_from_compiler_error, print_report_from_parser_error,
print_report_from_vm_error, print_report_from_vm_exception,
},
};
impl From<&Args> for CompilationOptions {
fn from(value: &Args) -> Self {
CompilationOptions {
optimize: !value.disable_optimizer,
dump_builder: value.dump_ir,
}
}
}
// To permit return Err(report_blah(x)) where report_blah(x) -> ()
#[allow(clippy::unit_arg)]
fn eval_buffer(
sb: SourceBuffer,
vm: &mut VirtualMachine,
args: &Args,
) -> Result<RuntimeModule, ()> {
let ast = match source_to_ast(&sb) {
Ok(ast) => ast,
Err(err) => {
return Err(print_report_from_parser_error(&err));
}
};
if args.dump_ast {
let ast_buffer = PrintoutAccumulator::default();
let output = ast.prettyprint(ast_buffer).value();
println!("AST dump:\n{output}\n");
}
let comp_opts = CompilationOptions::from(args);
let c_module = match compile_from_ast(&ast, &comp_opts) {
Ok(module) => module,
Err(err) => {
err.iter().for_each(print_report_from_compiler_error);
return Err(());
}
};
if args.dump_mod {
let mod_buffer = PrintoutAccumulator::default();
let output = c_module.prettyprint(mod_buffer).value();
println!("Module dump:\n{output}\n");
}
let r_module = match RuntimeModule::new(vm, c_module) {
Ok(m) => m,
Err(err) => {
return Err(print_report_from_vm_error(&err.into()));
}
};
let r_module = match vm.load_into_module("", r_module) {
Ok(rle) => match rle {
haxby_vm::vm::RunloopExit::Ok(m) => m.module,
haxby_vm::vm::RunloopExit::Exception(exc) => {
return Err(print_report_from_vm_exception(vm, &exc));
}
},
Err(err) => {
return Err(print_report_from_vm_error(&err));
}
};
let exec_result = vm.execute_module(&r_module);
match exec_result {
Ok(rle) => match rle {
haxby_vm::vm::RunloopExit::Ok(_) => Ok(r_module),
haxby_vm::vm::RunloopExit::Exception(exc) => {
Err(print_report_from_vm_exception(vm, &exc))
}
},
Err(err) => Err(print_report_from_vm_error(&err)),
}
}
pub(crate) fn file_eval(path: &str, args: &Args) -> i32 {
use pprof::protos::Message;
use std::io::Write;
let mut vm = VirtualMachine::with_options(VmOptions::from(args));
let guard = if args.perf_trace_dest.is_some() {
match pprof::ProfilerGuardBuilder::default()
.frequency(1000)
.blocklist(&["libc", "libgcc", "pthread", "vdso"])
.build()
{
Ok(guard) => Some(guard),
Err(err) => {
eprintln!("could not start profiler: {}", err);
return 1;
}
}
} else {
None
};
let buffer = SourceBuffer::file(path);
let exit = match buffer {
Ok(src) => match eval_buffer(src, &mut vm, args) {
Ok(_) => 0,
Err(_) => 1,
},
Err(err) => {
println!("error reading source file: {err}");
1
}
};
if let Some(guard) = guard
&& let Ok(report) = guard.report().build()
{
let mut content = Vec::new();
if let Ok(mut dest_file) = std::fs::File::create(args.perf_trace_dest.as_ref().unwrap())
&& let Ok(profile) = report.pprof()
&& let Ok(_) = profile.encode(&mut content)
{
dest_file
.write_all(&content)
.expect("could not write pprof report");
dest_file.flush().expect("could not flush pprof report");
} else {
eprintln!("could not generate pprof report");
return exit;
}
}
exit
}
================================================
FILE: aria-bin/src/main.rs
================================================
// SPDX-License-Identifier: Apache-2.0
mod error_reporting;
mod file_eval;
mod repl_eval;
#[cfg(test)]
mod test;
use clap::Parser;
use haxby_vm::vm::{VirtualMachine, VmOptions};
#[derive(Default, Parser, Debug)]
#[command(author, name = "aria", version = env!("CARGO_PKG_VERSION"), about, trailing_var_arg = true)]
struct Args {
/// The name of the program file to run
path: Option<String>,
/// The destination for the VM performance trace
#[arg(long("perf-trace-dest"))]
perf_trace_dest: Option<String>,
/// Should the VM trace instruction execution
#[arg(long("trace-exec"))]
#[cfg(debug_assertions)]
trace_exec: bool,
/// Should the VM dump the stack at each instruction
#[arg(long("trace-stack"))]
#[cfg(debug_assertions)]
trace_stack: bool,
/// Should the AST be dumped after parsing
#[arg(long("dump-ast"))]
dump_ast: bool,
/// Dump the compiler's intermediate representation
#[arg(long("dump-ir"))]
dump_ir: bool,
/// Should the module be dumped after compilation
#[arg(long("dump-module"))]
dump_mod: bool,
/// Turn off compile-time optimizations
#[arg(long("disable-optimizer"))]
disable_optimizer: bool,
#[arg(trailing_var_arg = true)]
extra_args: Vec<String>,
#[arg(long("print-lib-path"))]
print_lib_path: bool,
/// Turn off REPL preamble
#[arg(long("no-repl-preamble"))]
no_repl_preamble: bool,
}
impl From<&Args> for VmOptions {
fn from(value: &Args) -> Self {
let mut options = VmOptions::default();
#[cfg(debug_assertions)]
if value.trace_exec {
options.tracing = true;
if value.trace_stack {
options.dump_stack = true;
}
}
options.vm_args = value.extra_args.clone();
options
}
}
impl Args {
fn check(&self) -> Vec<String> {
let mut ret = vec![];
if self.path.is_some() && self.no_repl_preamble {
ret.push("--no-repl-preamble has no effect when a file path is provided".to_string());
}
if self.path.is_none() && self.perf_trace_dest.is_some() {
ret.push(
"--perf-trace-dest has no effect when a file path is not provided".to_string(),
);
}
ret
}
}
fn print_lib_paths() {
let lib_paths = VirtualMachine::get_aria_library_paths();
for path in lib_paths {
println!("{}", path.display());
}
}
fn main_loop() -> i32 {
let args = Args::parse();
if args.print_lib_path {
print_lib_paths();
return 0;
}
let checks = args.check();
if !checks.is_empty() {
for check in checks {
eprintln!("Error: {}", check);
}
return 1;
}
if let Some(path) = &args.path {
file_eval::file_eval(path, &args)
} else {
repl_eval::repl_eval(&args)
}
}
fn main() {
let exit_code = main_loop();
std::process::exit(exit_code);
}
================================================
FILE: aria-bin/src/repl_eval.rs
================================================
// SPDX-License-Identifier: Apache-2.0
use std::ops::DerefMut;
use aria_compiler::{CompilationOptions, compile_from_ast};
use aria_parser::ast::{
ExpressionStatement, SourceBuffer, TopLevelEntry,
prettyprint::{PrettyPrintable, printout_accumulator::PrintoutAccumulator},
source_to_ast,
};
use haxby_vm::{
runtime_module::RuntimeModule,
vm::{VirtualMachine, VmOptions},
};
use reedline::{DefaultPrompt, Reedline, Validator};
use crate::{
Args,
error_reporting::{
build_report_from_compiler_error, build_report_from_parser_error,
build_report_from_vm_error, build_report_from_vm_exception,
print_report_from_compiler_error, print_report_from_parser_error,
print_report_from_vm_error, print_report_from_vm_exception,
},
};
struct ReplValidator;
impl Validator for ReplValidator {
fn validate(&self, line: &str) -> reedline::ValidationResult {
use reedline::ValidationResult::{Complete, Incomplete};
let mut quote: Option<char> = None; // '" or '\''
let mut escaped = false;
let mut balance: Vec<char> = Vec::new();
let mut comment = false;
for c in line.chars() {
// inside string
if let Some(q) = quote {
if escaped {
escaped = false;
continue;
}
if c == '\\' {
escaped = true;
continue;
}
if c == q {
quote = None;
}
continue;
} else if c == '#' || comment {
comment = c != '\n';
continue;
} else {
match c {
'"' | '\'' => quote = Some(c),
'(' => balance.push(')'),
'[' => balance.push(']'),
'{' => balance.push('}'),
')' | ']' | '}' => {
if !matches!(balance.last(), Some(&need) if need == c) {
return Complete;
} else {
balance.pop();
}
}
_ => {}
}
}
}
if quote.is_none() && balance.is_empty() {
Complete
} else {
Incomplete
}
}
}
struct LineEditor {
line_editor: Reedline,
prompt: DefaultPrompt,
}
impl LineEditor {
pub fn new() -> Self {
let validator = Box::new(ReplValidator);
let prompt = DefaultPrompt {
left_prompt: reedline::DefaultPromptSegment::Empty,
right_prompt: reedline::DefaultPromptSegment::Empty,
};
#[cfg(test)]
let line_editor = Reedline::create().with_validator(validator);
#[cfg(not(test))]
let line_editor = Reedline::create()
.with_validator(validator)
.with_history(Box::new(
reedline::FileBackedHistory::with_file(1024, "history.aria".into())
.expect("history"),
));
Self {
line_editor,
prompt,
}
}
}
impl LineEditor {
fn read_input(&mut self) -> (String, bool) {
let sig = self.line_editor.read_line(&self.prompt);
match sig {
Ok(reedline::Signal::Success(buffer)) => (buffer, false),
Ok(reedline::Signal::CtrlC) | Ok(reedline::Signal::CtrlD) | Err(_) => {
(String::new(), true)
}
}
}
}
fn is_call_to_print_or_println(expr: &ExpressionStatement) -> bool {
if let Some(v) = &expr.val {
let (is_call, name) = v.is_function_call();
return is_call && matches!(name, Some("print") | Some("println"));
}
false
}
fn massage_ast_for_repl(ast: &mut aria_parser::ast::ParsedModule) -> bool {
if ast.entries.is_empty() {
return false;
}
let idx = ast.entries.len() - 1;
let TopLevelEntry::ExpressionStatement(expr) = &ast.entries[idx] else {
return false;
};
if is_call_to_print_or_println(expr) {
return false;
}
let Some(val) = &expr.val else { return false };
let new_node = val.call_function_passing_me("println");
ast.entries[idx] = TopLevelEntry::ExpressionStatement(ExpressionStatement {
loc: val.loc().clone(),
val: Some(new_node),
});
true
}
#[cfg(test)]
pub struct ReplStepResult {
pub stdout: String,
#[allow(dead_code)]
pub stderr: String,
pub ok: bool,
}
pub struct Repl<'a> {
vm: VirtualMachine,
module: RuntimeModule,
args: &'a Args,
counter: u64,
}
impl<'a> Repl<'a> {
#[allow(clippy::unit_arg)]
pub fn new(vm_options: VmOptions, args: &'a Args) -> Result<Self, ()> {
let mut vm = VirtualMachine::with_options(vm_options);
let repl_module_preamble = if args.no_repl_preamble {
""
} else {
include_str!("repl_preamble.aria")
};
let sb = SourceBuffer::stdin_with_name(repl_module_preamble, "repl");
let ast = match source_to_ast(&sb) {
Ok(ast) => ast,
Err(err) => {
return Err(print_report_from_parser_error(&err));
}
};
let comp_opts = CompilationOptions::default();
let c_module = match compile_from_ast(&ast, &comp_opts) {
Ok(module) => module,
Err(err) => {
err.iter().for_each(print_report_from_compiler_error);
return Err(());
}
};
let r_module = match RuntimeModule::new(&mut vm, c_module) {
Ok(m) => m,
Err(err) => {
return Err(print_report_from_vm_error(&err.into()));
}
};
let r_module = match vm.load_into_module("repl", r_module) {
Ok(rle) => match rle {
haxby_vm::vm::RunloopExit::Ok(m) => m.module,
haxby_vm::vm::RunloopExit::Exception(exc) => {
return Err(print_report_from_vm_exception(&mut vm, &exc));
}
},
Err(err) => {
return Err(print_report_from_vm_error(&err));
}
};
vm.inject_imported_module("repl", r_module.clone());
Ok(Repl {
vm,
module: r_module,
args,
counter: 0,
})
}
fn try_parse_source(
&mut self,
buffer: &SourceBuffer,
) -> Result<aria_parser::ast::ParsedModule, aria_parser::ast::ParserError> {
source_to_ast(buffer)
}
#[allow(clippy::unit_arg)]
pub fn process_buffer(&mut self, buffer: &str) -> Result<RuntimeModule, ()> {
let module_name: String = format!("__repl_chunk_{}", self.counter);
self.counter += 1;
let module_source_code = format!("import * from repl;\n{}\n", buffer);
let sb = SourceBuffer::stdin_with_name(&module_source_code, &module_name);
let mut parsed_source = self.try_parse_source(&sb);
if parsed_source.is_err() && !(buffer.ends_with('}') || buffer.ends_with(';')) {
let buffer_with_semicolon = format!("{};", module_source_code);
let sb2 = SourceBuffer::stdin_with_name(&buffer_with_semicolon, &module_name);
let parsed_source2 = self.try_parse_source(&sb2);
if parsed_source2.is_ok() {
parsed_source = parsed_source2;
}
}
let mut ast = match parsed_source {
Ok(ast) => ast,
Err(err) => {
return Err(self.print_error_report(build_report_from_parser_error(&err)));
}
};
let mutated = massage_ast_for_repl(&mut ast);
if self.args.dump_ast {
let ast_buffer = PrintoutAccumulator::default();
let output = ast.prettyprint(ast_buffer).value();
println!("AST dump:\n{output}\n");
if mutated {
println!("note: AST mutated for REPL purposes");
}
}
let comp_opts = CompilationOptions::default();
let c_module = match compile_from_ast(&ast, &comp_opts) {
Ok(module) => module,
Err(err) => {
err.iter()
.for_each(|e| self.print_error_report(build_report_from_compiler_error(e)));
return Err(());
}
};
if self.args.dump_mod {
let mod_buffer = PrintoutAccumulator::default();
let output = c_module.prettyprint(mod_buffer).value();
println!("Module dump:\n{output}\n");
}
let r_module = match RuntimeModule::new(&mut self.vm, c_module) {
Ok(m) => m,
Err(err) => {
return Err(self.print_error_report(build_report_from_vm_error(&err.into())));
}
};
if r_module
.lift_all_symbols_from_other(&self.module, &self.vm)
.is_err()
{
return Err(());
}
let load_result = self.vm.load_into_module("repl", r_module);
match load_result {
Ok(rle) => match rle {
haxby_vm::vm::RunloopExit::Ok(m) => {
let new_module = m.module;
let _ = self
.module
.lift_all_symbols_from_other(&new_module, &self.vm);
Ok(new_module)
}
haxby_vm::vm::RunloopExit::Exception(exc) => {
let report = build_report_from_vm_exception(&mut self.vm, &exc);
Err(self.print_error_report(report))
}
},
Err(err) => Err(self.print_error_report(build_report_from_vm_error(&err))),
}
}
fn print_error_report(&mut self, report: crate::error_reporting::PrintableReport<'_>) {
let console_rc = self.vm.console();
let mut console_borrow = console_rc.borrow_mut();
let console = console_borrow.deref_mut();
let _ = report.0.write(report.1, console);
}
#[cfg(test)]
pub fn eval_line(&mut self, src: &str) -> ReplStepResult {
fn diff(before: &str, after: &str) -> String {
if after.len() >= before.len() {
after[before.len()..].to_string()
} else {
String::new()
}
}
let before_console = self
.vm
.console()
.borrow()
.as_any()
.downcast_ref::<haxby_vm::console::TestConsole>()
.unwrap()
.clone();
let before_stdout = before_console.stdout.clone();
let before_stderr = before_console.stderr.clone();
let ok = self.process_buffer(src).is_ok();
let after_console = self
.vm
.console()
.borrow()
.as_any()
.downcast_ref::<haxby_vm::console::TestConsole>()
.unwrap()
.clone();
let after_stdout = after_console.stdout.clone();
let after_stderr = after_console.stderr.clone();
ReplStepResult {
stdout: diff(&before_stdout, &after_stdout),
stderr: diff(&before_stderr, &after_stderr),
ok,
}
}
}
pub(crate) fn repl_eval(args: &Args) -> i32 {
let vm_opts = VmOptions::from(args);
let mut repl = Repl::new(vm_opts, args).unwrap();
let mut ed = LineEditor::new();
loop {
let (input, eof) = ed.read_input();
if eof {
break;
}
let input = input.trim();
if input.is_empty() {
continue;
} else if input == ":quit" {
break;
} else {
let _ = repl.process_buffer(input);
}
}
0 // REPL will always exit 0
}
================================================
FILE: aria-bin/src/repl_preamble.aria
================================================
# SPDX-License-Identifier: Apache-2.0
import File from aria.io.file;
import Path from aria.io.path;
import Request from aria.network.request;
import Map from aria.structures.map;
import Regex from aria.string.regex;
import aria.iterator.mixin;
import aria.numerics.float.exp;
import aria.numerics.float.trig;
import aria.numerics.int.pow;
import aria.range.int_extension;
================================================
FILE: aria-bin/src/test.rs
================================================
// SPDX-License-Identifier: Apache-2.0
use std::{cell::RefCell, rc::Rc};
use haxby_vm::console::TestConsole;
use crate::{Args, repl_eval::Repl};
fn build_test_repl<'a>(cmdline_options: &'a Args) -> Repl<'a> {
let console = Rc::new(RefCell::new(TestConsole::default()));
let vm_options = haxby_vm::vm::VmOptions {
console: console.clone(),
..Default::default()
};
Repl::new(vm_options, cmdline_options).unwrap()
}
fn run_check_repl_line(
repl: &mut Repl,
line: &str,
ok: bool,
must_include_stdout: &[&str],
must_include_stderr: &[&str],
) {
let diff = repl.eval_line(line);
assert!(diff.ok == ok);
for expected in must_include_stdout {
assert!(
diff.stdout.contains(expected),
"stdout ( {} ) did not contain expected ( {} )",
diff.stdout,
expected
);
}
for expected in must_include_stderr {
assert!(
diff.stderr.contains(expected),
"stderr ( {} ) did not contain expected ( {} )",
diff.stderr,
expected
);
}
}
fn run_passing_repl_line(repl: &mut Repl, line: &str, must_include_stdout: &[&str]) {
run_check_repl_line(repl, line, true, must_include_stdout, &[])
}
#[test]
fn repl_can_print_integers() {
let cmdline_options = Args::default();
let mut repl = build_test_repl(&cmdline_options);
run_passing_repl_line(&mut repl, "42;", &["42"]);
run_passing_repl_line(&mut repl, "3 + 4;", &["7"]);
}
#[test]
fn repl_can_call_functions() {
let cmdline_options = Args::default();
let mut repl = build_test_repl(&cmdline_options);
run_passing_repl_line(&mut repl, "func foo(x) { return x + 1; }", &[]);
run_passing_repl_line(&mut repl, "foo(12);", &["13"]);
}
#[test]
fn repl_can_define_structs() {
let cmdline_options = Args::default();
let mut repl = build_test_repl(&cmdline_options);
run_passing_repl_line(
&mut repl,
r#"
struct Pair {
type func new(x,y) {
return alloc(This) {
.x = x, .y = y,
};
}
}
"#,
&[],
);
run_passing_repl_line(&mut repl, "val p = Pair.new(4,5);", &[]);
run_passing_repl_line(
&mut repl,
r#"
extension Pair {
func prettyprint() {
return "Pair({0},{1})".format(this.x,this.y);
}
}
"#,
&[],
);
run_passing_repl_line(&mut repl, "p;", &["Pair(4,5)"]);
}
#[test]
fn repl_can_use_if_statement() {
let cmdline_options = Args::default();
let mut repl = build_test_repl(&cmdline_options);
run_passing_repl_line(&mut repl, "val x = 4;", &[]);
run_passing_repl_line(&mut repl, "if (x > 2) { println(x + 1); }", &["5"]);
run_passing_repl_line(&mut repl, "if (x > 4) { println(x + 1); }", &[""]);
}
#[test]
fn repl_can_use_for_statement() {
let cmdline_options = Args::default();
let mut repl = build_test_repl(&cmdline_options);
run_passing_repl_line(&mut repl, "val l = [1,2,3,4,5,6];", &[]);
run_passing_repl_line(
&mut repl,
"for i in l { println(i); }",
&["1", "2", "3", "4", "5", "6"],
);
}
#[test]
fn repl_can_use_while_statement() {
let cmdline_options = Args::default();
let mut repl = build_test_repl(&cmdline_options);
run_passing_repl_line(&mut repl, "val n = 10;", &[]);
run_passing_repl_line(
&mut repl,
"while n > 0 { n -= 2; println(n); }",
&["8", "6", "4", "2", "0"],
);
}
#[test]
fn repl_can_use_match_statement() {
let cmdline_options = Args::default();
let mut repl = build_test_repl(&cmdline_options);
run_passing_repl_line(&mut repl, "val n = 10;", &[]);
run_passing_repl_line(
&mut repl,
r#"
match n {
> 10 => {
println("Greater than 10");
}
} else {
println("10 or less");
}
"#,
&["10 or less"],
);
}
#[test]
fn repl_printout_maybe() {
let cmdline_options = Args::default();
let mut repl = build_test_repl(&cmdline_options);
run_passing_repl_line(
&mut repl,
r#"
struct Pair {
type func new(x,y) {
return alloc(This) {
.x = x, .y = y,
};
}
func prettyprint() {
return "Pair({0},{1})".format(this.x,this.y);
}
}
"#,
&[""],
);
run_passing_repl_line(
&mut repl,
"Maybe::Some(Pair.new(4,5));",
&["Some(Pair(4,5))"],
);
run_passing_repl_line(&mut repl, "Maybe::None;", &["None"]);
}
#[test]
fn repl_adds_semicolon() {
let cmdline_options = Args::default();
let mut repl = build_test_repl(&cmdline_options);
run_passing_repl_line(&mut repl, "val x = 1", &[]);
run_passing_repl_line(&mut repl, "val y = 2", &[]);
run_passing_repl_line(&mut repl, "2 * y + x", &["5"]);
}
#[test]
fn repl_preamble_works() {
let cmdline_options = Args::default();
let mut repl = build_test_repl(&cmdline_options);
run_passing_repl_line(&mut repl, "3.pow(2)", &["9"]);
run_passing_repl_line(&mut repl, "val m = Map.new(); m[1] = 'one'; m[1]", &["one"]);
run_passing_repl_line(&mut repl, "m.get(4)", &["None"]);
}
#[test]
fn repl_skips_preamble() {
let cmdline_options = Args {
no_repl_preamble: true,
..Default::default()
};
let mut repl = build_test_repl(&cmdline_options);
run_check_repl_line(
&mut repl,
"3.pow(2)",
false,
&["identifier 'pow' not found"],
&[],
);
}
#[test]
fn repl_op_count_error() {
let cmdline_options = Args {
no_repl_preamble: true,
..Default::default()
};
let mut repl = build_test_repl(&cmdline_options);
run_check_repl_line(
&mut repl,
"struct Foo { operator[]=() { return 1; } }",
false,
&["operator []= accepts at least 1 arguments, but 0 were declared"],
&[],
);
run_check_repl_line(
&mut repl,
"struct Foo { operator + (a,b,c) { return 1; } }",
false,
&["operator + accepts exactly 1 arguments, but 3 were declared"],
&[],
);
}
#[test]
fn repl_test_printf() {
let cmdline_options = Args::default();
let mut repl = build_test_repl(&cmdline_options);
run_passing_repl_line(&mut repl, "'hello = {0}'.printf(42);", &["hello = 42"]);
run_passing_repl_line(
&mut repl,
"'hello = {0} hi = {1}\n'.printf(42, 43);",
&["hello = 42 hi = 43\n"],
);
}
#[test]
fn repl_test_invalid_literal() {
let cmdline_options = Args::default();
let mut repl = build_test_repl(&cmdline_options);
run_check_repl_line(
&mut repl,
"0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF",
false,
&["0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF is not a valid literal"],
&[],
);
}
#[test]
fn repl_allows_comments() {
let cmdline_options = Args::default();
let mut repl = build_test_repl(&cmdline_options);
run_passing_repl_line(
&mut repl,
r#"
func foo() {
# this is a comment
return # this is another comment
(
12345 # comment after expression
);
}
"#,
&[],
);
run_passing_repl_line(&mut repl, "foo();", &["12345"]);
}
#[test]
fn repl_handles_hashtag_in_string() {
let cmdline_options = Args::default();
let mut repl = build_test_repl(&cmdline_options);
run_passing_repl_line(
&mut repl,
r#"
func foo() {
# this is a comment
return '#arialang';
}
"#,
&[],
);
run_passing_repl_line(&mut repl, "foo();", &["#arialang"]);
}
#[test]
fn repl_test_oneof_from_empty_list() {
let cmdline_options = Args::default();
let mut repl = build_test_repl(&cmdline_options);
run_check_repl_line(
&mut repl,
r#"
import XorshiftRng from aria.rng.xorshift;
val x = XorshiftRng.new();
x.one_of([])
"#,
false,
&["operation failed: cannot choose from empty list"],
&[],
);
}
#[test]
fn repl_includes_ranges() {
let cmdline_options = Args::default();
let mut repl = build_test_repl(&cmdline_options);
run_passing_repl_line(
&mut repl,
r#"
val x = 0;
for i in 0.to(5) { x += i; }
"i = {0}\n".printf(x);
"#,
&["i = 10"],
);
}
================================================
FILE: aria-bin/test_assert.aria
================================================
# SPDX-License-Identifier: Apache-2.0
func foo() {
assert false;
}
func main() {
return foo();
}
================================================
FILE: aria-bin/test_uncaught_exception.aria
================================================
# SPDX-License-Identifier: Apache-2.0
func foo() {
return 3 / 0;
}
func main() {
return foo();
}
================================================
FILE: b
================================================
#!/usr/bin/env bash
set -e
print_usage() {
echo "Usage: $0 <command> <bench>"
echo "command: bench, micro, perf, time, valgrind"
echo "bench: Name or partial name of the benchmark to run"
}
COMMAND=$1
BENCH=$2
if [ -z "$COMMAND" ]; then
print_usage
exit 1
fi
SELF_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ARIA_BUILD_CONFIG="${ARIA_BUILD_CONFIG:-release}"
CPU_AFFINITY_MASK="${CPU_AFFINITY_MASK:-0x1}"
if [ -z "${ARIA_EXECUTABLE:-}" ]; then
cargo build --profile "$ARIA_BUILD_CONFIG" --bin aria
TARGET_DIR=$(cd "$SELF_DIR" && cargo metadata --format-version 1 --no-deps 2>/dev/null | jq -r '.target_directory // empty' 2>/dev/null || true)
if [ -z "$TARGET_DIR" ]; then
TARGET_DIR="${SELF_DIR}/../target"
fi
ARIA_EXECUTABLE="${TARGET_DIR}/${ARIA_BUILD_CONFIG}/aria"
fi
export ARIA_EXECUTABLE
ARIA_LIB_DIR="${ARIA_LIB_DIR:-${SELF_DIR}/lib:${SELF_DIR}/lib-test}"
export ARIA_LIB_DIR="$ARIA_LIB_DIR"
if [ "$COMMAND" = "bench" ]; then
cargo bench --profile "$ARIA_BUILD_CONFIG" --package vm-lib "$BENCH"
elif [ "$COMMAND" = "micro" ]; then
if [ ! -f "$BENCH" ]; then
BENCH="${SELF_DIR}/microbenchmarks/${BENCH}.aria"
fi
ARIA_LIB_DIR="${ARIA_LIB_DIR}:${SELF_DIR}/microbenchmarks"
export ARIA_LIB_DIR
if command -v taskset >/dev/null 2>&1; then
exec taskset "$CPU_AFFINITY_MASK" "${ARIA_EXECUTABLE}" "$BENCH" "${@:3}"
else
exec "${ARIA_EXECUTABLE}" "$BENCH" "${@:3}"
fi
else
OUTPUT=$(cargo bench --no-run --profile "$ARIA_BUILD_CONFIG" --package vm-lib "$BENCH" 2>&1)
echo "$OUTPUT"
EXECUTABLE_PATH=$(echo "$OUTPUT" | grep "^ Executable" | tail -n1 | awk '{gsub(/[()]/,"",$NF); print $NF}')
case "$COMMAND" in
perf)
echo "Running with perf..."
perf record -g "$EXECUTABLE_PATH" "$BENCH"
;;
valgrind)
echo "Running with Valgrind Callgrind..."
ulimit -n 4096
valgrind --tool=callgrind "$EXECUTABLE_PATH" "$BENCH"
;;
time)
echo "Running with time..."
time "$EXECUTABLE_PATH" "$BENCH"
;;
*)
echo "Invalid command"
print_usage
exit 1
;;
esac
fi
================================================
FILE: ci_tests.sh
================================================
#!/usr/bin/env bash
set -e
SELF_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
${SELF_DIR}/t --sequential
================================================
FILE: compiler-lib/Cargo.toml
================================================
[package]
name = "compiler-lib"
version = "0.9.20251222"
edition = "2024"
[lib]
name = "aria_compiler"
path = "src/lib.rs"
[dependencies]
pest = "2.8.5"
pest_derive = "2.8.5"
opcodes-lib = { path = "../opcodes-lib" }
parser-lib = { path = "../parser-lib" }
enum-as-inner = "0.7.0"
thiserror = "2.0.18"
lazy_static = "1.5.0"
================================================
FILE: compiler-lib/src/bc_reader.rs
================================================
// SPDX-License-Identifier: Apache-2.0
use haxby_opcodes::{BuiltinTypeId, BuiltinValueId, Opcode};
pub struct BytecodeReader {
data: Vec<u8>,
idx: usize,
}
impl TryFrom<&[u8]> for BytecodeReader {
type Error = DecodeError;
fn try_from(value: &[u8]) -> Result<Self, Self::Error> {
if value.len() > u16::MAX as usize {
Err(DecodeError::DataTooLarge)
} else {
Ok(Self {
data: value.to_vec(),
idx: 0,
})
}
}
}
#[derive(Clone, thiserror::Error, PartialEq, Eq, Debug)]
pub enum DecodeError {
#[error("bytecode exceeds maximum allowed size")]
DataTooLarge,
#[error("reached end of stream")]
EndOfStream,
#[error("insufficient data for decoding")]
InsufficientData,
#[error("{0} is not a known opcode")]
UnknownOpcode(u8),
#[error("{1} is not a valid operand for opcode {0}")]
UnknownOperand(u8, u8),
}
pub type DecodeResult<T> = Result<T, DecodeError>;
impl BytecodeReader {
#[inline]
fn read_u8(&mut self) -> DecodeResult<u8> {
if self.idx < self.data.len() {
let val = self.data[self.idx];
self.idx += 1;
Ok(val)
} else {
Err(DecodeError::EndOfStream)
}
}
#[inline]
fn read_u16(&mut self) -> DecodeResult<u16> {
if self.idx + 1 < self.data.len() {
let val = u16::from_le_bytes([self.data[self.idx], self.data[self.idx + 1]]);
self.idx += 2;
Ok(val)
} else {
Err(DecodeError::EndOfStream)
}
}
#[inline]
fn read_u32(&mut self) -> DecodeResult<u32> {
if self.idx + 3 < self.data.len() {
let val = u32::from_le_bytes([
self.data[self.idx],
self.data[self.idx + 1],
self.data[self.idx + 2],
self.data[self.idx + 3],
]);
self.idx += 4;
Ok(val)
} else {
Err(DecodeError::EndOfStream)
}
}
pub fn jump_to_index(&mut self, idx: usize) {
self.idx = idx;
}
pub fn get_index(&self) -> usize {
self.idx
}
pub fn read_opcode(&mut self) -> DecodeResult<Opcode> {
let next = self.read_u8()?;
match next {
haxby_opcodes::OPCODE_NOP => Ok(Opcode::Nop),
haxby_opcodes::OPCODE_PUSH => self
.read_u16()
.map_or(Err(DecodeError::InsufficientData), |b| Ok(Opcode::Push(b))),
haxby_opcodes::OPCODE_PUSH_0 => Ok(Opcode::Push0),
haxby_opcodes::OPCODE_PUSH_1 => Ok(Opcode::Push1),
haxby_opcodes::OPCODE_PUSH_TRUE => Ok(Opcode::PushTrue),
haxby_opcodes::OPCODE_PUSH_FALSE => Ok(Opcode::PushFalse),
haxby_opcodes::OPCODE_PUSH_BUILTIN_TYPE => {
let arg0 = match self.read_u8() {
Ok(b) => b,
Err(_) => {
return Err(DecodeError::InsufficientData);
}
};
let bt_id = match BuiltinTypeId::try_from(arg0) {
Ok(id) => id,
Err(_) => {
return Err(DecodeError::UnknownOperand(next, arg0));
}
};
Ok(Opcode::PushBuiltinTy(bt_id))
}
haxby_opcodes::OPCODE_PUSH_RUNTIME_VALUE => {
let arg0 = match self.read_u8() {
Ok(b) => b,
Err(_) => {
return Err(DecodeError::InsufficientData);
}
};
let bt_id = match BuiltinValueId::try_from(arg0) {
Ok(id) => id,
Err(_) => {
return Err(DecodeError::UnknownOperand(next, arg0));
}
};
Ok(Opcode::PushRuntimeValue(bt_id))
}
haxby_opcodes::OPCODE_POP => Ok(Opcode::Pop),
haxby_opcodes::OPCODE_DUP => Ok(Opcode::Dup),
haxby_opcodes::OPCODE_SWAP => Ok(Opcode::Swap),
haxby_opcodes::OPCODE_COPY => self
.read_u8()
.map_or(Err(DecodeError::InsufficientData), |b| Ok(Opcode::Copy(b))),
haxby_opcodes::OPCODE_ADD => Ok(Opcode::Add),
haxby_opcodes::OPCODE_SUB => Ok(Opcode::Sub),
haxby_opcodes::OPCODE_MUL => Ok(Opcode::Mul),
haxby_opcodes::OPCODE_DIV => Ok(Opcode::Div),
haxby_opcodes::OPCODE_REM => Ok(Opcode::Rem),
haxby_opcodes::OPCODE_EQ => Ok(Opcode::Equal),
haxby_opcodes::OPCODE_GT => Ok(Opcode::GreaterThan),
haxby_opcodes::OPCODE_LT => Ok(Opcode::LessThan),
haxby_opcodes::OPCODE_GTE => Ok(Opcode::GreaterThanEqual),
haxby_opcodes::OPCODE_LTE => Ok(Opcode::LessThanEqual),
haxby_opcodes::OPCODE_NEG => Ok(Opcode::Neg),
haxby_opcodes::OPCODE_SHL => Ok(Opcode::ShiftLeft),
haxby_opcodes::OPCODE_SHR => Ok(Opcode::ShiftRight),
haxby_opcodes::OPCODE_NOT => Ok(Opcode::Not),
haxby_opcodes::OPCODE_READ_LOCAL => self
.read_u8()
.map_or(Err(DecodeError::InsufficientData), |b| {
Ok(Opcode::ReadLocal(b))
}),
haxby_opcodes::OPCODE_WRITE_LOCAL => self
.read_u8()
.map_or(Err(DecodeError::InsufficientData), |b| {
Ok(Opcode::WriteLocal(b))
}),
haxby_opcodes::OPCODE_TYPEDEF_LOCAL => self
.read_u8()
.map_or(Err(DecodeError::InsufficientData), |b| {
Ok(Opcode::TypedefLocal(b))
}),
haxby_opcodes::OPCODE_READ_NAMED => self
.read_u16()
.map_or(Err(DecodeError::InsufficientData), |b| {
Ok(Opcode::ReadNamed(b))
}),
haxby_opcodes::OPCODE_WRITE_NAMED => self
.read_u16()
.map_or(Err(DecodeError::InsufficientData), |b| {
Ok(Opcode::WriteNamed(b))
}),
haxby_opcodes::OPCODE_TYPEDEF_NAMED => self
.read_u16()
.map_or(Err(DecodeError::InsufficientData), |b| {
Ok(Opcode::TypedefNamed(b))
}),
haxby_opcodes::OPCODE_READ_INDEX => self
.read_u8()
.map_or(Err(DecodeError::InsufficientData), |b| {
Ok(Opcode::ReadIndex(b))
}),
haxby_opcodes::OPCODE_WRITE_INDEX => self
.read_u8()
.map_or(Err(DecodeError::InsufficientData), |b| {
Ok(Opcode::WriteIndex(b))
}),
haxby_opcodes::OPCODE_READ_ATTRIBUTE => self
.read_u16()
.map_or(Err(DecodeError::InsufficientData), |b| {
Ok(Opcode::ReadAttribute(b))
}),
haxby_opcodes::OPCODE_WRITE_ATTRIBUTE => self
.read_u16()
.map_or(Err(DecodeError::InsufficientData), |b| {
Ok(Opcode::WriteAttribute(b))
}),
haxby_opcodes::OPCODE_READ_ATTRIBUTE_SYMBOL => self
.read_u32()
.map_or(Err(DecodeError::InsufficientData), |b| {
Ok(Opcode::ReadAttributeSymbol(b))
}),
haxby_opcodes::OPCODE_WRITE_ATTRIBUTE_SYMBOL => self
.read_u32()
.map_or(Err(DecodeError::InsufficientData), |b| {
Ok(Opcode::WriteAttributeSymbol(b))
}),
haxby_opcodes::OPCODE_READ_UPLEVEL => self
.read_u8()
.map_or(Err(DecodeError::InsufficientData), |b| {
Ok(Opcode::ReadUplevel(b))
}),
haxby_opcodes::OPCODE_LOGICAL_AND => Ok(Opcode::LogicalAnd),
haxby_opcodes::OPCODE_LOGICAL_OR => Ok(Opcode::LogicalOr),
haxby_opcodes::OPCODE_XOR => Ok(Opcode::Xor),
haxby_opcodes::OPCODE_BITWISE_AND => Ok(Opcode::BitwiseAnd),
haxby_opcodes::OPCODE_BITWISE_OR => Ok(Opcode::BitwiseOr),
haxby_opcodes::OPCODE_JUMP_TRUE => self
.read_u16()
.map_or(Err(DecodeError::InsufficientData), |b| {
Ok(Opcode::JumpTrue(b))
}),
haxby_opcodes::OPCODE_JUMP_FALSE => self
.read_u16()
.map_or(Err(DecodeError::InsufficientData), |b| {
Ok(Opcode::JumpFalse(b))
}),
haxby_opcodes::OPCODE_JUMP => self
.read_u16()
.map_or(Err(DecodeError::InsufficientData), |b| Ok(Opcode::Jump(b))),
haxby_opcodes::OPCODE_JUMP_CONDITIONALLY => {
let arg0 = match self.read_u16() {
Ok(b) => b,
Err(_) => {
return Err(DecodeError::InsufficientData);
}
};
let arg1 = match self.read_u16() {
Ok(w) => w,
Err(_) => {
return Err(DecodeError::InsufficientData);
}
};
Ok(Opcode::JumpConditionally(arg0, arg1))
}
haxby_opcodes::OPCODE_JUMP_IF_ARG_SUPPLIED => {
let arg0 = match self.read_u8() {
Ok(b) => b,
Err(_) => {
return Err(DecodeError::InsufficientData);
}
};
let arg1 = match self.read_u16() {
Ok(w) => w,
Err(_) => {
return Err(DecodeError::InsufficientData);
}
};
Ok(Opcode::JumpIfArgSupplied(arg0, arg1))
}
haxby_opcodes::OPCODE_CALL => self
.read_u8()
.map_or(Err(DecodeError::InsufficientData), |b| Ok(Opcode::Call(b))),
haxby_opcodes::OPCODE_RETURN => Ok(Opcode::Return),
haxby_opcodes::OPCODE_RETURN_UNIT => Ok(Opcode::ReturnUnit),
haxby_opcodes::OPCODE_TRY_ENTER => self
.read_u16()
.map_or(Err(DecodeError::InsufficientData), |b| {
Ok(Opcode::TryEnter(b))
}),
haxby_opcodes::OPCODE_TRY_EXIT => Ok(Opcode::TryExit),
haxby_opcodes::OPCODE_THROW => Ok(Opcode::Throw),
haxby_opcodes::OPCODE_BUILD_LIST => self
.read_u32()
.map_or(Err(DecodeError::InsufficientData), |b| {
Ok(Opcode::BuildList(b))
}),
haxby_opcodes::OPCODE_BUILD_FUNCTION => Ok(Opcode::BuildFunction),
haxby_opcodes::OPCODE_STORE_UPLEVEL => self
.read_u8()
.map_or(Err(DecodeError::InsufficientData), |b| {
Ok(Opcode::StoreUplevel(b))
}),
haxby_opcodes::OPCODE_BUILD_STRUCT => Ok(Opcode::BuildStruct),
haxby_opcodes::OPCODE_BUILD_ENUM => Ok(Opcode::BuildEnum),
haxby_opcodes::OPCODE_BUILD_MIXIN => Ok(Opcode::BuildMixin),
haxby_opcodes::OPCODE_BIND_CASE => {
let b0 = match self.read_u8() {
Ok(b) => b,
Err(_) => {
return Err(DecodeError::InsufficientData);
}
};
let w1 = match self.read_u16() {
Ok(w) => w,
Err(_) => {
return Err(DecodeError::InsufficientData);
}
};
Ok(Opcode::BindCase(b0, w1))
}
haxby_opcodes::OPCODE_BIND_CASE_SYMBOL => {
let b0 = match self.read_u8() {
Ok(b) => b,
Err(_) => {
return Err(DecodeError::InsufficientData);
}
};
let w1 = match self.read_u32() {
Ok(w) => w,
Err(_) => {
return Err(DecodeError::InsufficientData);
}
};
Ok(Opcode::BindCaseSymbol(b0, w1))
}
haxby_opcodes::OPCODE_INCLUDE_MIXIN => Ok(Opcode::IncludeMixin),
haxby_opcodes::OPCODE_NEW_ENUM_VAL => {
let b0 = match self.read_u8() {
Ok(b) => b,
Err(_) => {
return Err(DecodeError::InsufficientData);
}
};
let w1 = match self.read_u16() {
Ok(w) => w,
Err(_) => {
return Err(DecodeError::InsufficientData);
}
};
Ok(Opcode::NewEnumVal(b0, w1))
}
haxby_opcodes::OPCODE_ENUM_CHECK_IS_CASE => self
.read_u16()
.map_or(Err(DecodeError::InsufficientData), |b| {
Ok(Opcode::EnumCheckIsCase(b))
}),
haxby_opcodes::OPCODE_NEW_ENUM_VAL_SYMBOL => {
let b0 = match self.read_u8() {
Ok(b) => b,
Err(_) => {
return Err(DecodeError::InsufficientData);
}
};
let w1 = match self.read_u32() {
Ok(w) => w,
Err(_) => {
return Err(DecodeError::InsufficientData);
}
};
Ok(Opcode::NewEnumValSymbol(b0, w1))
}
haxby_opcodes::OPCODE_ENUM_CHECK_IS_CASE_SYMBOL => self
.read_u32()
.map_or(Err(DecodeError::InsufficientData), |b| {
Ok(Opcode::EnumCheckIsCaseSymbol(b))
}),
haxby_opcodes::OPCODE_ENUM_TRY_EXTRACT_PAYLOAD => Ok(Opcode::EnumTryExtractPayload),
haxby_opcodes::OPCODE_TRY_UNWRAP_PROTOCOL => self
.read_u8()
.map_or(Err(DecodeError::InsufficientData), |b| {
Ok(Opcode::TryUnwrapProtocol(b))
}),
haxby_opcodes::OPCODE_ISA => Ok(Opcode::Isa),
haxby_opcodes::OPCODE_IMPORT => self
.read_u16()
.map_or(Err(DecodeError::InsufficientData), |b| {
Ok(Opcode::Import(b))
}),
haxby_opcodes::OPCODE_LIFT_MODULE => Ok(Opcode::LiftModule),
haxby_opcodes::OPCODE_LOAD_DYLIB => self
.read_u16()
.map_or(Err(DecodeError::InsufficientData), |b| {
Ok(Opcode::LoadDylib(b))
}),
haxby_opcodes::OPCODE_ASSERT => self
.read_u16()
.map_or(Err(DecodeError::InsufficientData), |b| {
Ok(Opcode::Assert(b))
}),
haxby_opcodes::OPCODE_HALT => Ok(Opcode::Halt),
_ => Err(DecodeError::UnknownOpcode(next)),
}
}
pub fn len(&self) -> usize {
self.data.len()
}
pub fn is_empty(&self) -> bool {
self.data.is_empty()
}
}
================================================
FILE: compiler-lib/src/bc_writer.rs
================================================
// SPDX-License-Identifier: Apache-2.0
use haxby_opcodes::Opcode;
#[derive(Default)]
pub(crate) struct BytecodeWriter {
data: Vec<u8>,
}
impl BytecodeWriter {
fn write_u8(&mut self, val: u8) -> &mut Self {
self.data.push(val);
self
}
fn write_u16(&mut self, val: u16) -> &mut Self {
let bytes = val.to_le_bytes();
self.write_u8(bytes[0]).write_u8(bytes[1])
}
fn write_u32(&mut self, val: u32) -> &mut Self {
let bytes = val.to_le_bytes();
self.write_u8(bytes[0])
.write_u8(bytes[1])
.write_u8(bytes[2])
.write_u8(bytes[3])
}
pub(crate) fn write_opcode(&mut self, op: &Opcode) -> &mut Self {
match op {
Opcode::Nop => self.write_u8(haxby_opcodes::OPCODE_NOP),
Opcode::Push(n) => self.write_u8(haxby_opcodes::OPCODE_PUSH).write_u16(*n),
Opcode::Push0 => self.write_u8(haxby_opcodes::OPCODE_PUSH_0),
Opcode::Push1 => self.write_u8(haxby_opcodes::OPCODE_PUSH_1),
Opcode::PushTrue => self.write_u8(haxby_opcodes::OPCODE_PUSH_TRUE),
Opcode::PushFalse => self.write_u8(haxby_opcodes::OPCODE_PUSH_FALSE),
Opcode::PushBuiltinTy(n) => self
.write_u8(haxby_opcodes::OPCODE_PUSH_BUILTIN_TYPE)
.write_u8(n.to_u8()),
Opcode::PushRuntimeValue(n) => self
.write_u8(haxby_opcodes::OPCODE_PUSH_RUNTIME_VALUE)
.write_u8(n.to_u8()),
Opcode::Pop => self.write_u8(haxby_opcodes::OPCODE_POP),
Opcode::Dup => self.write_u8(haxby_opcodes::OPCODE_DUP),
Opcode::Swap => self.write_u8(haxby_opcodes::OPCODE_SWAP),
Opcode::Copy(n) => self.write_u8(haxby_opcodes::OPCODE_COPY).write_u8(*n),
Opcode::Add => self.write_u8(haxby_opcodes::OPCODE_ADD),
Opcode::Sub => self.write_u8(haxby_opcodes::OPCODE_SUB),
Opcode::Mul => self.write_u8(haxby_opcodes::OPCODE_MUL),
Opcode::Div => self.write_u8(haxby_opcodes::OPCODE_DIV),
Opcode::Rem => self.write_u8(haxby_opcodes::OPCODE_REM),
Opcode::Neg => self.write_u8(haxby_opcodes::OPCODE_NEG),
Opcode::ShiftLeft => self.write_u8(haxby_opcodes::OPCODE_SHL),
Opcode::ShiftRight => self.write_u8(haxby_opcodes::OPCODE_SHR),
Opcode::Not => self.write_u8(haxby_opcodes::OPCODE_NOT),
Opcode::Equal => self.write_u8(haxby_opcodes::OPCODE_EQ),
Opcode::ReadLocal(n) => self.write_u8(haxby_opcodes::OPCODE_READ_LOCAL).write_u8(*n),
Opcode::WriteLocal(n) => self
.write_u8(haxby_opcodes::OPCODE_WRITE_LOCAL)
.write_u8(*n),
Opcode::TypedefLocal(n) => self
.write_u8(haxby_opcodes::OPCODE_TYPEDEF_LOCAL)
.write_u8(*n),
Opcode::ReadNamed(n) => self
.write_u8(haxby_opcodes::OPCODE_READ_NAMED)
.write_u16(*n),
Opcode::WriteNamed(n) => self
.write_u8(haxby_opcodes::OPCODE_WRITE_NAMED)
.write_u16(*n),
Opcode::TypedefNamed(n) => self
.write_u8(haxby_opcodes::OPCODE_TYPEDEF_NAMED)
.write_u16(*n),
Opcode::ReadIndex(n) => self.write_u8(haxby_opcodes::OPCODE_READ_INDEX).write_u8(*n),
Opcode::WriteIndex(n) => self
.write_u8(haxby_opcodes::OPCODE_WRITE_INDEX)
.write_u8(*n),
Opcode::ReadAttribute(n) => self
.write_u8(haxby_opcodes::OPCODE_READ_ATTRIBUTE)
.write_u16(*n),
Opcode::WriteAttribute(n) => self
.write_u8(haxby_opcodes::OPCODE_WRITE_ATTRIBUTE)
.write_u16(*n),
Opcode::ReadAttributeSymbol(n) => self
.write_u8(haxby_opcodes::OPCODE_READ_ATTRIBUTE_SYMBOL)
.write_u32(*n),
Opcode::WriteAttributeSymbol(n) => self
.write_u8(haxby_opcodes::OPCODE_WRITE_ATTRIBUTE_SYMBOL)
.write_u32(*n),
Opcode::ReadUplevel(n) => self
.write_u8(haxby_opcodes::OPCODE_READ_UPLEVEL)
.write_u8(*n),
Opcode::LogicalAnd => self.write_u8(haxby_opcodes::OPCODE_LOGICAL_AND),
Opcode::LogicalOr => self.write_u8(haxby_opcodes::OPCODE_LOGICAL_OR),
Opcode::Xor => self.write_u8(haxby_opcodes::OPCODE_XOR),
Opcode::BitwiseAnd => self.write_u8(haxby_opcodes::OPCODE_BITWISE_AND),
Opcode::BitwiseOr => self.write_u8(haxby_opcodes::OPCODE_BITWISE_OR),
Opcode::GreaterThan => self.write_u8(haxby_opcodes::OPCODE_GT),
Opcode::LessThan => self.write_u8(haxby_opcodes::OPCODE_LT),
Opcode::GreaterThanEqual => self.write_u8(haxby_opcodes::OPCODE_GTE),
Opcode::LessThanEqual => self.write_u8(haxby_opcodes::OPCODE_LTE),
Opcode::JumpTrue(n) => self.write_u8(haxby_opcodes::OPCODE_JUMP_TRUE).write_u16(*n),
Opcode::JumpFalse(n) => self
.write_u8(haxby_opcodes::OPCODE_JUMP_FALSE)
.write_u16(*n),
Opcode::Jump(n) => self.write_u8(haxby_opcodes::OPCODE_JUMP).write_u16(*n),
Opcode::JumpConditionally(t, f) => self
.write_u8(haxby_opcodes::OPCODE_JUMP_CONDITIONALLY)
.write_u16(*t)
.write_u16(*f),
Opcode::JumpIfArgSupplied(n, d) => self
.write_u8(haxby_opcodes::OPCODE_JUMP_IF_ARG_SUPPLIED)
.write_u8(*n)
.write_u16(*d),
Opcode::Call(n) => self.write_u8(haxby_opcodes::OPCODE_CALL).write_u8(*n),
Opcode::Return => self.write_u8(haxby_opcodes::OPCODE_RETURN),
Opcode::ReturnUnit => self.write_u8(haxby_opcodes::OPCODE_RETURN_UNIT),
Opcode::TryEnter(n) => self.write_u8(haxby_opcodes::OPCODE_TRY_ENTER).write_u16(*n),
Opcode::TryExit => self.write_u8(haxby_opcodes::OPCODE_TRY_EXIT),
Opcode::Throw => self.write_u8(haxby_opcodes::OPCODE_THROW),
Opcode::BuildList(n) => self
.write_u8(haxby_opcodes::OPCODE_BUILD_LIST)
.write_u32(*n),
Opcode::BuildFunction => self.write_u8(haxby_opcodes::OPCODE_BUILD_FUNCTION),
Opcode::StoreUplevel(n) => self
.write_u8(haxby_opcodes::OPCODE_STORE_UPLEVEL)
.write_u8(*n),
Opcode::BuildStruct => self.write_u8(haxby_opcodes::OPCODE_BUILD_STRUCT),
Opcode::BuildMixin => self.write_u8(haxby_opcodes::OPCODE_BUILD_MIXIN),
Opcode::BuildEnum => self.write_u8(haxby_opcodes::OPCODE_BUILD_ENUM),
Opcode::BindCase(a, n) => self
.write_u8(haxby_opcodes::OPCODE_BIND_CASE)
.write_u8(*a)
.write_u16(*n),
Opcode::BindCaseSymbol(a, n) => self
.write_u8(haxby_opcodes::OPCODE_BIND_CASE_SYMBOL)
.write_u8(*a)
.write_u32(*n),
Opcode::IncludeMixin => self.write_u8(haxby_opcodes::OPCODE_INCLUDE_MIXIN),
Opcode::NewEnumVal(a, n) => self
.write_u8(haxby_opcodes::OPCODE_NEW_ENUM_VAL)
.write_u8(*a)
.write_u16(*n),
Opcode::NewEnumValSymbol(a, n) => self
.write_u8(haxby_opcodes::OPCODE_NEW_ENUM_VAL_SYMBOL)
.write_u8(*a)
.write_u32(*n),
Opcode::EnumCheckIsCase(n) => self
.write_u8(haxby_opcodes::OPCODE_ENUM_CHECK_IS_CASE)
.write_u16(*n),
Opcode::EnumCheckIsCaseSymbol(n) => self
.write_u8(haxby_opcodes::OPCODE_ENUM_CHECK_IS_CASE_SYMBOL)
.write_u32(*n),
Opcode::EnumTryExtractPayload => {
self.write_u8(haxby_opcodes::OPCODE_ENUM_TRY_EXTRACT_PAYLOAD)
}
Opcode::TryUnwrapProtocol(n) => self
.write_u8(haxby_opcodes::OPCODE_TRY_UNWRAP_PROTOCOL)
.write_u8(*n),
Opcode::Isa => self.write_u8(haxby_opcodes::OPCODE_ISA),
Opcode::Import(n) => self.write_u8(haxby_opcodes::OPCODE_IMPORT).write_u16(*n),
Opcode::LiftModule => self.write_u8(haxby_opcodes::OPCODE_LIFT_MODULE),
Opcode::LoadDylib(n) => self
.write_u8(haxby_opcodes::OPCODE_LOAD_DYLIB)
.write_u16(*n),
Opcode::Assert(n) => self.write_u8(haxby_opcodes::OPCODE_ASSERT).write_u16(*n),
Opcode::Halt => self.write_u8(haxby_opcodes::OPCODE_HALT),
}
}
pub(crate) fn get_data(&self) -> Vec<u8> {
self.data.clone()
}
}
================================================
FILE: compiler-lib/src/builder/block.rs
================================================
// SPDX-License-Identifier: Apache-2.0
use std::{cell::RefCell, collections::HashSet, rc::Rc};
use aria_parser::ast::SourcePointer;
use crate::{
bc_writer::BytecodeWriter,
builder::{compiler_opcodes::CompilerOpcode, func::FunctionBuilder},
constant_value::ConstantValues,
line_table::LineTable,
};
pub(crate) struct BasicBlockEntry {
pub op: CompilerOpcode,
pub src: Option<SourcePointer>,
}
impl BasicBlockEntry {
fn to_vm_opcode(&self, parent: &FunctionBuilder) -> haxby_opcodes::Opcode {
self.op.to_vm_opcode(parent)
}
}
// TODO: this should really not be visible outside of block.rs
pub(crate) struct BasicBlockImpl {
name: String,
id: usize,
pub(crate) writer: RefCell<Vec<BasicBlockEntry>>,
}
impl BasicBlockImpl {
pub(crate) fn new(name: &str, id: usize) -> Self {
Self {
name: name.to_owned(),
id,
writer: RefCell::new(Default::default()),
}
}
}
#[derive(Clone)]
pub struct BasicBlock {
pub(crate) imp: Rc<BasicBlockImpl>,
}
impl PartialEq for BasicBlock {
fn eq(&self, other: &Self) -> bool {
Rc::ptr_eq(&self.imp, &other.imp)
}
}
impl Eq for BasicBlock {}
#[derive(Default)]
pub(crate) struct LocalValuesAccess {
pub(crate) reads: HashSet<u8>,
pub(crate) writes: HashSet<u8>,
}
impl LocalValuesAccess {
pub(crate) fn calculate_unused_locals(&self) -> HashSet<u8> {
self.writes.difference(&self.reads).cloned().collect()
}
}
impl BasicBlock {
pub(crate) fn new(name: &str, id: usize) -> Self {
Self {
imp: Rc::new(BasicBlockImpl::new(name, id)),
}
}
pub fn name(&self) -> &str {
&self.imp.name
}
pub fn id(&self) -> usize {
self.imp.id
}
#[deprecated(note = "use write_opcode_and_source_info")]
pub fn write_opcode(&self, op: CompilerOpcode) -> &Self {
let bbe = BasicBlockEntry { op, src: None };
self.imp.writer.borrow_mut().push(bbe);
self
}
pub fn write_opcode_and_source_info(&self, op: CompilerOpcode, src: SourcePointer) -> &Self {
let bbe = BasicBlockEntry { op, src: Some(src) };
self.imp.writer.borrow_mut().push(bbe);
self
}
pub fn len(&self) -> usize {
self.imp.writer.borrow().len()
}
pub fn is_empty(&self) -> bool {
self.imp.writer.borrow().is_empty()
}
pub fn is_terminal(&self) -> bool {
let br = self.imp.writer.borrow();
for src_op in br.as_slice() {
if src_op.op.is_terminal() {
return true;
}
}
false
}
#[allow(dead_code)]
pub(crate) fn remove_op_at_idx(&self, idx: usize) {
self.imp.writer.borrow_mut().remove(idx);
}
fn replace_double_jump(&self) -> bool {
let mut any = false;
let mut br = self.imp.writer.borrow_mut();
for i in 0..br.len() {
if let CompilerOpcode::Jump(dest) = &br[i].op {
let dest = dest.clone();
if dest.imp.id == self.imp.id {
continue;
}
if dest.is_empty() {
continue;
}
let dest_br = dest.imp.writer.borrow();
if let CompilerOpcode::Jump(final_dest) = &dest_br[0].op {
br[i].op = CompilerOpcode::Jump(final_dest.clone());
any = true;
}
}
}
any
}
fn optimize_true_false(&self, cv: &ConstantValues) {
let mut br = self.imp.writer.borrow_mut();
for i in 0..br.len() {
if let CompilerOpcode::ReadNamed(idx) = &br[i].op
&& let Some(crate::constant_value::ConstantValue::String(x)) = cv.get(*idx as usize)
{
if x == "true" {
br[i].op = CompilerOpcode::PushTrue;
} else if x == "false" {
br[i].op = CompilerOpcode::PushFalse;
}
}
}
}
fn optimize_redundant_conditional_jumps(&self) {
let mut br = self.imp.writer.borrow_mut();
let mut i = 0;
while i + 1 < br.len() {
match (&br[i].op, &br[i + 1].op) {
(CompilerOpcode::PushTrue, CompilerOpcode::JumpTrue(target))
| (CompilerOpcode::PushFalse, CompilerOpcode::JumpFalse(target)) => {
br[i].op = CompilerOpcode::Jump(target.clone());
br.remove(i + 1);
continue;
}
(CompilerOpcode::PushTrue, CompilerOpcode::JumpFalse(_))
| (CompilerOpcode::PushFalse, CompilerOpcode::JumpTrue(_)) => {
br[i].op = CompilerOpcode::Nop;
br.remove(i + 1);
continue;
}
_ => {}
}
i += 1;
}
}
fn remove_instructions_after_terminal(&self) {
let mut br = self.imp.writer.borrow_mut();
for i in 0..br.len() {
if br[i].op.is_terminal() {
while br.len() != i + 1 {
br.remove(i + 1);
}
return;
}
}
}
fn remove_redundant_local_reads(&self) {
let mut br = self.imp.writer.borrow_mut();
if br.len() < 2 {
return;
}
for i in 0..br.len() - 1 {
if let CompilerOpcode::ReadLocal(x) = br[i].op {
let mut j = i + 1;
while j < br.len() {
match br[j].op {
CompilerOpcode::ReadLocal(y) => {
if x != y {
break;
} else {
br[j].op = CompilerOpcode::Dup;
}
}
_ => {
break;
}
}
j += 1;
}
}
}
}
fn remove_redundant_named_reads(&self) {
let mut br = self.imp.writer.borrow_mut();
if br.len() < 2 {
return;
}
for i in 0..br.len() - 1 {
if let CompilerOpcode::ReadNamed(x) = br[i].op {
let mut j = i + 1;
while j < br.len() {
match br[j].op {
CompilerOpcode::ReadNamed(y) => {
if x != y {
break;
} else {
br[j].op = CompilerOpcode::Dup;
}
}
_ => {
break;
}
}
j += 1;
}
}
}
}
fn remove_store_load_sequence(&self) {
if self.len() < 2 {
return;
}
let mut br = self.imp.writer.borrow_mut();
for i in 0..br.len() - 1 {
if let CompilerOpcode::WriteLocal(x) = br[i].op
&& let CompilerOpcode::ReadLocal(y) = br[i + 1].op
&& x == y
{
br[i].op = CompilerOpcode::Dup;
br[i + 1].op = CompilerOpcode::WriteLocal(x);
}
}
}
fn remove_nop_instructions(&self) {
let mut br = self.imp.writer.borrow_mut();
br.retain(|x| !matches!(x.op, CompilerOpcode::Nop));
}
fn remove_push_pop_pairs(&self) {
if self.len() < 2 {
return;
}
let mut br = self.imp.writer.borrow_mut();
for i in 0..br.len() - 1 {
if let (
CompilerOpcode::Push0
| CompilerOpcode::Push1
| CompilerOpcode::PushFalse
| CompilerOpcode::PushTrue
| CompilerOpcode::Push(_)
| CompilerOpcode::PushBuiltinTy(_)
| CompilerOpcode::Dup,
CompilerOpcode::Pop,
) = (&br[i].op, &br[i + 1].op)
{
br[i].op = CompilerOpcode::Nop;
br[i + 1].op = CompilerOpcode::Nop;
}
}
}
pub(crate) fn run_optimize_passes(&self, cv: &ConstantValues) {
self.optimize_true_false(cv);
self.optimize_redundant_conditional_jumps();
self.remove_redundant_local_reads();
self.remove_redundant_named_reads();
self.remove_store_load_sequence();
self.remove_instructions_after_terminal();
self.remove_nop_instructions();
self.remove_push_pop_pairs();
self.remove_nop_instructions();
while self.replace_double_jump() {}
}
pub(crate) fn drop_unused_locals(&self, values: &HashSet<u8>) {
let mut br = self.imp.writer.borrow_mut();
for i in 0..br.len() {
match br[i].op {
CompilerOpcode::ReadLocal(x) => {
assert!(!values.contains(&x));
}
CompilerOpcode::TypedefLocal(x) => {
if values.contains(&x) {
br[i].op = CompilerOpcode::Pop;
}
}
CompilerOpcode::WriteLocal(x) => {
if values.contains(&x) {
br[i].op = CompilerOpcode::Pop;
}
}
_ => {}
}
}
}
pub(crate) fn calculate_locals_access(&self, dest: &mut LocalValuesAccess) {
let br = self.imp.writer.borrow();
for i in 0..br.len() {
match br[i].op {
CompilerOpcode::ReadLocal(x) | CompilerOpcode::StoreUplevel(x) => {
dest.reads.insert(x);
}
CompilerOpcode::WriteLocal(x) => {
dest.writes.insert(x);
}
CompilerOpcode::TypedefLocal(x) => {
if i > 0 {
if let CompilerOpcode::PushBuiltinTy(t) = br[i - 1].op
&& t.is_any()
{
dest.writes.insert(x);
} else {
dest.reads.insert(x);
dest.writes.insert(x);
}
} else {
// this is quite odd, as there would have to be something else defining
// the type of the local on the stack, but just keep going for sake of completeness
dest.writes.insert(x);
}
}
_ => {}
}
}
}
pub(crate) fn write(&self, parent: &FunctionBuilder, dest: &mut BytecodeWriter) {
let br = self.imp.writer.borrow();
for src_op in br.as_slice() {
dest.write_opcode(&src_op.to_vm_opcode(parent));
}
}
pub(crate) fn write_line_table(&self, offset: u16, line_table: &LineTable) {
let mut cur_offset = offset;
let br = self.imp.writer.borrow();
for src_op in br.as_slice() {
if let Some(src) = &src_op.src {
line_table.insert(cur_offset, src.clone());
}
cur_offset += 1;
}
}
}
impl std::fmt::Display for BasicBlock {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let br = self.imp.writer.borrow();
writeln!(f, "BasicBlock {}:", self.imp.name)?;
for src_op in br.as_slice() {
writeln!(f, " {}", src_op.op)?;
}
Ok(())
}
}
================================================
FILE: compiler-lib/src/builder/compiler_opcodes.rs
================================================
// SPDX-License-Identifier: Apache-2.0
use enum_as_inner::EnumAsInner;
use haxby_opcodes::{
BuiltinTypeId, BuiltinValueId, Opcode as VmOpcode, enum_case_attribs::CASE_HAS_PAYLOAD,
};
use crate::builder::{block::BasicBlock, func::FunctionBuilder};
#[derive(Clone, EnumAsInner)]
pub enum CompilerOpcode {
Nop,
Push(u16),
Push0,
Push1,
PushTrue,
PushFalse,
PushBuiltinTy(BuiltinTypeId),
PushRuntimeValue(BuiltinValueId),
Pop,
Dup,
Swap,
Copy(u8),
Add,
Sub,
Mul,
Div,
Rem,
Neg,
ShiftLeft,
ShiftRight,
Not,
Equal,
ReadLocal(u8),
WriteLocal(u8),
TypedefLocal(u8),
ReadNamed(u16),
WriteNamed(u16),
TypedefNamed(u16),
ReadIndex(u8),
WriteIndex(u8),
ReadAttribute(u16),
WriteAttribute(u16),
ReadUplevel(u8),
LogicalAnd,
BitwiseAnd,
LogicalOr,
BitwiseOr,
Xor,
GreaterThan,
GreaterThanEqual,
LessThan,
LessThanEqual,
JumpTrue(BasicBlock),
JumpFalse(BasicBlock),
Jump(BasicBlock),
JumpConditionally(BasicBlock, BasicBlock),
JumpIfArgSupplied(u8, BasicBlock),
Call(u8),
Return,
ReturnUnit,
TryEnter(BasicBlock),
TryExit,
Throw,
BuildList(u32),
BuildFunction,
StoreUplevel(u8),
BuildStruct,
BuildEnum,
BuildMixin,
BindCase(u8, u16),
IncludeMixin,
NewEnumVal(bool, u16),
EnumCheckIsCase(u16),
EnumTryExtractPayload,
TryUnwrapProtocol(u8),
Isa,
Import(u16),
LiftModule,
LoadDylib(u16),
Assert(u16),
Halt,
}
impl CompilerOpcode {
pub fn is_terminal(&self) -> bool {
match self {
Self::Nop => false,
Self::Push(_) => false,
Self::Push0 => false,
Self::Push1 => false,
Self::PushTrue => false,
Self::PushFalse => false,
Self::PushBuiltinTy(_) => false,
Self::PushRuntimeValue(_) => false,
Self::Pop => false,
Self::Dup => false,
Self::Swap => false,
Self::Copy(_) => false,
Self::Add => false,
Self::Sub => false,
Self::Mul => false,
Self::Div => false,
Self::Rem => false,
Self::Neg => false,
Self::ShiftLeft => false,
Self::ShiftRight => false,
Self::Not => false,
Self::Equal => false,
Self::ReadLocal(_) => false,
Self::WriteLocal(_) => false,
Self::TypedefLocal(_) => false,
Self::ReadNamed(_) => false,
Self::WriteNamed(_) => false,
Self::TypedefNamed(_) => false,
Self::ReadIndex(_) => false,
Self::WriteIndex(_) => false,
Self::ReadAttribute(_) => false,
Self::WriteAttribute(_) => false,
Self::ReadUplevel(_) => false,
Self::LogicalAnd => false,
Self::LogicalOr => false,
Self::Xor => false,
Self::BitwiseAnd => false,
Self::BitwiseOr => false,
Self::LessThan => false,
Self::GreaterThan => false,
Self::LessThanEqual => false,
Self::GreaterThanEqual => false,
Self::JumpTrue(_) => false,
Self::JumpFalse(_) => false,
Self::Jump(_) => true,
Self::JumpConditionally(..) => true,
Self::JumpIfArgSupplied(..) => false,
Self::Call(_) => false,
Self::Return => true,
Self::ReturnUnit => true,
Self::TryEnter(_) => false,
Self::TryExit => false,
Self::Throw => true,
Self::BuildList(_) => false,
Self::BuildFunction => false,
Self::StoreUplevel(_) => false,
Self::BuildStruct => false,
Self::BuildEnum => false,
Self::BuildMixin => false,
Self::BindCase(..) => false,
Self::IncludeMixin => false,
Self::NewEnumVal(..) => false,
Self::EnumCheckIsCase(_) => false,
Self::EnumTryExtractPayload => false,
Self::TryUnwrapProtocol(_) => false,
Self::Isa => false,
Self::Import(_) => false,
Self::LiftModule => false,
Self::LoadDylib(_) => false,
Self::Assert(_) => false,
Self::Halt => true,
}
}
pub fn is_jump_instruction(&self) -> Vec<BasicBlock> {
match self {
Self::TryEnter(dst)
| Self::JumpIfArgSupplied(_, dst)
| Self::Jump(dst)
| Self::JumpTrue(dst)
| Self::JumpFalse(dst) => vec![dst.clone()],
Self::JumpConditionally(t, f) => vec![t.clone(), f.clone()],
_ => vec![],
}
}
pub fn to_vm_opcode(&self, parent: &FunctionBuilder) -> VmOpcode {
match self {
Self::Nop => VmOpcode::Nop,
Self::Push(v) => VmOpcode::Push(*v),
Self::Push0 => VmOpcode::Push0,
Self::Push1 => VmOpcode::Push1,
Self::PushTrue => VmOpcode::PushTrue,
Self::PushFalse => VmOpcode::PushFalse,
Self::PushBuiltinTy(n) => VmOpcode::PushBuiltinTy(*n),
Self::PushRuntimeValue(n) => VmOpcode::PushRuntimeValue(*n),
Self::Pop => VmOpcode::Pop,
Self::Dup => VmOpcode::Dup,
Self::Swap => VmOpcode::Swap,
Self::Copy(n) => VmOpcode::Copy(*n),
Self::Add => VmOpcode::Add,
Self::Sub => VmOpcode::Sub,
Self::Mul => VmOpcode::Mul,
Self::Div => VmOpcode::Div,
Self::Rem => VmOpcode::Rem,
Self::Neg => VmOpcode::Neg,
Self::ShiftLeft => VmOpcode::ShiftLeft,
Self::ShiftRight => VmOpcode::ShiftRight,
Self::Not => VmOpcode::Not,
Self::Equal => VmOpcode::Equal,
Self::ReadLocal(n) => VmOpcode::ReadLocal(*n),
Self::WriteLocal(n) => VmOpcode::WriteLocal(*n),
Self::TypedefLocal(n) => VmOpcode::TypedefLocal(*n),
Self::ReadNamed(n) => VmOpcode::ReadNamed(*n),
Self::WriteNamed(n) => VmOpcode::WriteNamed(*n),
Self::TypedefNamed(n) => VmOpcode::TypedefNamed(*n),
Self::ReadIndex(n) => VmOpcode::ReadIndex(*n),
Self::WriteIndex(n) => VmOpcode::WriteIndex(*n),
Self::ReadAttribute(n) => VmOpcode::ReadAttribute(*n),
Self::WriteAttribute(n) => VmOpcode::WriteAttribute(*n),
Self::ReadUplevel(n) => VmOpcode::ReadUplevel(*n),
Self::LogicalAnd => VmOpcode::LogicalAnd,
Self::LogicalOr => VmOpcode::LogicalOr,
Self::Xor => VmOpcode::Xor,
Self::BitwiseAnd => VmOpcode::BitwiseAnd,
Self::BitwiseOr => VmOpcode::BitwiseOr,
Self::GreaterThan => VmOpcode::GreaterThan,
Self::LessThan => VmOpcode::LessThan,
Self::GreaterThanEqual => VmOpcode::GreaterThanEqual,
Self::LessThanEqual => VmOpcode::LessThanEqual,
Self::JumpTrue(dst) => {
let offset = parent
.position_of_block_instructions(dst)
.unwrap_or_else(|| panic!("invalid block {}", dst.name()));
VmOpcode::JumpTrue(offset)
}
Self::JumpFalse(dst) => {
let offset = parent
.position_of_block_instructions(dst)
.unwrap_or_else(|| panic!("invalid block {}", dst.name()));
VmOpcode::JumpFalse(offset)
}
Self::Jump(dst) => {
let offset = parent
.position_of_block_instructions(dst)
.unwrap_or_else(|| panic!("invalid block {}", dst.name()));
VmOpcode::Jump(offset)
}
Self::JumpConditionally(t, f) => {
let t_offset = parent
.position_of_block_instructions(t)
.unwrap_or_else(|| panic!("invalid block {}", t.name()));
let f_offset = parent
.position_of_block_instructions(f)
.unwrap_or_else(|| panic!("invalid block {}", f.name()));
VmOpcode::JumpConditionally(t_offset, f_offset)
}
Self::JumpIfArgSupplied(arg, dst) => {
let offset = parent
.position_of_block_instructions(dst)
.unwrap_or_else(|| panic!("invalid block {}", dst.name()));
VmOpcode::JumpIfArgSupplied(*arg, offset)
}
Self::Call(n) => VmOpcode::Call(*n),
Self::Return => VmOpcode::Return,
Self::ReturnUnit => VmOpcode::ReturnUnit,
Self::TryEnter(dst) => {
let offset = parent
.position_of_block_instructions(dst)
.unwrap_or_else(|| panic!("invalid block {}", dst.name()));
VmOpcode::TryEnter(offset)
}
Self::TryExit => VmOpcode::TryExit,
Self::Throw => VmOpcode::Throw,
Self::BuildList(v) => VmOpcode::BuildList(*v),
Self::BuildFunction => VmOpcode::BuildFunction,
Self::StoreUplevel(a) => VmOpcode::StoreUplevel(*a),
Self::BuildStruct => VmOpcode::BuildStruct,
Self::BuildEnum => VmOpcode::BuildEnum,
Self::BuildMixin => VmOpcode::BuildMixin,
Self::BindCase(x, y) => VmOpcode::BindCase(*x, *y),
Self::IncludeMixin => VmOpcode::IncludeMixin,
Self::NewEnumVal(v, n) => {
VmOpcode::NewEnumVal(if *v { CASE_HAS_PAYLOAD } else { 0 }, *n)
}
Self::EnumCheckIsCase(v) => VmOpcode::EnumCheckIsCase(*v),
Self::EnumTryExtractPayload => VmOpcode::EnumTryExtractPayload,
Self::TryUnwrapProtocol(v) => VmOpcode::TryUnwrapProtocol(*v),
Self::Isa => VmOpcode::Isa,
Self::Import(v) => VmOpcode::Import(*v),
Self::LiftModule => VmOpcode::LiftModule,
Self::LoadDylib(n) => VmOpcode::LoadDylib(*n),
Self::Assert(v) => VmOpcode::Assert(*v),
Self::Halt => VmOpcode::Halt,
}
}
}
impl std::fmt::Display for CompilerOpcode {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
use CompilerOpcode::*;
match self {
Nop => write!(f, "Nop"),
Push(v) => write!(f, "Push({})", v),
Push0 => write!(f, "Push0"),
Push1 => write!(f, "Push1"),
PushTrue => write!(f, "PushTrue"),
PushFalse => write!(f, "PushFalse"),
PushBuiltinTy(n) => write!(f, "PushBuiltinTy({})", n.name()),
PushRuntimeValue(n) => write!(f, "PushRuntimeValue({})", n.name()),
Pop => write!(f, "Pop"),
Dup => write!(f, "Dup"),
Swap => write!(f, "Swap"),
Copy(n) => write!(f, "Copy({})", n),
Add => write!(f, "Add"),
Sub => write!(f, "Sub"),
Mul => write!(f, "Mul"),
Div => write!(f, "Div"),
Rem => write!(f, "Rem"),
Neg => write!(f, "Neg"),
ShiftLeft => write!(f, "ShiftLeft"),
ShiftRight => write!(f, "ShiftRight"),
Not => write!(f, "Not"),
Equal => write!(f, "Equal"),
ReadLocal(n) => write!(f, "ReadLocal({})", n),
WriteLocal(n) => write!(f, "WriteLocal({})", n),
TypedefLocal(n) => write!(f, "TypedefLocal({})", n),
ReadNamed(n) => write!(f, "ReadNamed({})", n),
WriteNamed(n) => write!(f, "WriteNamed({})", n),
TypedefNamed(n) => write!(f, "TypedefNamed({})", n),
ReadIndex(n) => write!(f, "ReadIndex({})", n),
WriteIndex(n) => write!(f, "WriteIndex({})", n),
ReadAttribute(n) => write!(f, "ReadAttribute({})", n),
WriteAttribute(n) => write!(f, "WriteAttribute({})", n),
ReadUplevel(n) => write!(f, "ReadUplevel({})", n),
LogicalAnd => write!(f, "LogicalAnd"),
BitwiseAnd => write!(f, "BitwiseAnd"),
LogicalOr => write!(f, "LogicalOr"),
BitwiseOr => write!(f, "BitwiseOr"),
Xor => write!(f, "Xor"),
GreaterThan => write!(f, "GreaterThan"),
GreaterThanEqual => write!(f, "GreaterThanEqual"),
LessThan => write!(f, "LessThan"),
LessThanEqual => write!(f, "LessThanEqual"),
JumpTrue(dst) => write!(f, "JumpTrue({})", dst.name()),
JumpFalse(dst) => write!(f, "JumpFalse({})", dst.name()),
Jump(dst) => write!(f, "Jump({})", dst.name()),
JumpIfArgSupplied(arg, dst) => {
write!(f, "JumpIfArgSupplied({}, {})", arg, dst.name())
}
JumpConditionally(tr, fa) => {
write!(f, "JumpConditionally({}, {})", tr.name(), fa.name())
}
Call(n) => write!(f, "Call({})", n),
Return => write!(f, "Return"),
ReturnUnit => write!(f, "ReturnUnit"),
TryEnter(dst) => write!(f, "TryEnter({})", dst.name()),
TryExit => write!(f, "TryExit"),
Throw => write!(f, "Throw"),
BuildList(v) => write!(f, "BuildList({})", v),
BuildFunction => write!(f, "BuildFunction"),
StoreUplevel(a) => write!(f, "StoreUplevel({})", a),
BuildStruct => write!(f, "BuildStruct"),
BuildEnum => write!(f, "BuildEnum"),
BuildMixin => write!(f, "BuildMixin"),
BindCase(x, y) => write!(f, "BindCase({}, {})", x, y),
IncludeMixin => write!(f, "IncludeMixin"),
NewEnumVal(has_payload, n) => write!(f, "NewEnumVal({}, {})", has_payload, n),
EnumCheckIsCase(v) => write!(f, "EnumCheckIsCase({})", v),
EnumTryExtractPayload => write!(f, "EnumTryExtractPayload"),
TryUnwrapProtocol(v) => write!(f, "TryUnwrapProtocol({})", v),
Isa => write!(f, "Isa"),
Import(v) => write!(f, "Import({})", v),
LiftModule => write!(f, "LiftModule"),
LoadDylib(n) => write!(f, "LoadDylib({})", n),
Assert(v) => write!(f, "Assert({})", v),
Halt => write!(f, "Halt"),
}
}
}
================================================
FILE: compiler-lib/src/builder/func.rs
================================================
// SPDX-License-Identifier: Apache-2.0
use std::collections::HashSet;
use crate::{
CompilationOptions,
bc_writer::BytecodeWriter,
builder::block::{BasicBlock, LocalValuesAccess},
constant_value::ConstantValues,
line_table::LineTable,
};
pub struct FunctionBuilder {
blocks: Vec<BasicBlock>,
names: HashSet<String>,
current: BasicBlock,
bb_id: usize,
line_table: LineTable,
}
impl Default for FunctionBuilder {
fn default() -> Self {
let mut this = Self {
blocks: Vec::new(),
names: HashSet::new(),
current: BasicBlock::new("entry", 0),
bb_id: 1,
line_table: Default::default(),
};
this.blocks.push(this.current.clone());
this.names.insert(this.current.name().to_owned());
this
}
}
impl FunctionBuilder {
pub fn try_get_block(&self, name: &str) -> Option<BasicBlock> {
for blk in &self.blocks {
if blk.name() == name {
return Some(blk.clone());
}
}
None
}
pub fn get_block(&self, name: &str) -> BasicBlock {
self.try_get_block(name).expect("block is missing")
}
fn uniq_name(&self, name: &str) -> String {
let mut name = String::from(name);
while self.names.contains(&name) {
name += "_";
}
name
}
fn make_new_block(&mut self, name: &str) -> BasicBlock {
assert!(!self.names.contains(name));
let blk = BasicBlock::new(name, self.bb_id);
self.bb_id += 1;
blk
}
pub fn insert_block_after(&mut self, name: &str, target: &BasicBlock) -> BasicBlock {
let name = self.uniq_name(name);
let blk = self.make_new_block(&name);
let mut inserted = false;
for i in 0..self.blocks.len() {
let blk_i = &self.blocks[i];
if blk_i.id() == target.id() {
if i + 1 >= self.blocks.len() {
self.blocks.push(blk.clone());
} else {
self.blocks.insert(i + 1, blk.clone());
}
inserted = true;
break;
}
}
if !inserted {
self.blocks.push(blk.clone());
}
self.names.insert(name);
blk
}
pub fn append_block_at_end(&mut self, name: &str) -> BasicBlock {
let name = self.uniq_name(name);
let blk = self.make_new_block(&name);
self.blocks.push(blk.clone());
self.names.insert(name);
blk
}
pub fn set_current_block(&mut self, blk: BasicBlock) {
self.current = blk;
}
pub fn get_current_block(&self) -> BasicBlock {
self.current.clone()
}
pub fn position_of_block_instructions(&self, blk: &BasicBlock) -> Option<u16> {
let mut count = 0;
for next in &self.blocks {
if next == blk {
return Some(count as u16);
} else {
count += next.len()
}
}
None
}
fn has_entrypoints(&self, blk: &BasicBlock) -> bool {
for src_blk in &self.blocks {
let br = src_blk.imp.writer.borrow();
for src_op in br.as_slice() {
for dst in src_op.op.is_jump_instruction() {
if dst.id() == blk.id() {
return true;
}
}
}
}
false
}
fn find_orphaned_blocks(&self) -> HashSet<usize> {
let mut orphans = HashSet::<usize>::default();
for blk in &self.blocks {
if blk.id() != 0 {
let has_entrypoints = self.has_entrypoints(blk);
if !has_entrypoints {
orphans.insert(blk.id());
}
}
}
orphans
}
fn remove_block_with_id(&mut self, id: usize) -> bool {
for i in 0..self.blocks.len() {
if self.blocks[i].id() == id {
self.blocks.remove(i);
return true;
}
}
false
}
fn run_optimize_passes(&mut self, cv: &ConstantValues) {
let orphans = self.find_orphaned_blocks();
for orphan_id in &orphans {
assert!(self.remove_block_with_id(*orphan_id));
}
let locals_access = self.calculate_locals_access();
let unused_locals = locals_access.calculate_unused_locals();
for blk in &self.blocks {
if !unused_locals.is_empty() {
blk.drop_unused_locals(&unused_locals);
}
blk.run_optimize_passes(cv);
}
}
fn calculate_locals_access(&self) -> LocalValuesAccess {
let mut dest = LocalValuesAccess::default();
for blk in &self.blocks {
blk.calculate_locals_access(&mut dest);
}
dest
}
pub fn write(
&mut self,
cv: &ConstantValues,
options: &CompilationOptions,
) -> Result<Vec<u8>, crate::do_compile::CompilationErrorReason> {
if options.dump_builder {
println!("(unopt) Intermediate Representation Dump:\n{}", self);
}
if options.optimize {
self.run_optimize_passes(cv);
if options.dump_builder {
println!("(opt) Intermediate Representation Dump:\n{}", self);
}
}
let mut dest = BytecodeWriter::default();
for blk in &self.blocks {
assert!(blk.is_empty() || blk.is_terminal());
blk.write(self, &mut dest);
}
let ret = dest.get_data();
if ret.len() >= u16::MAX.into() {
Err(crate::do_compile::CompilationErrorReason::FunctionBodyTooLarge)
} else {
Ok(ret)
}
}
pub fn write_line_table(&self) -> &LineTable {
for blk in &self.blocks {
blk.write_line_table(
self.position_of_block_instructions(blk).unwrap(),
&self.line_table,
);
}
&self.line_table
}
}
impl std::fmt::Display for FunctionBuilder {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
for blk in &self.blocks {
writeln!(f, "{}", blk)?;
}
Ok(())
}
}
================================================
FILE: compiler-lib/src/builder/mod.rs
================================================
// SPDX-License-Identifier: Apache-2.0
pub mod block;
pub mod compiler_opcodes;
pub mod func;
================================================
FILE: compiler-lib/src/constant_value.rs
================================================
// SPDX-License-Identifier: Apache-2.0
use std::collections::HashMap;
use aria_parser::ast::SourcePointer;
use enum_as_inner::EnumAsInner;
use crate::line_table::LineTable;
#[derive(Clone, PartialEq, Eq)]
pub struct CompiledCodeObject {
pub name: String,
pub attribute: u8,
pub body: Vec<u8>,
pub required_argc: u8, // arguments that are required to call this function
pub default_argc: u8, // additional arguments that this function can accept
pub loc: SourcePointer,
pub line_table: LineTable,
pub frame_size: u8,
}
#[derive(Clone, Copy)]
pub struct FpConst(f64);
impl FpConst {
fn to_int(self) -> i64 {
unsafe { std::mem::transmute(self) }
}
pub fn raw_value(&self) -> f64 {
self.0
}
}
impl PartialEq for FpConst {
fn eq(&self, other: &Self) -> bool {
self.to_int() == other.to_int()
}
}
impl Eq for FpConst {}
impl std::hash::Hash for FpConst {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
self.to_int().hash(state)
}
}
impl From<f64> for FpConst {
fn from(value: f64) -> Self {
Self(value)
}
}
// ignore the line table and only hash on function code
impl std::hash::Hash for CompiledCodeObject {
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
self.body.hash(state);
}
}
#[derive(EnumAsInner, Clone, PartialEq, Eq, Hash)]
pub enum ConstantValue {
Integer(i64),
String(String),
Float(FpConst),
CompiledCodeObject(CompiledCodeObject),
}
impl std::fmt::Display for ConstantValue {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::Integer(arg0) => write!(f, "int:{}", *arg0),
Self::Float(arg0) => write!(f, "fp:{}", arg0.0),
Self::String(arg0) => write!(f, "str:\"{}\"", *arg0),
Self::CompiledCodeObject(_) => write!(f, "compiled-code-object"),
}
}
}
#[derive(Default)]
pub struct ConstantValues {
pub(crate) values: Vec<ConstantValue>,
uniq: HashMap<ConstantValue, usize>,
}
pub enum ConstantValuesError {
OutOfSpace,
}
impl ConstantValues {
pub fn insert(&mut self, v: ConstantValue) -> Result<u16, ConstantValuesError> {
if let Some(idx) = self.uniq.get(&v) {
Ok(*idx as u16)
} else {
if self.values.len() == (u16::MAX as usize) {
return Err(ConstantValuesError::OutOfSpace);
}
let idx = self.values.len();
self.uniq.insert(v.clone(), idx);
self.values.push(v);
Ok(idx as u16)
}
}
pub fn get(&self, i: usize) -> Option<ConstantValue> {
self.values.get(i).cloned()
}
pub fn len(&self) -> usize {
self.values.len()
}
pub fn is_empty(&self) -> bool {
self.values.is_empty()
}
pub fn values(&self) -> std::slice::Iter<'_, ConstantValue> {
self.values.iter()
}
}
================================================
FILE: compiler-lib/src/do_compile/mod.rs
================================================
// SPDX-License-Identifier: Apache-2.0
use std::{collections::HashSet, fmt::Display, path::PathBuf};
use aria_parser::ast::{
ArgumentDecl, ArgumentList, AssertStatement, CodeBlock, DeclarationId, ElsePiece, EnumCaseDecl,
EnumDecl, EnumDeclEntry, Expression, FunctionBody, Identifier, MatchPattern,
MatchPatternEnumCase, MatchRule, MatchStatement, MethodAccess, MethodDecl, MixinIncludeDecl,
OperatorDecl, ParsedModule, ReturnStatement, SourceBuffer, SourcePointer, Statement,
StringLiteral, StructDecl, StructEntry, ValDeclStatement, prettyprint::PrettyPrintable,
source_to_ast,
};
use haxby_opcodes::BuiltinTypeId;
use thiserror::Error;
use crate::{
CompilationOptions,
builder::{block::BasicBlock, compiler_opcodes::CompilerOpcode, func::FunctionBuilder},
constant_value::{ConstantValue, ConstantValuesError},
module::CompiledModule,
scope::{CompilationScope, ScopeError, ScopeErrorReason},
};
#[derive(Debug, Error)]
pub enum CompilationErrorReason {
#[error("identifier is reserved: '{0}'")]
ReservedIdentifier(String),
#[error("no such identifier: '{0}'")]
NoSuchIdentifier(String),
#[error("function body is larger than allowed")]
FunctionBodyTooLarge,
#[error("list length is out of bounds")]
ListTooLarge,
#[error("attempt to modify a read-only value")]
ReadOnlyValue,
#[error("{0} is not a valid literal")]
InvalidLiteral(String),
#[error("{0} is not a valid operator")]
InvalidOperator(String),
#[error("{0} cannot be reversed")]
IrreversibleOperator(String),
#[error("operator {0} accepts {1} arguments, but {2} were declared")]
OperatorArityMismatch(String, OperatorArity, usize),
#[error("attempt to read a write-only value")]
WriteOnlyValue,
#[error("parser error: {0}")]
ParserError(String),
#[error("module contains too many constant values")]
TooManyConstants,
#[error("function accepts too many arguments")]
TooManyArguments,
#[error("argument without a default value follows argument with default value")]
DefaultArgsMustTrail,
#[error("flow control statement not permitted in current context")]
FlowControlNotAllowed,
#[error("argument name '{0}' is already defined for this function")]
DuplicateArgumentName(String),
#[error("struct members do not support type hints")]
NoTypeHintOnStructMember,
#[error("nested closures are not supported")]
NestedClosureDisallowed,
#[error("attempted to write to {0} values, but {1} were provided")]
AssignmentArityMismatch(usize, usize),
}
impl From<&ScopeErrorReason> for CompilationErrorReason {
fn from(value: &ScopeErrorReason) -> Self {
match value {
ScopeErrorReason::TooManyConstants => CompilationErrorReason::TooManyConstants,
ScopeErrorReason::NoSuchIdentifier(s) => {
CompilationErrorReason::NoSuchIdentifier(s.clone())
}
ScopeErrorReason::OverlyDeepClosure => CompilationErrorReason::NestedClosureDisallowed,
}
}
}
impl From<ScopeError> for CompilationError {
fn from(value: ScopeError) -> Self {
CompilationError {
loc: value.loc,
reason: CompilationErrorReason::from(&value.reason),
}
}
}
impl From<&ConstantValuesError> for CompilationErrorReason {
fn from(value: &ConstantValuesError) -> Self {
match value {
ConstantValuesError::OutOfSpace => CompilationErrorReason::TooManyConstants,
}
}
}
pub struct CompilationError {
pub loc: SourcePointer,
pub reason: CompilationErrorReason,
}
impl std::fmt::Display for CompilationError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "at {}, error occurred: {}", self.loc, self.reason)
}
}
impl std::fmt::Debug for CompilationError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "at {}, error occurred: {}", self.loc, self.reason)
}
}
pub type CompilationResult<T = (), E = CompilationError> = Result<T, E>;
#[derive(Default)]
struct ControlFlowTargets {
break_dest: Option<BasicBlock>,
continue_dest: Option<BasicBlock>,
}
struct CompileParams<'a> {
module: &'a mut CompiledModule,
scope: &'a CompilationScope,
writer: &'a mut FunctionBuilder,
cflow: &'a ControlFlowTargets,
options: &'a CompilationOptions,
}
trait CompileNode<'a, T = (), E = CompilationError> {
fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult<T, E>;
fn insert_const_or_fail(
&self,
params: &mut CompileParams,
ct: ConstantValue,
loc: &SourcePointer,
) -> CompilationResult<u16> {
match params.module.constants.insert(ct) {
Ok(idx) => Ok(idx),
Err(_) => Err(CompilationError {
loc: loc.clone(),
reason: CompilationErrorReason::TooManyConstants,
}),
}
}
fn return_unit_value(
&self,
params: &mut CompileParams,
loc: &SourcePointer,
) -> CompilationResult {
params
.writer
.get_current_block()
.write_opcode_and_source_info(CompilerOpcode::ReturnUnit, loc.clone());
Ok(())
}
}
mod nodes;
mod postfix;
fn ensure_arg_list_is_correct(args: &ArgumentList) -> CompilationResult {
ensure_unique_arg_names(args)?;
ensure_default_args_trailing(args)?;
Ok(())
}
fn ensure_unique_arg_names(args: &ArgumentList) -> CompilationResult {
let mut arg_set = HashSet::new();
for arg in &args.names {
if arg_set.contains(arg.name()) {
return Err(CompilationError {
loc: arg.loc.clone(),
reason: CompilationErrorReason::DuplicateArgumentName(arg.name().to_owned()),
});
} else {
arg_set.insert(arg.name().to_owned());
}
}
Ok(())
}
fn ensure_default_args_trailing(args: &ArgumentList) -> CompilationResult {
let mut found_default = false;
for arg in &args.names {
if arg.deft.is_some() {
found_default = true;
} else if found_default {
return Err(CompilationError {
loc: arg.loc.clone(),
reason: CompilationErrorReason::DefaultArgsMustTrail,
});
}
}
Ok(())
}
fn emit_arg_at_target(
arg: &ArgumentDecl,
idx: u8,
params: &mut CompileParams,
) -> CompilationResult {
if let Some(deft_expr) = arg.deft.as_ref() {
let block = params
.writer
.append_block_at_end(&format!("supplied_arg_{idx}"));
params
.writer
.get_current_block()
.write_opcode_and_source_info(
CompilerOpcode::JumpIfArgSupplied(idx, block.clone()),
arg.loc.clone(),
);
deft_expr.do_compile(params)?;
params
.writer
.get_current_block()
.write_opcode_and_source_info(CompilerOpcode::Jump(block.clone()), arg.loc.clone());
params.writer.set_current_block(block);
}
if let Some(ty) = arg.type_info() {
ty.do_compile(params)?;
} else {
params
.writer
.get_current_block()
.write_opcode_and_source_info(
CompilerOpcode::PushBuiltinTy(BuiltinTypeId::Any),
arg.loc.clone(),
);
}
params.scope.emit_typed_define(
arg.name(),
&mut params.module.constants,
params.writer.get_current_block(),
arg.loc.clone(),
)?;
params.scope.emit_write(
arg.name(),
&mut params.module.constants,
params.writer.get_current_block(),
arg.loc.clone(),
)?;
Ok(())
}
#[allow(dead_code)]
struct ArgumentCountInfo {
user_args: u8,
required_args: u8,
default_args: u8,
varargs: bool,
}
fn emit_args_at_target(
prefix_args: &[ArgumentDecl],
args: &ArgumentList,
suffix_args: &[ArgumentDecl],
params: &mut CompileParams,
) -> CompilationResult<ArgumentCountInfo> {
ensure_arg_list_is_correct(args)?;
let total_args = prefix_args.len() + args.names.len() + suffix_args.len();
if total_args > u8::MAX.into() {
return Err(CompilationError {
loc: args.loc.clone(),
reason: CompilationErrorReason::TooManyArguments,
});
}
let mut argc_info = ArgumentCountInfo {
user_args: args.len() as u8,
required_args: 0,
default_args: 0,
varargs: args.vararg,
};
let mut arg_idx: u8 = 0;
for arg in prefix_args {
emit_arg_at_target(arg, arg_idx, params)?;
argc_info.required_args += 1;
arg_idx += 1;
}
for arg in &args.names {
emit_arg_at_target(arg, arg_idx, params)?;
if arg.deft.is_some() {
argc_info.default_args += 1;
} else {
argc_info.required_args += 1;
}
arg_idx += 1;
}
for arg in suffix_args {
emit_arg_at_target(arg, arg_idx, params)?;
argc_info.required_args += 1;
arg_idx += 1;
}
if args.vararg {
params.scope.emit_untyped_define(
"varargs",
&mut params.module.constants,
params.writer.get_current_block(),
args.loc.clone(),
)?;
}
Ok(argc_info)
}
// assume your parent struct is on the stack
fn emit_type_mixin_include_decl_compile(
mi: &MixinIncludeDecl,
params: &mut CompileParams,
) -> CompilationResult {
mi.what.do_compile(params)?;
params
.writer
.get_current_block()
.write_opcode_and_source_info(CompilerOpcode::IncludeMixin, mi.loc.clone());
Ok(())
}
// assume your parent struct is on the stack
fn emit_method_decl_compile(md: &MethodDecl, params: &mut CompileParams) -> CompilationResult {
md.do_compile(params)?;
let name_idx = md.insert_const_or_fail(
params,
ConstantValue::String(md.name.value.clone()),
&md.loc,
)?;
params
.writer
.get_current_block()
.write_opcode_and_source_info(CompilerOpcode::BuildFunction, md.loc.clone())
.write_opcode_and_source_info(CompilerOpcode::WriteAttribute(name_idx), md.loc.clone());
Ok(())
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum OperatorArity {
Exactly(usize),
AtLeast(usize),
}
impl OperatorArity {
fn unary() -> Self {
OperatorArity::Exactly(1)
}
fn any() -> Self {
OperatorArity::AtLeast(0)
}
fn is_acceptable(&self, arg_count: usize) -> bool {
match self {
OperatorArity::Exactly(n) => *n == arg_count,
OperatorArity::AtLeast(n) => arg_count >= *n,
}
}
}
impl Display for OperatorArity {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
OperatorArity::Exactly(n) => write!(f, "exactly {n}"),
OperatorArity::AtLeast(n) => write!(f, "at least {n}"),
}
}
}
struct OperatorInfo {
arity: OperatorArity, // number of arguments (minus the receiver this)
direct_name: &'static str,
reverse_name: &'static str,
}
lazy_static::lazy_static! {
static ref OPERATOR_INFO: std::collections::HashMap<&'static str, OperatorInfo> = {
let mut map = std::collections::HashMap::new();
map.insert(
"+",
OperatorInfo {
arity: OperatorArity::unary(),
direct_name: "add",
reverse_name: "radd",
},
);
map.insert(
"-",
OperatorInfo {
arity: OperatorArity::unary(),
direct_name: "sub",
reverse_name: "rsub",
},
);
map.insert(
"*",
OperatorInfo {
arity: OperatorArity::unary(),
direct_name: "mul",
reverse_name: "rmul",
},
);
map.insert(
"/",
OperatorInfo {
arity: OperatorArity::unary(),
direct_name: "div",
reverse_name: "rdiv",
},
);
map.insert(
"%",
OperatorInfo {
arity: OperatorArity::unary(),
direct_name: "rem",
reverse_name: "rrem",
},
);
map.insert(
"<<",
OperatorInfo {
arity: OperatorArity::unary(),
direct_name: "lshift",
reverse_name: "rlshift",
},
);
map.insert(
">>",
OperatorInfo {
arity: OperatorArity::unary(),
direct_name: "rshift",
reverse_name: "rrshift",
},
);
map.insert("==",
OperatorInfo {
arity: OperatorArity::unary(),
direct_name: "equals",
reverse_name: "",
},
);
map.insert("<",
OperatorInfo {
arity: OperatorArity::unary(),
direct_name: "lt",
reverse_name: "gt",
},
);
map.insert(">",
OperatorInfo {
arity: OperatorArity::unary(),
direct_name: "gt",
reverse_name: "lt",
},
);
map.insert("<=",
OperatorInfo {
arity: OperatorArity::unary(),
direct_name: "lteq",
reverse_name: "gteq",
},
);
map.insert(">=",
OperatorInfo {
arity: OperatorArity::unary(),
direct_name: "gteq",
reverse_name: "lteq",
},
);
map.insert("&",
OperatorInfo {
arity: OperatorArity::unary(),
direct_name: "bwand",
reverse_name: "rbwand",
},
);
map.insert("|",
OperatorInfo {
arity: OperatorArity::unary(),
direct_name: "bwor",
reverse_name: "rbwor",
},
);
map.insert("^",
OperatorInfo {
arity: OperatorArity::unary(),
direct_name: "xor",
reverse_name: "rxor",
},
);
map.insert("u-",
OperatorInfo {
arity: OperatorArity::Exactly(0),
direct_name: "neg",
reverse_name: "",
},
);
map.insert("()",
OperatorInfo {
arity: OperatorArity::any(),
direct_name: "call",
reverse_name: "",
},
);
map.insert("[]",
OperatorInfo {
arity: OperatorArity::any(),
direct_name: "read_index",
reverse_name: "",
},
);
map.insert("[]=",
OperatorInfo {
arity: OperatorArity::AtLeast(1),
direct_name: "write_index",
reverse_name: "",
},
);
map
};
}
// assume your parent struct is on the stack
fn emit_operator_decl_compile(op: &OperatorDecl, params: &mut CompileParams) -> CompilationResult {
let op_symbol = op
.symbol
.prettyprint(
aria_parser::ast::prettyprint::printout_accumulator::PrintoutAccumulator::default(),
)
.value();
let op_info = match OPERATOR_INFO.get(op_symbol.as_str()) {
Some(info) => info,
None => {
return Err(CompilationError {
loc: op.loc.clone(),
reason: CompilationErrorReason::InvalidOperator(op_symbol),
});
}
};
if !op_info.arity.is_acceptable(op.args.len()) {
return Err(CompilationError {
loc: op.loc.clone(),
reason: CompilationErrorReason::OperatorArityMismatch(
op_symbol,
op_info.arity,
op.args.len(),
),
});
}
if op.reverse && op_info.reverse_name.is_empty() {
return Err(CompilationError {
loc: op.loc.clone(),
reason: CompilationErrorReason::IrreversibleOperator(op_symbol),
});
}
let op_fn_name = format!(
"_op_impl_{}",
if op.reverse {
op_info.reverse_name
} else {
op_info.direct_name
}
);
let md = MethodDecl {
loc: op.loc.clone(),
access: MethodAccess::Instance,
name: Identifier {
loc: op.loc.clone(),
value: op_fn_name,
},
args: op.args.clone(),
body: op.body.clone(),
};
emit_method_decl_compile(&md, params)
}
// assume your parent struct is on the stack
fn emit_type_val_decl_compile(
vd: &ValDeclStatement,
params: &mut CompileParams,
) -> CompilationResult {
for decl in &vd.decls {
if decl.id.ty.is_some() {
return Err(CompilationError {
loc: vd.loc.clone(),
reason: CompilationErrorReason::NoTypeHintOnStructMember,
});
}
decl.val.do_compile(params)?;
let name_idx = vd.insert_const_or_fail(
params,
ConstantValue::String(decl.id.name.value.clone()),
&vd.loc,
)?;
params
.writer
.get_current_block()
.write_opcode_and_source_info(CompilerOpcode::WriteAttribute(name_idx), vd.loc.clone());
}
Ok(())
}
// assume your parent struct is on the stack
fn emit_type_members_compile(
entries: &[StructEntry],
params: &mut CompileParams,
drop_at_end: bool,
) -> CompilationResult {
for se in entries {
params
.writer
.get_current_block()
.write_opcode_and_source_info(CompilerOpcode::Dup, se.loc().clone());
match se {
aria_parser::ast::StructEntry::Method(md) => emit_method_decl_compile(md, params)?,
aria_parser::ast::StructEntry::Operator(od) => emit_operator_decl_compile(od, params)?,
aria_parser::ast::StructEntry::Variable(vd) => emit_type_val_decl_compile(vd, params)?,
aria_parser::ast::StructEntry::Struct(sd) => {
do_struct_compile(sd, params)?;
let name_idx = sd.insert_const_or_fail(
params,
ConstantValue::String(sd.name.value.clone()),
&sd.loc,
)?;
params
.writer
.get_current_block()
.write_opcode_and_source_info(
CompilerOpcode::WriteAttribute(name_idx),
sd.loc.clone(),
);
}
aria_parser::ast::StructEntry::Enum(ed) => {
do_enum_compile(ed, params, |name, params| {
params
.writer
.get_current_block()
.write_opcode_and_source_info(CompilerOpcode::Swap, ed.loc.clone());
params
.writer
.get_current_block()
.write_opcode_and_source_info(CompilerOpcode::Copy(1), ed.loc.clone());
let name_idx = ed.insert_const_or_fail(
params,
ConstantValue::String(name.to_owned()),
&ed.loc,
)?;
params
.writer
.get_current_block()
.write_opcode_and_source_info(
CompilerOpcode::WriteAttribute(name_idx),
ed.loc.clone(),
);
Ok(())
})?;
}
aria_parser::ast::StructEntry::MixinInclude(mi) => {
emit_type_mixin_include_decl_compile(mi, params)?
}
}
}
if drop_at_end {
// remove the last leftover struct
#[allow(deprecated)] // no entry to ascribe this write to
params
.writer
.get_current_block()
.write_opcode(CompilerOpcode::Pop);
}
Ok(())
}
fn do_struct_compile(sd: &StructDecl, params: &mut CompileParams) -> CompilationResult {
let self_name = StringLiteral {
loc: sd.loc.clone(),
value: sd.name.value.clone(),
};
self_name.do_compile(params)?;
params
.writer
.get_current_block()
.write_opcode_and_source_info(CompilerOpcode::BuildStruct, sd.loc.clone());
// Inject mixin includes for each item in the inherits list
let body = if !sd.inherits.is_empty() {
let mut new_body = vec![];
for mixin_expr in &sd.inherits {
new_body.push(StructEntry::MixinInclude(Box::new(MixinIncludeDecl {
loc: sd.loc.clone(),
what: mixin_expr.clone(),
})));
}
new_body.extend_from_slice(&sd.body);
new_body
} else {
sd.body.clone()
};
emit_type_members_compile(&body, params, false)
}
fn do_enum_compile<T>(
ed: &EnumDecl,
params: &mut CompileParams,
name_writer: T,
) -> CompilationResult
where
T: FnOnce(&str, &mut CompileParams) -> CompilationResult,
{
let self_name = StringLiteral {
loc: ed.loc.clone(),
value: ed.name.value.clone(),
};
self_name.do_compile(params)?;
params
.writer
.get_current_block()
.write_opcode_and_source_info(CompilerOpcode::BuildEnum, ed.loc.clone());
name_writer(&ed.name.value, params)?;
let mut cases: Vec<EnumCaseDecl> = vec![];
let mut entries: Vec<StructEntry> = vec![];
for ede in &ed.body {
match ede {
EnumDeclEntry::EnumCaseDecl(case) => cases.push(case.clone()),
EnumDeclEntry::StructEntry(entry) => entries.push(entry.clone()),
}
}
let enum_helper_methods = generate_case_helpers_extension_for_enum(&cases);
emit_type_members_compile(&enum_helper_methods, params, false)?;
emit_type_members_compile(&entries, params, false)?;
emit_enum_cases(&cases, params)?;
params
.writer
.get_current_block()
.write_opcode_and_source_info(CompilerOpcode::Pop, ed.loc.clone());
Ok(())
}
fn generate_is_case_helper_for_enum(case: &EnumCaseDecl) -> MethodDecl {
let return_true_stmt = ReturnStatement::from(&Expression::from(&Identifier {
loc: case.loc.clone(),
value: "true".to_owned(),
}));
let return_false_stmt = ReturnStatement::from(&Expression::from(&Identifier {
loc: case.loc.clone(),
value: "false".to_owned(),
}));
let match_case_pattern = MatchPatternEnumCase {
loc: case.loc.clone(),
case: case.name.clone(),
payload: None,
};
let match_rule = MatchRule {
loc: case.loc.clone(),
patterns: vec![MatchPattern::MatchPatternEnumCase(match_case_pattern)],
then: CodeBlock::from(&Statement::ReturnStatement(return_true_stmt)),
};
let match_statement = MatchStatement {
loc: case.loc.clone(),
expr: Expression::from(&Identifier {
loc: case.loc.clone(),
value: "this".to_owned(),
}),
rules: vec![match_rule],
els: Some(ElsePiece {
loc: case.loc.clone(),
then: CodeBlock::from(&Statement::ReturnStatement(return_false_stmt)),
}),
};
let method_body = FunctionBody {
code: CodeBlock::from(&Statement::MatchStatement(match_statement)),
};
MethodDecl {
loc: case.loc.clone(),
access: MethodAccess::Instance,
name: Identifier {
loc: case.loc.clone(),
value: format!("is_{}", case.name.value),
},
args: ArgumentList::empty(case.loc.clone()),
body: method_body,
}
}
fn generate_unwap_case_helper_for_enum(case: &EnumCaseDecl) -> MethodDecl {
assert!(case.payload.is_some());
let return_true_stmt = ReturnStatement::from(&Expression::from(&Identifier {
loc: case.loc.clone(),
value: "__case_payload".to_owned(),
}));
let assert_false_stmt = AssertStatement {
loc: case.loc.clone(),
val: Expression::from(&Identifier {
loc: case.loc.clone(),
value: "false".to_owned(),
}),
};
let match_case_pattern = MatchPatternEnumCase {
loc: case.loc.clone(),
case: case.name.clone(),
payload: Some(DeclarationId {
loc: case.loc.clone(),
name: Identifier {
loc: case.loc.clone(),
value: "__case_payload".to_owned(),
},
ty: None,
}),
};
let match_rule = MatchRule {
loc: case.loc.clone(),
patterns: vec![MatchPattern::MatchPatternEnumCase(match_case_pattern)],
then: CodeBlock::from(&Statement::ReturnStatement(return_true_stmt)),
};
let match_statement = MatchStatement {
loc: case.loc.clone(),
expr: Expression::from(&Identifier {
loc: case.loc.clone(),
value: "this".to_owned(),
}),
rules: vec![match_rule],
els: Some(ElsePiece {
loc: case.loc.clone(),
then: CodeBlock::from(&Statement::AssertStatement(assert_false_stmt)),
}),
};
let method_body = FunctionBody {
code: CodeBlock::from(&Statement::MatchStatement(match_statement)),
};
MethodDecl {
loc: case.loc.clone(),
access: MethodAccess::Instance,
name: Identifier {
loc: case.loc.clone(),
value: format!("unwrap_{}", case.name.value),
},
args: ArgumentList::empty(case.loc.clone()),
body: method_body,
}
}
fn generate_case_helpers_extension_for_enum(cases: &[EnumCaseDecl]) -> Vec<StructEntry> {
let mut entries: Vec<StructEntry> = vec![];
for case in cases {
entries.push(StructEntry::Method(Box::new(
generate_is_case_helper_for_enum(case),
)));
if case.payload.is_some() {
entries.push(StructEntry::Method(Box::new(
generate_unwap_case_helper_for_enum(case),
)));
}
}
entries
}
// assume your parent enum is on the stack
fn emit_enum_cases(cases: &[EnumCaseDecl], params: &mut CompileParams) -> CompilationResult {
for case in cases {
case.do_compile(params)?;
}
Ok(())
}
pub(crate) fn compile_from_ast(
ast: &ParsedModule,
options: &CompilationOptions,
) -> CompilationResult<CompiledModule, Vec<CompilationError>> {
let mut dest = CompiledModule::default();
let scope = CompilationScope::module();
let mut mod_init_bytecode = FunctionBuilder::default();
let cflow = ControlFlowTargets::default();
let mut c_params = CompileParams {
module: &mut dest,
scope: &scope,
writer: &mut mod_init_bytecode,
cflow: &cflow,
options,
};
ast.do_compile(&mut c_params)?;
Ok(dest)
}
pub(crate) fn compile_from_source(
src: &SourceBuffer,
options: &CompilationOptions,
) -> CompilationResult<CompiledModule, Vec<CompilationError>> {
let ast = match source_to_ast(src) {
Ok(ast) => ast,
Err(err) => {
return Err(vec![CompilationError {
loc: err.loc,
reason: CompilationErrorReason::ParserError(err.msg),
}]);
}
};
compile_from_ast(&ast, options).map(|mut module| {
// The source buffer name is the cannonalized path to the source file if it was created from a file.
// Once we check it is an existing file, we can use it to find the widget path.
let src_path = PathBuf::from(&src.name);
module.widget_root_path = if src_path.exists() {
// Ensure the source buffer name is a file path
debug_assert!(src_path.is_file());
let mut ancestors = src_path.ancestors();
loop {
if let Some(widget_path) = ancestors.next() {
let widget_json = widget_path.join("widget.json");
if !widget_json.exists() {
continue;
}
break Some(widget_path.to_path_buf());
}
break None;
}
} else {
None
};
module
})
}
================================================
FILE: compiler-lib/src/do_compile/nodes/add_operation.rs
================================================
// SPDX-License-Identifier: Apache-2.0
use crate::{
builder::compiler_opcodes::CompilerOpcode,
do_compile::{CompilationResult, CompileNode, CompileParams},
};
impl<'a> CompileNode<'a> for aria_parser::ast::AddOperation {
fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
self.left.do_compile(params)?;
for right in &self.right {
right.1.do_compile(params)?;
params
.writer
.get_current_block()
.write_opcode_and_source_info(
match right.0 {
aria_parser::ast::AddSymbol::Plus => CompilerOpcode::Add,
aria_parser::ast::AddSymbol::Minus => CompilerOpcode::Sub,
},
self.loc.clone(),
);
}
Ok(())
}
}
================================================
FILE: compiler-lib/src/do_compile/nodes/assert_statement.rs
================================================
// SPDX-License-Identifier: Apache-2.0
use aria_parser::ast::prettyprint::{PrettyPrintable, printout_accumulator::PrintoutAccumulator};
use crate::{
builder::compiler_opcodes::CompilerOpcode,
constant_value::ConstantValue,
do_compile::{CompilationResult, CompileNode, CompileParams},
};
impl<'a> CompileNode<'a> for aria_parser::ast::AssertStatement {
fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
self.val.do_compile(params)?;
let poa = PrintoutAccumulator::default();
let poa = self.val.prettyprint(poa).value();
let msg_idx = self.insert_const_or_fail(params, ConstantValue::String(poa), &self.loc)?;
params
.writer
.get_current_block()
.write_opcode_and_source_info(CompilerOpcode::Assert(msg_idx), self.loc.clone());
Ok(())
}
}
================================================
FILE: compiler-lib/src/do_compile/nodes/assign_statement.rs
================================================
// SPDX-License-Identifier: Apache-2.0
use aria_parser::ast::{
DeclarationId, Expression, Identifier, IntLiteral, Primary, Statement, ValDeclEntry,
ValDeclStatement,
};
use crate::do_compile::{CompilationResult, CompileNode, CompileParams, postfix::PostfixValue};
impl<'a> CompileNode<'a> for aria_parser::ast::AssignStatement {
fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
if self.id.len() != self.val.len() {
return Err(crate::do_compile::CompilationError {
loc: self.loc.clone(),
reason: crate::do_compile::CompilationErrorReason::AssignmentArityMismatch(
self.id.len(),
self.val.len(),
),
});
}
if self.id.len() == 1 {
let pv = PostfixValue::from(&self.id[0]);
pv.emit_write(&self.val[0], params)
} else {
let temp_buffer_store = Identifier {
loc: self.loc.clone(),
value: format!("__multiwrite_temp_store{:?}", self.loc.location),
};
let zero_val = Expression::from(&Primary::IntLiteral(IntLiteral {
loc: self.loc.clone(),
base: aria_parser::ast::IntLiteralBase::Decimal,
val: "0".to_string(),
}));
let temp_buffer_expression = Expression::from(&temp_buffer_store.clone());
Statement::ValDeclStatement(ValDeclStatement {
loc: self.loc.clone(),
decls: vec![ValDeclEntry {
loc: self.loc.clone(),
id: DeclarationId::from(&temp_buffer_store),
val: zero_val,
}],
})
.do_compile(params)?;
for rhs in self.val.iter().rev() {
rhs.do_compile(params)?;
}
for lhs in self.id.iter() {
params.scope.emit_write(
&temp_buffer_store.value,
&mut params.module.constants,
params.writer.get_current_block(),
lhs.loc.clone(),
)?;
let pv = PostfixValue::from(lhs);
pv.emit_write(&temp_buffer_expression, params)?;
}
Ok(())
}
}
}
================================================
FILE: compiler-lib/src/do_compile/nodes/break_statement.rs
================================================
// SPDX-License-Identifier: Apache-2.0
use crate::{
builder::compiler_opcodes::CompilerOpcode,
do_compile::{
CompilationError, CompilationErrorReason, CompilationResult, CompileNode, CompileParams,
},
};
impl<'a> CompileNode<'a> for aria_parser::ast::BreakStatement {
fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
if let Some(break_target) = ¶ms.cflow.break_dest {
params
.writer
.get_current_block()
.write_opcode_and_source_info(
CompilerOpcode::Jump(break_target.clone()),
self.loc.clone(),
);
Ok(())
} else {
Err(CompilationError {
loc: self.loc.clone(),
reason: CompilationErrorReason::FlowControlNotAllowed,
})
}
}
}
================================================
FILE: compiler-lib/src/do_compile/nodes/code_block.rs
================================================
// SPDX-License-Identifier: Apache-2.0
use crate::do_compile::{CompilationResult, CompileNode, CompileParams};
impl<'a> CompileNode<'a> for aria_parser::ast::CodeBlock {
fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
let c_scope = params.scope.child();
let mut c_params = CompileParams {
module: params.module,
scope: &c_scope,
writer: params.writer,
cflow: params.cflow,
options: params.options,
};
for entry in &self.entries {
entry.do_compile(&mut c_params)?;
}
Ok(())
}
}
================================================
FILE: compiler-lib/src/do_compile/nodes/comp_operation.rs
================================================
// SPDX-License-Identifier: Apache-2.0
use crate::{
builder::compiler_opcodes::CompilerOpcode,
do_compile::{CompilationResult, CompileNode, CompileParams},
};
impl<'a> CompileNode<'a> for aria_parser::ast::CompOperation {
fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
self.left.do_compile(params)?;
if let Some(right) = &self.right {
right.1.do_compile(params)?;
match right.0 {
aria_parser::ast::CompSymbol::Equal => params
.writer
.get_current_block()
.write_opcode_and_source_info(CompilerOpcode::Equal, self.loc.clone()),
aria_parser::ast::CompSymbol::NotEqual => params
.writer
.get_current_block()
.write_opcode_and_source_info(CompilerOpcode::Equal, self.loc.clone())
.write_opcode_and_source_info(CompilerOpcode::Not, self.loc.clone()),
aria_parser::ast::CompSymbol::Isa => params
.writer
.get_current_block()
.write_opcode_and_source_info(CompilerOpcode::Isa, self.loc.clone()),
};
}
Ok(())
}
}
================================================
FILE: compiler-lib/src/do_compile/nodes/continue_statement.rs
================================================
// SPDX-License-Identifier: Apache-2.0
use crate::{
builder::compiler_opcodes::CompilerOpcode,
do_compile::{
CompilationError, CompilationErrorReason, CompilationResult, CompileNode, CompileParams,
},
};
impl<'a> CompileNode<'a> for aria_parser::ast::ContinueStatement {
fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
if let Some(continue_target) = ¶ms.cflow.continue_dest {
params
.writer
.get_current_block()
.write_opcode_and_source_info(
CompilerOpcode::Jump(continue_target.clone()),
self.loc.clone(),
);
Ok(())
} else {
Err(CompilationError {
loc: self.loc.clone(),
reason: CompilationErrorReason::FlowControlNotAllowed,
})
}
}
}
================================================
FILE: compiler-lib/src/do_compile/nodes/enum_case_decl.rs
================================================
// SPDX-License-Identifier: Apache-2.0
use haxby_opcodes::enum_case_attribs::CASE_HAS_PAYLOAD;
use crate::{
builder::compiler_opcodes::CompilerOpcode,
constant_value::ConstantValue,
do_compile::{CompilationResult, CompileNode, CompileParams},
};
impl<'a> CompileNode<'a> for aria_parser::ast::EnumCaseDecl {
fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult<()> {
params
.writer
.get_current_block()
.write_opcode_and_source_info(CompilerOpcode::Dup, self.loc.clone());
let attrib_byte = match &self.payload {
Some(expr) => {
expr.do_compile(params)?;
CASE_HAS_PAYLOAD
}
None => 0,
};
let name_idx = self.insert_const_or_fail(
params,
ConstantValue::String(self.name.value.clone()),
&self.loc,
)?;
params
.writer
.get_current_block()
.write_opcode_and_source_info(
CompilerOpcode::BindCase(attrib_byte, name_idx),
self.loc.clone(),
);
Ok(())
}
}
================================================
FILE: compiler-lib/src/do_compile/nodes/enum_decl.rs
================================================
// SPDX-License-Identifier: Apache-2.0
use crate::{
builder::compiler_opcodes::CompilerOpcode,
do_compile::{CompilationResult, CompileNode, CompileParams, do_enum_compile},
};
impl<'a> CompileNode<'a> for aria_parser::ast::EnumDecl {
fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
do_enum_compile(self, params, |name, params| {
params
.writer
.get_current_block()
.write_opcode_and_source_info(CompilerOpcode::Dup, self.loc.clone());
params
.scope
.emit_untyped_define(
name,
&mut params.module.constants,
params.writer.get_current_block(),
self.loc.clone(),
)
.map_err(Into::into)
})
}
}
================================================
FILE: compiler-lib/src/do_compile/nodes/expression.rs
================================================
// SPDX-License-Identifier: Apache-2.0
use crate::do_compile::{CompilationResult, CompileNode, CompileParams};
impl<'a> CompileNode<'a> for aria_parser::ast::Expression {
fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
match self {
Self::LogOperation(lo) => lo.do_compile(params),
Self::LambdaFunction(lf) => lf.do_compile(params),
Self::TernaryExpression(te) => te.do_compile(params),
Self::TryUnwrapExpression(te) => te.do_compile(params),
}
}
}
================================================
FILE: compiler-lib/src/do_compile/nodes/expression_list.rs
================================================
// SPDX-License-Identifier: Apache-2.0
use crate::do_compile::{CompilationResult, CompileNode, CompileParams};
impl<'a> CompileNode<'a, usize> for aria_parser::ast::ExpressionList {
fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult<usize> {
for expr in &self.expressions {
expr.do_compile(params)?;
}
Ok(self.expressions.len())
}
}
================================================
FILE: compiler-lib/src/do_compile/nodes/expression_statement.rs
================================================
// SPDX-License-Identifier: Apache-2.0
use crate::do_compile::{CompilationResult, CompileNode, CompileParams};
impl<'a> CompileNode<'a> for aria_parser::ast::ExpressionStatement {
fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
if let Some(val) = &self.val {
val.do_compile(params)?;
params
.writer
.get_current_block()
.write_opcode_and_source_info(
crate::builder::compiler_opcodes::CompilerOpcode::Pop,
self.loc.clone(),
);
}
Ok(())
}
}
================================================
FILE: compiler-lib/src/do_compile/nodes/extension_decl.rs
================================================
// SPDX-License-Identifier: Apache-2.0
use crate::do_compile::{
CompilationResult, CompileNode, CompileParams, MixinIncludeDecl, StructEntry,
emit_type_members_compile,
};
impl<'a> CompileNode<'a> for aria_parser::ast::ExtensionDecl {
fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
self.target.do_compile(params)?;
// Inject mixin includes for each item in the inherits list
if !self.inherits.is_empty() {
let mut new_body = vec![];
for mixin_expr in &self.inherits {
new_body.push(StructEntry::MixinInclude(Box::new(MixinIncludeDecl {
loc: self.loc.clone(),
what: mixin_expr.clone(),
})));
}
new_body.extend_from_slice(&self.body);
emit_type_members_compile(&new_body, params, true)
} else {
emit_type_members_compile(&self.body, params, true)
}
}
}
================================================
FILE: compiler-lib/src/do_compile/nodes/float_literal.rs
================================================
// SPDX-License-Identifier: Apache-2.0
use crate::{
builder::compiler_opcodes::CompilerOpcode,
constant_value::ConstantValue,
do_compile::{
CompilationError, CompilationErrorReason, CompilationResult, CompileNode, CompileParams,
},
};
impl<'a> CompileNode<'a> for aria_parser::ast::FloatLiteral {
fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
let fp_val = self
.val
.strip_suffix("f")
.unwrap_or(&self.val)
.parse::<f64>()
.map_err(|_| CompilationError {
loc: self.loc.clone(),
reason: CompilationErrorReason::InvalidLiteral(self.val.clone()),
})?;
let const_idx =
self.insert_const_or_fail(params, ConstantValue::Float(fp_val.into()), &self.loc)?;
params
.writer
.get_current_block()
.write_opcode_and_source_info(CompilerOpcode::Push(const_idx), self.loc.clone());
Ok(())
}
}
================================================
FILE: compiler-lib/src/do_compile/nodes/for_statement.rs
================================================
// SPDX-License-Identifier: Apache-2.0
use aria_parser::ast::{
AssignStatement, BreakStatement, CodeBlock, DeclarationId, ElsePiece, Expression, Identifier,
IfCondPiece, IfPiece, IfStatement, MatchRule, MatchStatement, ParenExpression,
PostfixExpression, PostfixRvalue, PostfixTerm, PostfixTermEnumCase, Primary, Statement,
ThrowStatement, UnaryOperation, ValDeclEntry, ValDeclStatement, WhileStatement,
};
use crate::do_compile::{CompilationResult, CompileNode, CompileParams};
macro_rules! val_decl_statement {
($loc:expr, $id:expr, $val:expr) => {
Statement::ValDeclStatement(ValDeclStatement {
loc: $loc,
decls: vec![ValDeclEntry {
loc: $loc,
id: DeclarationId::from(&Identifier {
loc: $loc,
value: $id.clone(),
}),
val: $val,
}],
})
};
}
impl<'a> CompileNode<'a> for aria_parser::ast::ForStatement {
fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
// the else block makes the logic here quite tricky and worth commenting
// essentially it boils down to the following logic:
// {
// val iter = <iterator expr>;
// val any_hit = false;
// while true {
// val next = iter.next();
// match next {
// case Some(x) => {
// any_hit = true;
// val x = next.value;
// <body of the loop>
// }
// case None => {
// if !any_hit {
// <else clause if any>
// }
// break; # out of the while loop
// }
// }
// }
// }
// this is the iterator
let iter_name_ident = Identifier {
loc: self.loc.clone(),
value: format!("__for__iter__{}", self.id.value),
};
// this is the next value from the iterator (the Maybe, not the actual object)
let val_next_ident = Identifier {
loc: self.loc.clone(),
value: format!("__for__next__{}", self.id.value),
};
// this becomes true when the for {} body is executed at least once
let any_hit_ident = Identifier {
loc: self.loc.clone(),
value: format!("__for__any_hit__{}", self.id.value),
};
let fetch_iter_val = val_decl_statement!(
self.loc.clone(),
iter_name_ident.value,
Expression::from(&PostfixExpression::method_call(
&Primary::ParenExpression(ParenExpression::from(&self.expr)),
"iterator",
&[]
))
);
let any_hit_val = val_decl_statement!(
self.loc.clone(),
any_hit_ident.value,
Expression::from(&Identifier {
loc: self.loc.clone(),
value: "false".to_owned(),
})
);
let true_cond = Expression::from(&Identifier {
loc: self.loc.clone(),
value: "true".to_owned(),
});
// val __for__next__ = __for__iter__.next();
let fetch_next_val = val_decl_statement!(
self.loc.clone(),
val_next_ident.value,
Expression::from(&PostfixExpression::method_call(
&Primary::Identifier(iter_name_ident.clone()),
"next",
&[]
))
);
// !__for__any_hit
let check_any_hit_expr = Expression::from(&UnaryOperation {
loc: self.loc.clone(),
operand: Some(aria_parser::ast::UnarySymbol::Exclamation),
postfix: PostfixRvalue {
loc: self.loc.clone(),
expr: PostfixExpression::from(&Primary::Identifier(any_hit_ident.clone())),
},
});
// if !__for__any_hit { <do the else block if any> }
let if_not_any_hit = IfCondPiece {
loc: self.loc.clone(),
expression: Box::new(check_any_hit_expr),
then: CodeBlock {
loc: self.loc.clone(),
entries: if let Some(els) = &self.els {
els.then.entries.clone()
} else {
vec![]
},
},
};
let if_not_any_hit = Statement::IfStatement(IfStatement {
loc: self.loc.clone(),
iff: IfPiece {
content: if_not_any_hit,
},
elsif: vec![],
els: None,
});
// __for__any_hit = true;
let assign_to_any_hit = Statement::AssignStatement(AssignStatement {
loc: self.loc.clone(),
id: vec![PostfixExpression::from(&Primary::Identifier(
any_hit_ident.clone(),
))],
val: vec![true_cond.clone()],
});
// case Some(x)
let case_some_blk = MatchRule::enum_and_case(
self.loc.clone(),
"Maybe",
"Some",
Some(self.id.clone()),
CodeBlock {
loc: self.loc.clone(),
entries: vec![assign_to_any_hit, Statement::CodeBlock(self.then.clone())],
},
);
// case None
let case_none_block = MatchRule::enum_and_case(
self.loc.clone(),
"Maybe",
"None",
None,
CodeBlock {
loc: self.loc.clone(),
entries: vec![
if_not_any_hit,
Statement::BreakStatement(BreakStatement {
loc: self.loc.clone(),
}),
],
},
);
// RuntimeError::UnexpectedType
let unexpected_type = Expression::from(&PostfixExpression {
loc: self.loc.clone(),
base: Primary::Identifier(Identifier {
loc: self.loc.clone(),
value: "RuntimeError".to_owned(),
}),
terms: vec![PostfixTerm::PostfixTermEnumCase(PostfixTermEnumCase {
loc: self.loc.clone(),
id: Identifier {
loc: self.loc.clone(),
value: "UnexpectedType".to_owned(),
},
payload: None,
})],
});
// throw UT
let throw_ut = Statement::ThrowStatement(ThrowStatement {
loc: self.loc.clone(),
val: unexpected_type,
});
// read __for__next
let read_for_next = Expression::from(&PostfixExpression::from(&Primary::Identifier(
val_next_ident.clone(),
)));
// match __for__next { some(x), none, els => throw UT }
let match_for_next = Statement::MatchStatement(MatchStatement {
loc: self.loc.clone(),
expr: read_for_next,
rules: vec![case_some_blk, case_none_block],
els: Some(ElsePiece {
loc: self.loc.clone(),
then: CodeBlock {
loc: self.loc.clone(),
entries: vec![throw_ut],
},
}),
});
// while (true) { fetch_next; match_next; }
let while_body = CodeBlock {
loc: self.loc.clone(),
entries: vec![fetch_next_val, match_for_next],
};
// this is while true { do the body }
let w = Statement::WhileStatement(WhileStatement {
loc: self.loc.clone(),
cond: true_cond,
then: while_body,
els: None,
});
// create the iterator and the any_hit marker, then loop over the iterator
let blk = CodeBlock {
loc: self.loc.clone(),
entries: vec![fetch_iter_val, any_hit_val, w],
};
blk.do_compile(params)
}
}
================================================
FILE: compiler-lib/src/do_compile/nodes/function_body.rs
================================================
// SPDX-License-Identifier: Apache-2.0
use crate::do_compile::{CompilationResult, CompileNode, CompileParams};
impl<'a> CompileNode<'a> for aria_parser::ast::FunctionBody {
fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
self.code.do_compile(params)
}
}
================================================
FILE: compiler-lib/src/do_compile/nodes/function_decl.rs
================================================
// SPDX-License-Identifier: Apache-2.0
use haxby_opcodes::function_attribs::FUNC_ACCEPTS_VARARG;
use crate::{
builder::{compiler_opcodes::CompilerOpcode, func::FunctionBuilder},
constant_value::{CompiledCodeObject, ConstantValue},
do_compile::{
CompilationError, CompilationResult, CompileNode, CompileParams, ControlFlowTargets,
emit_args_at_target,
},
};
impl<'a> CompileNode<'a> for aria_parser::ast::FunctionDecl {
fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
let cflow = ControlFlowTargets::default();
let mut writer = FunctionBuilder::default();
let mut c_params = CompileParams {
module: params.module,
scope: params.scope,
writer: &mut writer,
cflow: &cflow,
options: params.options,
};
let argc = emit_args_at_target(&[], &self.args, &[], &mut c_params)?;
self.body.do_compile(&mut c_params)?;
self.return_unit_value(&mut c_params, &self.loc)?;
let co = match writer.write(¶ms.module.constants, params.options) {
Ok(c) => c,
Err(er) => {
return Err(CompilationError {
loc: self.loc.clone(),
reason: er,
});
}
};
let frame_size = params.scope.as_function_root().unwrap().num_locals();
let line_table = writer.write_line_table().clone();
let a = if self.args.vararg {
FUNC_ACCEPTS_VARARG
} else {
0_u8
};
let cco = CompiledCodeObject {
name: self.name.value.clone(),
attribute: a,
body: co,
required_argc: argc.required_args,
default_argc: argc.default_args,
loc: self.loc.clone(),
line_table,
frame_size,
};
let cco_idx =
self.insert_const_or_fail(params, ConstantValue::CompiledCodeObject(cco), &self.loc)?;
params
.writer
.get_current_block()
.write_opcode_and_source_info(CompilerOpcode::Push(cco_idx), self.loc.clone())
.write_opcode_and_source_info(CompilerOpcode::BuildFunction, self.loc.clone());
for uplv in params
.scope
.as_function_root()
.unwrap()
.uplevels
.borrow()
.iter()
{
params
.writer
.get_current_block()
.write_opcode_and_source_info(
CompilerOpcode::StoreUplevel(uplv.idx_in_uplevel),
self.loc.clone(),
);
}
params
.scope
.get_module_scope()
.unwrap()
.emit_untyped_define(
&self.name.value,
&mut params.module.constants,
params.writer.get_current_block(),
self.loc.clone(),
)?;
Ok(())
}
}
================================================
FILE: compiler-lib/src/do_compile/nodes/identifier.rs
================================================
// SPDX-License-Identifier: Apache-2.0
use crate::do_compile::{CompilationResult, CompileNode, CompileParams};
impl<'a> CompileNode<'a> for aria_parser::ast::Identifier {
fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
params.scope.emit_read(
&self.value,
&mut params.module.constants,
params.writer.get_current_block(),
self.loc.clone(),
)?;
Ok(())
}
}
================================================
FILE: compiler-lib/src/do_compile/nodes/if_statement.rs
================================================
// SPDX-License-Identifier: Apache-2.0
use crate::{
builder::compiler_opcodes::CompilerOpcode,
do_compile::{CompilationResult, CompileNode, CompileParams},
};
impl<'a> CompileNode<'a> for aria_parser::ast::IfStatement {
fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
let after_all = params
.writer
.append_block_at_end(&format!("after_all_{}", self.loc));
// a trivial if is of the form
// if foo {
// bar
//}
// in which case, we can simply emit a jump to "after all", i.e. compile as
// <foo>
// JUMP_FALSE <after_all>
// <then>...
// JUMP <after_all> since the block needs to be terminated
// <after_all>...
let is_trivial_if = self.elsif.is_empty() && self.els.is_none();
// compile the first if
{
self.iff.content.expression.do_compile(params)?;
let if_true = params.writer.insert_block_after(
&format!("if_true_{}", self.loc),
¶ms.writer.get_current_block(),
);
let if_false = params
.writer
.insert_block_after(&format!("if_false_{}", self.loc), &if_true);
if is_trivial_if {
params
.writer
.get_current_block()
.write_opcode_and_source_info(
CompilerOpcode::JumpFalse(after_all.clone()),
self.iff.content.loc.clone(),
);
} else {
params
.writer
.get_current_block()
.write_opcode_and_source_info(
CompilerOpcode::JumpConditionally(if_true.clone(), if_false.clone()),
self.iff.content.loc.clone(),
);
params.writer.set_current_block(if_true);
}
self.iff.content.then.do_compile(params)?;
params
.writer
.get_current_block()
.write_opcode_and_source_info(
CompilerOpcode::Jump(after_all.clone()),
self.iff.content.loc.clone(),
);
params.writer.set_current_block(if_false);
}
// compile every elsif
{
for elsif in &self.elsif {
elsif.content.expression.do_compile(params)?;
let if_true = params.writer.insert_block_after(
&format!("if_true_{}", self.loc),
¶ms.writer.get_current_block(),
);
let if_false = params
.writer
.insert_block_after(&format!("if_false_{}", self.loc), &if_true);
params
.writer
.get_current_block()
.write_opcode_and_source_info(
CompilerOpcode::JumpConditionally(if_true.clone(), if_false.clone()),
elsif.content.then.loc.clone(),
);
params.writer.set_current_block(if_true);
elsif.content.then.do_compile(params)?;
params
.writer
.get_current_block()
.write_opcode_and_source_info(
CompilerOpcode::Jump(after_all.clone()),
elsif.content.loc.clone(),
);
params.writer.set_current_block(if_false);
}
}
// compile the else
{
if let Some(els) = &self.els {
els.then.do_compile(params)?;
}
}
if !is_trivial_if {
// jump to after all
params
.writer
.get_current_block()
.write_opcode_and_source_info(
CompilerOpcode::Jump(after_all.clone()),
self.loc.clone(),
);
}
params.writer.set_current_block(after_all);
Ok(())
}
}
================================================
FILE: compiler-lib/src/do_compile/nodes/import_from_statement.rs
================================================
// SPDX-License-Identifier: Apache-2.0
use haxby_opcodes::BuiltinValueId;
use crate::{
builder::compiler_opcodes::CompilerOpcode,
constant_value::ConstantValue,
do_compile::{CompilationResult, CompileNode, CompileParams},
};
impl<'a> CompileNode<'a> for aria_parser::ast::ImportFromStatement {
fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
let path_idx = self.insert_const_or_fail(
params,
ConstantValue::String(self.from.to_dotted_string()),
&self.loc,
)?;
match &self.what {
aria_parser::ast::ImportTarget::IdentifierList(identifiers) => {
for identifier in &identifiers.identifiers {
let ident_idx = self.insert_const_or_fail(
params,
ConstantValue::String(identifier.value.clone()),
&self.loc,
)?;
params
.writer
.get_current_block()
.write_opcode_and_source_info(
CompilerOpcode::Import(path_idx),
self.loc.clone(),
)
.write_opcode_and_source_info(
CompilerOpcode::ReadAttribute(ident_idx),
self.loc.clone(),
);
params.scope.emit_untyped_define(
&identifier.value,
&mut params.module.constants,
params.writer.get_current_block(),
self.loc.clone(),
)?;
}
}
aria_parser::ast::ImportTarget::All => {
let path_idx = self.insert_const_or_fail(
params,
ConstantValue::String(self.from.to_dotted_string()),
&self.loc,
)?;
params
.writer
.get_current_block()
.write_opcode_and_source_info(
CompilerOpcode::Import(path_idx),
self.loc.clone(),
)
.write_opcode_and_source_info(
CompilerOpcode::PushRuntimeValue(BuiltinValueId::ThisModule),
self.loc.clone(),
)
.write_opcode_and_source_info(CompilerOpcode::LiftModule, self.loc.clone());
}
}
Ok(())
}
}
================================================
FILE: compiler-lib/src/do_compile/nodes/import_statement.rs
================================================
// SPDX-License-Identifier: Apache-2.0
use crate::{
builder::compiler_opcodes::CompilerOpcode,
constant_value::ConstantValue,
do_compile::{CompilationResult, CompileNode, CompileParams},
};
impl<'a> CompileNode<'a> for aria_parser::ast::ImportStatement {
fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
let path_idx = self.insert_const_or_fail(
params,
ConstantValue::String(self.what.to_dotted_string()),
&self.loc,
)?;
params
.writer
.get_current_block()
.write_opcode_and_source_info(CompilerOpcode::Import(path_idx), self.loc.clone());
Ok(())
}
}
================================================
FILE: compiler-lib/src/do_compile/nodes/int_literal.rs
================================================
// SPDX-License-Identifier: Apache-2.0
use crate::{
builder::compiler_opcodes::CompilerOpcode,
constant_value::ConstantValue,
do_compile::{
CompilationError, CompilationErrorReason, CompilationResult, CompileNode, CompileParams,
},
};
impl<'a> CompileNode<'a> for aria_parser::ast::IntLiteral {
fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
let inp_str = &self.val.replace('_', "");
// I don't particularly like this code, but I don't know an easy way to write
// if X { Result<A,E> } else if XX { Result<B,E> } ... . map_err(...)? as B;
// basically, some paths want to generate a u64 and some want to generate an i64,
// but all need to converge on i64 in the end.
let val = if let Some(hex_str) = inp_str.strip_prefix("0x") {
u64::from_str_radix(hex_str, 16).map_err(|_| CompilationError {
loc: self.loc.clone(),
reason: CompilationErrorReason::InvalidLiteral(inp_str.to_owned()),
})? as i64
} else if let Some(bin_str) = inp_str.strip_prefix("0b") {
u64::from_str_radix(bin_str, 2).map_err(|_| CompilationError {
loc: self.loc.clone(),
reason: Compilation
gitextract_91w9n8tq/
├── .github/
│ ├── dependabot.yml
│ └── workflows/
│ ├── clippy.yml
│ ├── fmt.yml
│ ├── linux_build_test.yml
│ ├── macos_build_test.yml
│ ├── release.yml
│ ├── slash_clippy.yml
│ └── slash_fmt.yml
├── .gitignore
├── .pre-commit-config.yaml
├── CHANGELOG.md
├── CODEOWNERS
├── Cargo.toml
├── Dockerfile
├── LICENSE
├── README.md
├── add_license_marker.sh
├── aria
├── aria-bin/
│ ├── Cargo.toml
│ ├── src/
│ │ ├── error_reporting.rs
│ │ ├── error_reporting_test/
│ │ │ ├── expected.txt
│ │ │ ├── main.aria
│ │ │ └── util.aria
│ │ ├── file_eval.rs
│ │ ├── main.rs
│ │ ├── repl_eval.rs
│ │ ├── repl_preamble.aria
│ │ └── test.rs
│ ├── test_assert.aria
│ └── test_uncaught_exception.aria
├── b
├── ci_tests.sh
├── compiler-lib/
│ ├── Cargo.toml
│ └── src/
│ ├── bc_reader.rs
│ ├── bc_writer.rs
│ ├── builder/
│ │ ├── block.rs
│ │ ├── compiler_opcodes.rs
│ │ ├── func.rs
│ │ └── mod.rs
│ ├── constant_value.rs
│ ├── do_compile/
│ │ ├── mod.rs
│ │ ├── nodes/
│ │ │ ├── add_operation.rs
│ │ │ ├── assert_statement.rs
│ │ │ ├── assign_statement.rs
│ │ │ ├── break_statement.rs
│ │ │ ├── code_block.rs
│ │ │ ├── comp_operation.rs
│ │ │ ├── continue_statement.rs
│ │ │ ├── enum_case_decl.rs
│ │ │ ├── enum_decl.rs
│ │ │ ├── expression.rs
│ │ │ ├── expression_list.rs
│ │ │ ├── expression_statement.rs
│ │ │ ├── extension_decl.rs
│ │ │ ├── float_literal.rs
│ │ │ ├── for_statement.rs
│ │ │ ├── function_body.rs
│ │ │ ├── function_decl.rs
│ │ │ ├── identifier.rs
│ │ │ ├── if_statement.rs
│ │ │ ├── import_from_statement.rs
│ │ │ ├── import_statement.rs
│ │ │ ├── int_literal.rs
│ │ │ ├── lambda.rs
│ │ │ ├── list_literal.rs
│ │ │ ├── logical_operation.rs
│ │ │ ├── match_pattern.rs
│ │ │ ├── match_pattern_comp.rs
│ │ │ ├── match_pattern_enum_case.rs
│ │ │ ├── match_pattern_rel.rs
│ │ │ ├── match_statement.rs
│ │ │ ├── method_decl.rs
│ │ │ ├── mixin_decl.rs
│ │ │ ├── mod.rs
│ │ │ ├── mul_operation.rs
│ │ │ ├── paren_expression.rs
│ │ │ ├── parsed_module.rs
│ │ │ ├── postfix_rvalue.rs
│ │ │ ├── primary.rs
│ │ │ ├── rel_operation.rs
│ │ │ ├── return_statement.rs
│ │ │ ├── shift_operation.rs
│ │ │ ├── statement.rs
│ │ │ ├── string_literal.rs
│ │ │ ├── struct_decl.rs
│ │ │ ├── ternary_expression.rs
│ │ │ ├── throw_statement.rs
│ │ │ ├── try_block.rs
│ │ │ ├── try_unwrap_expression.rs
│ │ │ ├── unary_operation.rs
│ │ │ ├── val_decl_entry.rs
│ │ │ ├── val_decl_statement.rs
│ │ │ ├── while_statement.rs
│ │ │ └── write_opeq_statement.rs
│ │ └── postfix.rs
│ ├── dump/
│ │ ├── mod.rs
│ │ └── opcodes.rs
│ ├── lib.rs
│ ├── line_table.rs
│ ├── module.rs
│ └── scope.rs
├── docker/
│ └── release/
│ └── Dockerfile
├── docs/
│ └── index.html
├── examples/
│ ├── 99bottles.aria
│ ├── add_license_marker.aria
│ ├── advent_of_code_2024_day1.aria
│ ├── advent_of_code_2024_day2.aria
│ ├── advent_of_code_2024_day3.aria
│ ├── command_line_args.aria
│ ├── currency.aria
│ ├── dir.aria
│ ├── fibonacci.aria
│ ├── fibonacci_memoized.aria
│ ├── fizzbuzz.aria
│ ├── github_user.aria
│ ├── hello.aria
│ ├── parser.aria
│ ├── peano.aria
│ ├── pi.aria
│ ├── sieve.aria
│ └── string_escapes.aria
├── lib/
│ └── aria/
│ ├── core/
│ │ ├── arity.aria
│ │ ├── bool.aria
│ │ ├── box.aria
│ │ ├── builtin.aria
│ │ ├── float.aria
│ │ ├── int.aria
│ │ ├── list.aria
│ │ ├── maybe.aria
│ │ ├── nothing.aria
│ │ ├── result.aria
│ │ ├── runtime_error.aria
│ │ ├── string.aria
│ │ ├── unimplemented.aria
│ │ └── unit.aria
│ ├── date/
│ │ ├── instant.aria
│ │ └── timezone.aria
│ ├── io/
│ │ ├── file.aria
│ │ └── path.aria
│ ├── iterator/
│ │ ├── enumerate.aria
│ │ ├── mixin.aria
│ │ └── zip.aria
│ ├── json/
│ │ ├── parser.aria
│ │ ├── value.aria
│ │ └── writer.aria
│ ├── network/
│ │ ├── request.aria
│ │ └── retry.aria
│ ├── numerics/
│ │ ├── complex.aria
│ │ ├── decimal.aria
│ │ ├── float/
│ │ │ ├── exp.aria
│ │ │ └── trig.aria
│ │ ├── int/
│ │ │ └── pow.aria
│ │ └── matrix.aria
│ ├── ordering/
│ │ ├── compare.aria
│ │ └── utils.aria
│ ├── range/
│ │ ├── int_extension.aria
│ │ └── range.aria
│ ├── rng/
│ │ ├── mixin.aria
│ │ ├── msws.aria
│ │ └── xorshift.aria
│ ├── string/
│ │ ├── classes.aria
│ │ └── regex.aria
│ ├── structures/
│ │ ├── hash/
│ │ │ ├── algo/
│ │ │ │ └── sip.aria
│ │ │ └── list.aria
│ │ ├── map.aria
│ │ ├── queue.aria
│ │ ├── set.aria
│ │ └── stack.aria
│ ├── system/
│ │ ├── coloring.aria
│ │ └── platform.aria
│ ├── test/
│ │ └── test.aria
│ └── utils/
│ └── guard.aria
├── lib-test/
│ ├── README.md
│ ├── all/
│ │ └── source.aria
│ ├── attributes/
│ │ └── things.aria
│ ├── base_module/
│ │ └── nested_module/
│ │ └── content.aria
│ ├── circular/
│ │ ├── one.aria
│ │ ├── two.aria
│ │ └── zero.aria
│ ├── cool_widget/
│ │ ├── buzz.aria
│ │ ├── lib.aria
│ │ └── widget.json
│ ├── example/
│ │ ├── pair/
│ │ │ └── Pair.aria
│ │ └── two/
│ │ └── things.aria
│ ├── exported_var/
│ │ └── source.aria
│ ├── ext/
│ │ └── string.aria
│ ├── extensible/
│ │ ├── base.aria
│ │ └── ext.aria
│ ├── multiple/
│ │ └── module.aria
│ ├── other_widget/
│ │ ├── a.aria
│ │ ├── mod/
│ │ │ └── b.aria
│ │ └── widget.json
│ ├── same_root/
│ │ └── part1/
│ │ ├── file1.aria
│ │ ├── file2.aria
│ │ └── file3.aria
│ ├── test_things.aria
│ └── with_err/
│ └── error.aria
├── lsp/
│ ├── Cargo.toml
│ └── src/
│ ├── document.rs
│ ├── lexer.rs
│ ├── lib.rs
│ ├── main.rs
│ └── parser.rs
├── microbenchmarks/
│ ├── attribute_read.aria
│ ├── attribute_write.aria
│ ├── enum_case.aria
│ ├── infra.aria
│ ├── int_arith.aria
│ ├── list_filled.aria
│ ├── list_from_closure.aria
│ ├── list_read.aria
│ ├── list_write.aria
│ ├── map_loop.aria
│ ├── method_call.aria
│ └── sieve.aria
├── native-libs/
│ ├── file/
│ │ ├── Cargo.toml
│ │ └── src/
│ │ └── lib.rs
│ ├── network/
│ │ ├── Cargo.toml
│ │ └── src/
│ │ └── lib.rs
│ ├── path/
│ │ ├── Cargo.toml
│ │ └── src/
│ │ └── lib.rs
│ ├── platform/
│ │ ├── Cargo.toml
│ │ └── src/
│ │ └── lib.rs
│ ├── regex/
│ │ ├── Cargo.toml
│ │ └── src/
│ │ └── lib.rs
│ ├── timezone/
│ │ ├── Cargo.toml
│ │ └── src/
│ │ └── lib.rs
│ └── unicode/
│ ├── Cargo.toml
│ └── src/
│ └── lib.rs
├── opcodes-lib/
│ ├── Cargo.toml
│ └── src/
│ └── lib.rs
├── package.sh
├── parser-lib/
│ ├── Cargo.toml
│ └── src/
│ ├── ast/
│ │ ├── derive/
│ │ │ └── mod.rs
│ │ ├── mod.rs
│ │ ├── nodes/
│ │ │ ├── add_eq_symbol.rs
│ │ │ ├── add_operation.rs
│ │ │ ├── add_symbol.rs
│ │ │ ├── argument_decl.rs
│ │ │ ├── argument_list.rs
│ │ │ ├── assert_statement.rs
│ │ │ ├── assign_statement.rs
│ │ │ ├── break_statement.rs
│ │ │ ├── code_block.rs
│ │ │ ├── comp_operation.rs
│ │ │ ├── comp_symbol.rs
│ │ │ ├── continue_statement.rs
│ │ │ ├── declaration_id.rs
│ │ │ ├── else_piece.rs
│ │ │ ├── elsif_piece.rs
│ │ │ ├── enum_case_decl.rs
│ │ │ ├── enum_decl.rs
│ │ │ ├── enum_decl_entry.rs
│ │ │ ├── expression.rs
│ │ │ ├── expression_list.rs
│ │ │ ├── expression_statement.rs
│ │ │ ├── extension_decl.rs
│ │ │ ├── float_literal.rs
│ │ │ ├── for_statement.rs
│ │ │ ├── function_body.rs
│ │ │ ├── function_decl.rs
│ │ │ ├── identifier.rs
│ │ │ ├── identifier_list.rs
│ │ │ ├── if_cond_piece.rs
│ │ │ ├── if_piece.rs
│ │ │ ├── if_statement.rs
│ │ │ ├── import_from_statement.rs
│ │ │ ├── import_path.rs
│ │ │ ├── import_statement.rs
│ │ │ ├── import_target.rs
│ │ │ ├── int_literal.rs
│ │ │ ├── lambda_body.rs
│ │ │ ├── lambda_function.rs
│ │ │ ├── list_literal.rs
│ │ │ ├── log_operation.rs
│ │ │ ├── log_symbol.rs
│ │ │ ├── match_pattern.rs
│ │ │ ├── match_pattern_comp.rs
│ │ │ ├── match_pattern_enum_case.rs
│ │ │ ├── match_pattern_rel.rs
│ │ │ ├── match_rule.rs
│ │ │ ├── match_statement.rs
│ │ │ ├── method_access.rs
│ │ │ ├── method_decl.rs
│ │ │ ├── mixin_decl.rs
│ │ │ ├── mixin_include_decl.rs
│ │ │ ├── mod.rs
│ │ │ ├── module_flag.rs
│ │ │ ├── module_flags.rs
│ │ │ ├── mul_operation.rs
│ │ │ ├── mul_symbol.rs
│ │ │ ├── operator_decl.rs
│ │ │ ├── operator_symbol.rs
│ │ │ ├── paren_expression.rs
│ │ │ ├── parsed_module.rs
│ │ │ ├── postfix_expression.rs
│ │ │ ├── postfix_rvalue.rs
│ │ │ ├── postfix_term.rs
│ │ │ ├── postfix_term_attribute.rs
│ │ │ ├── postfix_term_call.rs
│ │ │ ├── postfix_term_enum_case.rs
│ │ │ ├── postfix_term_field_write.rs
│ │ │ ├── postfix_term_index.rs
│ │ │ ├── postfix_term_index_write.rs
│ │ │ ├── postfix_term_object_write.rs
│ │ │ ├── postfix_term_try_protocol.rs
│ │ │ ├── postfix_term_write.rs
│ │ │ ├── postfix_term_write_list.rs
│ │ │ ├── primary.rs
│ │ │ ├── rel_operation.rs
│ │ │ ├── rel_symbol.rs
│ │ │ ├── return_statement.rs
│ │ │ ├── shift_operation.rs
│ │ │ ├── shift_symbol.rs
│ │ │ ├── statement.rs
│ │ │ ├── string_literal.rs
│ │ │ ├── struct_decl.rs
│ │ │ ├── struct_entry.rs
│ │ │ ├── ternary_expression.rs
│ │ │ ├── throw_statement.rs
│ │ │ ├── top_level_entry.rs
│ │ │ ├── try_block.rs
│ │ │ ├── try_unwrap_expression.rs
│ │ │ ├── unary_operation.rs
│ │ │ ├── unary_symbol.rs
│ │ │ ├── val_decl_entry.rs
│ │ │ ├── val_decl_statement.rs
│ │ │ ├── while_statement.rs
│ │ │ └── write_op_eq_statement.rs
│ │ └── prettyprint/
│ │ ├── mod.rs
│ │ └── printout_accumulator.rs
│ ├── grammar/
│ │ ├── grammar.pest
│ │ └── mod.rs
│ └── lib.rs
├── pgo
├── run_doc_script_tests.sh
├── t
├── test-bin/
│ ├── Cargo.toml
│ └── src/
│ └── main.rs
├── tests/
│ ├── alloc_builtin_type.aria
│ ├── and.aria
│ ├── and_shortcircuit.aria
│ ├── arg_isa_mixin.aria
│ ├── arg_typehint.aria
│ ├── argc_mismatch_error.aria
│ ├── aria_version.aria
│ ├── arity_of_callable.aria
│ ├── as_user_printable.aria
│ ├── assert_id_func.aria
│ ├── bind_call_enum_instance_method.aria
│ ├── bind_call_enum_type_method.aria
│ ├── bind_of_free_func.aria
│ ├── bind_of_func_on_builtin.aria
│ ├── box_type.aria
│ ├── break_in_forloop.aria
│ ├── build_mixin.aria
│ ├── builtin_isa_mixin.aria
│ ├── builtin_maybe_enum.aria
│ ├── builtin_type_func_takes_This.aria
│ ├── builtin_type_type.aria
│ ├── builtins_list_attributes.aria
│ ├── bw_ops.aria
│ ├── call_op_call.aria
│ ├── call_struct_func.aria
│ ├── chained_try_unwrap.aria
│ ├── closure_range_list.aria
│ ├── closure_with_body.aria
│ ├── cmp_utils.aria
│ ├── complex_hash.aria
│ ├── complex_numbers.aria
│ ├── complex_of_self.aria
│ ├── complex_reverse_minus.aria
│ ├── continue_in_forloop.aria
│ ├── cross_func_exception.aria
│ ├── cross_module_mixin_import.aria
│ ├── cross_module_var.aria
│ ├── cross_module_var_write.aria
│ ├── custom_is_unwrap.aria
│ ├── custom_to_json_value.aria
│ ├── custom_try_unwrap_protocol.aria
│ ├── decimal.aria
│ ├── decimal_hash.aria
│ ├── decimal_prettyprint.aria
│ ├── deep_nested_struct.aria
│ ├── default_arg_is_immutable.aria
│ ├── dir_entries.aria
│ ├── div_by_zero_error.aria
│ ├── dot_write_of_local.aria
│ ├── double_import_from.aria
│ ├── double_module_import.aria
│ ├── empty_expr_stmt.aria
│ ├── empty_func.aria
│ ├── enum_case_as_mixin.aria
│ ├── enum_case_check_no_payload.aria
│ ├── enum_equals.aria
│ ├── enum_extend_mixin.aria
│ ├── enum_in_struct.aria
│ ├── enum_isa_mixn.aria
│ ├── enum_list_attributes.aria
│ ├── enum_match_case_first_wins.aria
│ ├── enum_match_case_typehint.aria
│ ├── enum_op_equals.aria
│ ├── enum_prettyprint.aria
│ ├── enum_with_struct_case.aria
│ ├── enum_without_payload.aria
│ ├── except_in_op_is_caught.aria
│ ├── exception_backtrace.aria
│ ├── extend_imported.aria
│ ├── extend_included_mixin.aria
│ ├── extend_struct.aria
│ ├── extension_nested_struct.aria
│ ├── extension_on_list.aria
│ ├── extension_type_func.aria
│ ├── file_io.aria
│ ├── file_io.txt
│ ├── file_lines_iter.aria
│ ├── file_lines_iter.txt
│ ├── flatten_results.aria
│ ├── float_atan.aria
│ ├── float_exp.aria
│ ├── float_ln.aria
│ ├── float_log_exp.aria
│ ├── float_parse_scientific.aria
│ ├── float_pow.aria
│ ├── float_pretyprint.aria
│ ├── float_sqrt.aria
│ ├── flt_attrib.aria
│ ├── for_else.aria
│ ├── for_loop_test.aria
│ ├── format_of_nested_brace.aria
│ ├── format_with_opt_arg.aria
│ ├── fp_arith.aria
│ ├── fp_cmp_greater.aria
│ ├── fp_cmp_gt_eq.aria
│ ├── fp_cmp_lt_eq.aria
│ ├── fp_cmp_smaller.aria
│ ├── fp_consts.aria
│ ├── fp_eq.aria
│ ├── fp_ext_notation.aria
│ ├── fp_int_arith.aria
│ ├── fp_no_suffix.aria
│ ├── from_import_two_things.aria
│ ├── func_arg_type_mismatch.aria
│ ├── func_as_arg.aria
│ ├── func_has_multiple_optionals.aria
│ ├── func_has_only_vararg.aria
│ ├── func_has_vararg.aria
│ ├── func_multiple_fixed_vararg.aria
│ ├── func_only_takes_opt.aria
│ ├── func_order_of_vararg.aria
│ ├── func_returns_int.aria
│ ├── func_returns_unit.aria
│ ├── func_takes_args.aria
│ ├── func_type_equals.aria
│ ├── func_union_type_mismatch.aria
│ ├── func_with_opt_vararg.aria
│ ├── func_with_struct.aria
│ ├── function_arity.aria
│ ├── function_list_attributes.aria
│ ├── getenv.aria
│ ├── guard_on_return.aria
│ ├── guards_exit_on_throw.aria
│ ├── has_attr.aria
│ ├── hash_builtins.aria
│ ├── hash_instant.aria
│ ├── hash_maybe.aria
│ ├── hex_escapes.aria
│ ├── http_get_headers.aria
│ ├── http_post.aria
│ ├── http_post_json.aria
│ ├── http_request_custom_status.aria
│ ├── http_simple_get.aria
│ ├── identifier_casing.aria
│ ├── identifier_syntax.aria
│ ├── if_assign_val.aria
│ ├── if_false.aria
│ ├── if_postfix_obj.aria
│ ├── if_takes_else.aria
│ ├── if_takes_elsif.aria
│ ├── if_takes_if.aria
│ ├── if_true.aria
│ ├── implicit_is_X.aria
│ ├── import_all.aria
│ ├── import_from.aria
│ ├── import_pair_struct.aria
│ ├── import_string_extension.aria
│ ├── import_test_things.aria
│ ├── import_two_things.aria
│ ├── include_trivial_mixin.aria
│ ├── index_get.aria
│ ├── index_operators_empty.aria
│ ├── index_out_of_bounds_error.aria
│ ├── index_set.aria
│ ├── index_vararg.aria
│ ├── inner_function.aria
│ ├── inner_function_redef.aria
│ ├── inner_is_closure.aria
│ ├── inner_outer_loop.aria
│ ├── inner_val.aria
│ ├── instant_from_unix_2024_12_29.aria
│ ├── instant_from_unix_ts.aria
│ ├── instant_now.aria
│ ├── instant_offset_breaks_eq.aria
│ ├── instant_with_tz_offset.aria
│ ├── int_abs.aria
│ ├── int_arith.aria
│ ├── int_fp_int.aria
│ ├── int_index_operator.aria
│ ├── int_notations.aria
│ ├── int_prettyprint_style.aria
│ ├── int_range.aria
│ ├── int_range_ops.aria
│ ├── int_range_step.aria
│ ├── int_range_where_iter.aria
│ ├── int_shift_test.aria
│ ├── int_wraps.aria
│ ├── invalid_fileopen_throws.aria
│ ├── invalid_utf8_bytes.aria
│ ├── isa_intersection.aria
│ ├── isa_match.aria
│ ├── isa_mixin_union.aria
│ ├── isa_operator.aria
│ ├── iter_enum.aria
│ ├── iter_zip.aria
│ ├── iterable_skip.aria
│ ├── iterable_truncate.aria
│ ├── iterator_mixin.aria
│ ├── iterator_type_mismatch.aria
│ ├── json_flatten.aria
│ ├── json_parse_array.aria
│ ├── json_parse_nested.aria
│ ├── json_parse_wellknown.aria
│ ├── lambda_f_block.aria
│ ├── lambda_f_define.aria
│ ├── lambda_f_global.aria
│ ├── lambda_refers_to_uplevel.aria
│ ├── large_hex_int.aria
│ ├── large_negative_literal.aria
│ ├── list_append.aria
│ ├── list_as_map_key.aria
│ ├── list_contains.aria
│ ├── list_custom_write.aria
│ ├── list_drop.aria
│ ├── list_equals.aria
│ ├── list_filled.aria
│ ├── list_for_loop.aria
│ ├── list_functional.aria
│ ├── list_hash.aria
│ ├── list_iter_map.aria
│ ├── list_join.aria
│ ├── list_length.aria
│ ├── list_mul_op.aria
│ ├── list_negative_index.aria
│ ├── list_op_add.aria
│ ├── list_prettyprint.aria
│ ├── list_product_negative.aria
│ ├── list_search.aria
│ ├── list_sorting.aria
│ ├── list_sorting_with_cmp.aria
│ ├── list_where_iterator.aria
│ ├── list_write_out_of_bounds.aria
│ ├── local_define_type_mismatch.aria
│ ├── local_typehint_any.aria
│ ├── local_write_type_mismatch.aria
│ ├── lr_shift_custom_op.aria
│ ├── lt_gt_comp.aria
│ ├── lte_gte_comp.aria
│ ├── map_0_capacity.aria
│ ├── map_frequency_map.aria
│ ├── map_hash_negative.aria
│ ├── map_index_init.aria
│ ├── map_insert.aria
│ ├── map_iter.aria
│ ├── map_iterator_where.aria
│ ├── map_key_ops.aria
│ ├── map_keys.aria
│ ├── map_load_factor.aria
│ ├── map_remove.aria
│ ├── map_set_get.aria
│ ├── match_equals.aria
│ ├── match_extract_enum_payload.aria
│ ├── match_isa_case.aria
│ ├── match_not_eq.aria
│ ├── match_payload_fails_with_no_payload.aria
│ ├── match_rel.aria
│ ├── match_uses_custom_op_equals.aria
│ ├── match_without_commas.aria
│ ├── matrix.aria
│ ├── matrix_add.aria
│ ├── matrix_det.aria
│ ├── matrix_mul.aria
│ ├── matrix_transpose.aria
│ ├── max_min_empty.aria
│ ├── maybe_unwrap.aria
│ ├── method_arg_type_mismatch.aria
│ ├── method_as_arg.aria
│ ├── method_has_vararg.aria
│ ├── method_on_type.aria
│ ├── method_order_of_vararg.aria
│ ├── mismatch_payload.aria
│ ├── mix_int_fp_mod.aria
│ ├── mix_object_init.aria
│ ├── mixin_extension.aria
│ ├── mixin_func_This.aria
│ ├── mixin_has_enum.aria
│ ├── mixin_has_struct.aria
│ ├── mixin_in_extension.aria
│ ├── mixin_include_mixin.aria
│ ├── mixin_include_type_func.aria
│ ├── mixin_multiple_commas.aria
│ ├── mixin_of_builtin_type.aria
│ ├── mixin_of_enum.aria
│ ├── mixin_order.aria
│ ├── mixin_refers_to_self_method.aria
│ ├── mixin_shared_between_types.aria
│ ├── mixin_val_decl.aria
│ ├── mod_by_zero.aria
│ ├── module_level_val.aria
│ ├── module_level_var_fdeps.aria
│ ├── module_list_attributes.aria
│ ├── module_var_isa_mixin.aria
│ ├── msrng.aria
│ ├── mul_eq_ops.aria
│ ├── multidecl_order.aria
│ ├── multiple_imports_from.aria
│ ├── multiwrite_multiple.aria
│ ├── multiwrite_nesting.aria
│ ├── multiwrite_of_attribute.aria
│ ├── multiwrite_repeat.aria
│ ├── multiwrite_side_effecting.aria
│ ├── multiwrite_swap.aria
│ ├── naked_return.aria
│ ├── neg.aria
│ ├── nested_closure.aria
│ ├── nested_enum_in_func.aria
│ ├── nested_enum_with_entries.aria
│ ├── nested_extension.aria
│ ├── nested_forloop.aria
│ ├── nested_guard.aria
│ ├── nested_guards_order.aria
│ ├── nested_if.aria
│ ├── nested_lambda_f.aria
│ ├── nested_list.aria
│ ├── nested_obj_write.aria
│ ├── nested_struct_new.aria
│ ├── new_path.aria
│ ├── new_range_api.aria
│ ├── no_such_case.aria
│ ├── no_such_identifier.aria
│ ├── not.aria
│ ├── nothing_type.aria
│ ├── now.aria
│ ├── obj_box_read_write.aria
│ ├── obj_prettyprint.aria
│ ├── obj_write_comprehensive.aria
│ ├── obj_write_in_expr.aria
│ ├── obj_write_order.aria
│ ├── one_guard.aria
│ ├── one_line_function.aria
│ ├── op_add.aria
│ ├── op_call.aria
│ ├── op_div.aria
│ ├── op_equals.aria
│ ├── op_gt.aria
│ ├── op_gteq.aria
│ ├── op_index_throws.aria
│ ├── op_lt.aria
│ ├── op_lteq.aria
│ ├── op_mul.aria
│ ├── op_rem.aria
│ ├── op_sub.aria
│ ├── operator_overload.aria
│ ├── opt_args_this_usage.aria
│ ├── or.aria
│ ├── or_shortcircuit.aria
│ ├── ordering_mixin.aria
│ ├── paren_expression.aria
│ ├── parse_enum_cases.aria
│ ├── parse_fp.aria
│ ├── parse_int.aria
│ ├── pass_lambda.aria
│ ├── path_canonical.aria
│ ├── path_checks.aria
│ ├── path_common_ancestor.aria
│ ├── path_glob.aria
│ ├── path_hash.aria
│ ├── path_io.aria
│ ├── path_io.txt
│ ├── path_manipulation.aria
│ ├── path_manipulation.txt
│ ├── phi.aria
│ ├── platform.aria
│ ├── plus_minus_eq.aria
│ ├── postfix_obj_write.aria
│ ├── prettyprint_two_arg.aria
│ ├── queue.aria
│ ├── queue_with_cmp.aria
│ ├── range_hash.aria
│ ├── range_to_list.aria
│ ├── read_index_multiple.aria
│ ├── read_list_index.aria
│ ├── read_write_val_of_function.aria
│ ├── readattr.aria
│ ├── redundant_local_loads.aria
│ ├── redundant_named_loads.aria
│ ├── regex_api.aria
│ ├── result.aria
│ ├── result_helpers.aria
│ ├── result_to_exception.aria
│ ├── result_unwrap.aria
│ ├── retry_test.aria
│ ├── return_paren_expr.aria
│ ├── return_stops_eval.aria
│ ├── rng_oneof.aria
│ ├── rw_int_attrib.aria
│ ├── rw_str_attrib.aria
│ ├── set.aria
│ ├── set_ops.aria
│ ├── setenv.aria
│ ├── shape_failed_read_works.aria
│ ├── shift_eq_ops.aria
│ ├── simple_closure.aria
│ ├── simple_default_args.aria
│ ├── simple_json_parse.aria
│ ├── simple_json_parse_err.aria
│ ├── simple_try_unwrap.aria
│ ├── sip_hash_test.aria
│ ├── sleep.aria
│ ├── stack.aria
│ ├── str_chr_bytes.aria
│ ├── str_encoding.aria
│ ├── str_equality.aria
│ ├── str_int_mul.aria
│ ├── str_len_vs_index.aria
│ ├── string_classes.aria
│ ├── string_concat.aria
│ ├── string_contains.aria
│ ├── string_format.aria
│ ├── string_format_errors.aria
│ ├── string_from_bytes.aria
│ ├── string_index.aria
│ ├── string_join.aria
│ ├── string_negative_index.aria
│ ├── string_prefix_suffix.aria
│ ├── string_product_negative.aria
│ ├── string_remove.aria
│ ├── string_replace.aria
│ ├── string_split.aria
│ ├── string_trim.aria
│ ├── strings_anagram_hash.aria
│ ├── strlen.aria
│ ├── struct_field.aria
│ ├── struct_func_redecl.aria
│ ├── struct_in_enum.aria
│ ├── struct_in_struct.aria
│ ├── struct_isa_mixin.aria
│ ├── struct_list_attributes.aria
│ ├── struct_methods_refer_each_other.aria
│ ├── struct_methods_refer_outoforder.aria
│ ├── struct_mixin_multiple.aria
│ ├── struct_takes_self_arg.aria
│ ├── struct_with_opt_args.aria
│ ├── substring.aria
│ ├── successive_ifs.aria
│ ├── system_of_no_such_cmd_err.aria
│ ├── ternary_operator.aria
│ ├── ternary_operator_nested.aria
│ ├── ternary_operator_precedence.aria
│ ├── test_module.aria
│ ├── test_shell_command.aria
│ ├── test_with_no_main.aria
│ ├── throw_in_catch.aria
│ ├── throws_func.aria
│ ├── to_json_string.aria
│ ├── to_json_value.aria
│ ├── top_level_assign.aria
│ ├── top_level_code_block.aria
│ ├── top_level_expr_stmt.aria
│ ├── top_level_guard.aria
│ ├── top_level_plus_eq.aria
│ ├── top_level_shift_eq.aria
│ ├── top_level_try.aria
│ ├── trig.aria
│ ├── trivial_if.aria
│ ├── trivial_try_block.aria
│ ├── try_nothrow.aria
│ ├── try_unwinds_guard.aria
│ ├── try_unwrap_coalesce.aria
│ ├── try_unwrap_maybe.aria
│ ├── try_unwrap_non_result.aria
│ ├── type_func_takes_This.aria
│ ├── type_root.aria
│ ├── type_val_in_enum.aria
│ ├── typecheck_as_struct.aria
│ ├── unexpected_type_error.aria
│ ├── union_type_passes.aria
│ ├── unit_type.aria
│ ├── unused_local_typechecks.aria
│ ├── unused_local_value.aria
│ ├── unused_typed_local.aria
│ ├── unwrap_single_eval.aria
│ ├── uplevel_can_write_attrib.aria
│ ├── uplevel_write_before_read.aria
│ ├── upper_lower.aria
│ ├── while_break.aria
│ ├── while_continue.aria
│ ├── while_else.aria
│ ├── while_missed.aria
│ ├── while_taken.aria
│ ├── widget_test.aria
│ ├── write_attrib_struct.aria
│ ├── write_index.aria
│ ├── write_index_multiple.aria
│ ├── write_list_index.aria
│ ├── writeattr.aria
│ ├── xor.aria
│ └── xorshift.aria
├── tree_check.sh
├── vm-lib/
│ ├── Cargo.toml
│ ├── benches/
│ │ └── control_flow.rs
│ └── src/
│ ├── arity.rs
│ ├── builtins/
│ │ ├── alloc.rs
│ │ ├── arity.rs
│ │ ├── boolean.rs
│ │ ├── cmdline_args.rs
│ │ ├── exit.rs
│ │ ├── float.rs
│ │ ├── getenv.rs
│ │ ├── hasattr.rs
│ │ ├── integer.rs
│ │ ├── list.rs
│ │ ├── listattrs.rs
│ │ ├── maybe.rs
│ │ ├── mod.rs
│ │ ├── native_iterator.rs
│ │ ├── now.rs
│ │ ├── prettyprint.rs
│ │ ├── print.rs
│ │ ├── println.rs
│ │ ├── readattr.rs
│ │ ├── readln.rs
│ │ ├── result.rs
│ │ ├── runtime_error.rs
│ │ ├── setenv.rs
│ │ ├── sleep.rs
│ │ ├── string.rs
│ │ ├── system.rs
│ │ ├── test_exit.aria
│ │ ├── typ.rs
│ │ ├── typeof_builtin.rs
│ │ ├── unimplemented.rs
│ │ ├── unit.rs
│ │ └── writeattr.rs
│ ├── console.rs
│ ├── error/
│ │ ├── backtrace.rs
│ │ ├── dylib_load.rs
│ │ ├── exception.rs
│ │ ├── mod.rs
│ │ └── vm_error.rs
│ ├── frame.rs
│ ├── lib.rs
│ ├── mixin_includer.rs
│ ├── opcodes/
│ │ ├── mod.rs
│ │ ├── prettyprint.rs
│ │ └── sidecar.rs
│ ├── runtime_module.rs
│ ├── runtime_value/
│ │ ├── boolean.rs
│ │ ├── bound_function.rs
│ │ ├── builtin_value.rs
│ │ ├── enum_case.rs
│ │ ├── enumeration.rs
│ │ ├── float.rs
│ │ ├── function.rs
│ │ ├── integer.rs
│ │ ├── isa.rs
│ │ ├── kind.rs
│ │ ├── list.rs
│ │ ├── mixin.rs
│ │ ├── mod.rs
│ │ ├── object.rs
│ │ ├── opaque.rs
│ │ ├── runtime_code_object.rs
│ │ ├── rust_native_type.rs
│ │ ├── string.rs
│ │ └── structure.rs
│ ├── shape.rs
│ ├── stack.rs
│ ├── symbol.rs
│ ├── test.rs
│ └── vm.rs
└── vscode/
└── aria/
├── .vscodeignore
├── LICENSE
├── README.md
├── build.sh
├── language-configuration.json
├── package.json
├── src/
│ └── extension.ts
├── syntaxes/
│ └── aria.tmLanguage.json
├── tsconfig.json
└── tsconfig.tsbuildinfo
SYMBOL INDEX (2072 symbols across 251 files)
FILE: aria-bin/src/error_reporting.rs
type StringCache (line 13) | pub struct StringCache {
type Storage (line 18) | type Storage = String;
method fetch (line 20) | fn fetch(
method display (line 28) | fn display<'a>(&self, path: &'a String) -> Option<impl std::fmt::Displ...
type PrintableReport (line 33) | pub(crate) type PrintableReport<'a> = (
function build_report_from_msg_and_location (line 38) | fn build_report_from_msg_and_location<'a>(
function print_report_from_vm_exception (line 69) | pub(crate) fn print_report_from_vm_exception(vm: &mut VirtualMachine, ex...
function print_report_from_compiler_error (line 74) | pub(crate) fn print_report_from_compiler_error(err: &CompilationError) {
function print_report_from_parser_error (line 79) | pub(crate) fn print_report_from_parser_error(err: &ParserError) {
function print_report_from_vm_error (line 84) | pub(crate) fn print_report_from_vm_error(err: &VmError) {
function build_report_from_vm_error (line 89) | pub(crate) fn build_report_from_vm_error<'a>(err: &VmError) -> Printable...
function build_report_from_vm_exception (line 103) | pub(crate) fn build_report_from_vm_exception<'a>(
function build_report_from_compiler_error (line 113) | pub(crate) fn build_report_from_compiler_error<'a>(
function build_report_from_parser_error (line 121) | pub(crate) fn build_report_from_parser_error<'a>(err: &'a ParserError) -...
FILE: aria-bin/src/file_eval.rs
method from (line 22) | fn from(value: &Args) -> Self {
function eval_buffer (line 32) | fn eval_buffer(
function file_eval (line 98) | pub(crate) fn file_eval(path: &str, args: &Args) -> i32 {
FILE: aria-bin/src/main.rs
type Args (line 14) | struct Args {
method check (line 68) | fn check(&self) -> Vec<String> {
method from (line 50) | fn from(value: &Args) -> Self {
function print_lib_paths (line 84) | fn print_lib_paths() {
function main_loop (line 91) | fn main_loop() -> i32 {
function main (line 114) | fn main() {
FILE: aria-bin/src/repl_eval.rs
type ReplValidator (line 26) | struct ReplValidator;
method validate (line 28) | fn validate(&self, line: &str) -> reedline::ValidationResult {
type LineEditor (line 80) | struct LineEditor {
method new (line 86) | pub fn new() -> Self {
method read_input (line 109) | fn read_input(&mut self) -> (String, bool) {
function is_call_to_print_or_println (line 120) | fn is_call_to_print_or_println(expr: &ExpressionStatement) -> bool {
function massage_ast_for_repl (line 128) | fn massage_ast_for_repl(ast: &mut aria_parser::ast::ParsedModule) -> bool {
type ReplStepResult (line 151) | pub struct ReplStepResult {
type Repl (line 158) | pub struct Repl<'a> {
function new (line 167) | pub fn new(vm_options: VmOptions, args: &'a Args) -> Result<Self, ()> {
function try_parse_source (line 221) | fn try_parse_source(
function process_buffer (line 229) | pub fn process_buffer(&mut self, buffer: &str) -> Result<RuntimeModule, ...
function print_error_report (line 314) | fn print_error_report(&mut self, report: crate::error_reporting::Printab...
function eval_line (line 322) | pub fn eval_line(&mut self, src: &str) -> ReplStepResult {
function repl_eval (line 363) | pub(crate) fn repl_eval(args: &Args) -> i32 {
FILE: aria-bin/src/test.rs
function build_test_repl (line 9) | fn build_test_repl<'a>(cmdline_options: &'a Args) -> Repl<'a> {
function run_check_repl_line (line 18) | fn run_check_repl_line(
function run_passing_repl_line (line 48) | fn run_passing_repl_line(repl: &mut Repl, line: &str, must_include_stdou...
function repl_can_print_integers (line 53) | fn repl_can_print_integers() {
function repl_can_call_functions (line 62) | fn repl_can_call_functions() {
function repl_can_define_structs (line 71) | fn repl_can_define_structs() {
function repl_can_use_if_statement (line 107) | fn repl_can_use_if_statement() {
function repl_can_use_for_statement (line 117) | fn repl_can_use_for_statement() {
function repl_can_use_while_statement (line 130) | fn repl_can_use_while_statement() {
function repl_can_use_match_statement (line 143) | fn repl_can_use_match_statement() {
function repl_printout_maybe (line 165) | fn repl_printout_maybe() {
function repl_adds_semicolon (line 195) | fn repl_adds_semicolon() {
function repl_preamble_works (line 205) | fn repl_preamble_works() {
function repl_skips_preamble (line 215) | fn repl_skips_preamble() {
function repl_op_count_error (line 232) | fn repl_op_count_error() {
function repl_test_printf (line 257) | fn repl_test_printf() {
function repl_test_invalid_literal (line 270) | fn repl_test_invalid_literal() {
function repl_allows_comments (line 284) | fn repl_allows_comments() {
function repl_handles_hashtag_in_string (line 305) | fn repl_handles_hashtag_in_string() {
function repl_test_oneof_from_empty_list (line 323) | fn repl_test_oneof_from_empty_list() {
function repl_includes_ranges (line 341) | fn repl_includes_ranges() {
FILE: compiler-lib/src/bc_reader.rs
type BytecodeReader (line 4) | pub struct BytecodeReader {
type Error (line 10) | type Error = DecodeError;
method try_from (line 12) | fn try_from(value: &[u8]) -> Result<Self, Self::Error> {
method read_u8 (line 46) | fn read_u8(&mut self) -> DecodeResult<u8> {
method read_u16 (line 57) | fn read_u16(&mut self) -> DecodeResult<u16> {
method read_u32 (line 68) | fn read_u32(&mut self) -> DecodeResult<u32> {
method jump_to_index (line 83) | pub fn jump_to_index(&mut self, idx: usize) {
method get_index (line 87) | pub fn get_index(&self) -> usize {
method read_opcode (line 91) | pub fn read_opcode(&mut self) -> DecodeResult<Opcode> {
method len (line 391) | pub fn len(&self) -> usize {
method is_empty (line 395) | pub fn is_empty(&self) -> bool {
type DecodeError (line 25) | pub enum DecodeError {
type DecodeResult (line 42) | pub type DecodeResult<T> = Result<T, DecodeError>;
FILE: compiler-lib/src/bc_writer.rs
type BytecodeWriter (line 5) | pub(crate) struct BytecodeWriter {
method write_u8 (line 10) | fn write_u8(&mut self, val: u8) -> &mut Self {
method write_u16 (line 15) | fn write_u16(&mut self, val: u16) -> &mut Self {
method write_u32 (line 20) | fn write_u32(&mut self, val: u32) -> &mut Self {
method write_opcode (line 28) | pub(crate) fn write_opcode(&mut self, op: &Opcode) -> &mut Self {
method get_data (line 169) | pub(crate) fn get_data(&self) -> Vec<u8> {
FILE: compiler-lib/src/builder/block.rs
type BasicBlockEntry (line 14) | pub(crate) struct BasicBlockEntry {
method to_vm_opcode (line 20) | fn to_vm_opcode(&self, parent: &FunctionBuilder) -> haxby_opcodes::Opc...
type BasicBlockImpl (line 26) | pub(crate) struct BasicBlockImpl {
method new (line 33) | pub(crate) fn new(name: &str, id: usize) -> Self {
type BasicBlock (line 43) | pub struct BasicBlock {
method new (line 67) | pub(crate) fn new(name: &str, id: usize) -> Self {
method name (line 73) | pub fn name(&self) -> &str {
method id (line 77) | pub fn id(&self) -> usize {
method write_opcode (line 82) | pub fn write_opcode(&self, op: CompilerOpcode) -> &Self {
method write_opcode_and_source_info (line 88) | pub fn write_opcode_and_source_info(&self, op: CompilerOpcode, src: So...
method len (line 94) | pub fn len(&self) -> usize {
method is_empty (line 98) | pub fn is_empty(&self) -> bool {
method is_terminal (line 102) | pub fn is_terminal(&self) -> bool {
method remove_op_at_idx (line 114) | pub(crate) fn remove_op_at_idx(&self, idx: usize) {
method replace_double_jump (line 118) | fn replace_double_jump(&self) -> bool {
method optimize_true_false (line 142) | fn optimize_true_false(&self, cv: &ConstantValues) {
method optimize_redundant_conditional_jumps (line 157) | fn optimize_redundant_conditional_jumps(&self) {
method remove_instructions_after_terminal (line 181) | fn remove_instructions_after_terminal(&self) {
method remove_redundant_local_reads (line 193) | fn remove_redundant_local_reads(&self) {
method remove_redundant_named_reads (line 221) | fn remove_redundant_named_reads(&self) {
method remove_store_load_sequence (line 249) | fn remove_store_load_sequence(&self) {
method remove_nop_instructions (line 267) | fn remove_nop_instructions(&self) {
method remove_push_pop_pairs (line 272) | fn remove_push_pop_pairs(&self) {
method run_optimize_passes (line 297) | pub(crate) fn run_optimize_passes(&self, cv: &ConstantValues) {
method drop_unused_locals (line 310) | pub(crate) fn drop_unused_locals(&self, values: &HashSet<u8>) {
method calculate_locals_access (line 333) | pub(crate) fn calculate_locals_access(&self, dest: &mut LocalValuesAcc...
method write (line 364) | pub(crate) fn write(&self, parent: &FunctionBuilder, dest: &mut Byteco...
method write_line_table (line 371) | pub(crate) fn write_line_table(&self, offset: u16, line_table: &LineTa...
method fmt (line 384) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
method eq (line 48) | fn eq(&self, other: &Self) -> bool {
type LocalValuesAccess (line 55) | pub(crate) struct LocalValuesAccess {
method calculate_unused_locals (line 61) | pub(crate) fn calculate_unused_locals(&self) -> HashSet<u8> {
FILE: compiler-lib/src/builder/compiler_opcodes.rs
type CompilerOpcode (line 10) | pub enum CompilerOpcode {
method is_terminal (line 85) | pub fn is_terminal(&self) -> bool {
method is_jump_instruction (line 161) | pub fn is_jump_instruction(&self) -> Vec<BasicBlock> {
method to_vm_opcode (line 173) | pub fn to_vm_opcode(&self, parent: &FunctionBuilder) -> VmOpcode {
method fmt (line 286) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
FILE: compiler-lib/src/builder/func.rs
type FunctionBuilder (line 12) | pub struct FunctionBuilder {
method try_get_block (line 36) | pub fn try_get_block(&self, name: &str) -> Option<BasicBlock> {
method get_block (line 46) | pub fn get_block(&self, name: &str) -> BasicBlock {
method uniq_name (line 50) | fn uniq_name(&self, name: &str) -> String {
method make_new_block (line 59) | fn make_new_block(&mut self, name: &str) -> BasicBlock {
method insert_block_after (line 67) | pub fn insert_block_after(&mut self, name: &str, target: &BasicBlock) ...
method append_block_at_end (line 93) | pub fn append_block_at_end(&mut self, name: &str) -> BasicBlock {
method set_current_block (line 102) | pub fn set_current_block(&mut self, blk: BasicBlock) {
method get_current_block (line 106) | pub fn get_current_block(&self) -> BasicBlock {
method position_of_block_instructions (line 110) | pub fn position_of_block_instructions(&self, blk: &BasicBlock) -> Opti...
method has_entrypoints (line 122) | fn has_entrypoints(&self, blk: &BasicBlock) -> bool {
method find_orphaned_blocks (line 136) | fn find_orphaned_blocks(&self) -> HashSet<usize> {
method remove_block_with_id (line 151) | fn remove_block_with_id(&mut self, id: usize) -> bool {
method run_optimize_passes (line 162) | fn run_optimize_passes(&mut self, cv: &ConstantValues) {
method calculate_locals_access (line 179) | fn calculate_locals_access(&self) -> LocalValuesAccess {
method write (line 189) | pub fn write(
method write_line_table (line 218) | pub fn write_line_table(&self) -> &LineTable {
method fmt (line 231) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
method default (line 21) | fn default() -> Self {
FILE: compiler-lib/src/constant_value.rs
type CompiledCodeObject (line 10) | pub struct CompiledCodeObject {
method hash (line 51) | fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
type FpConst (line 22) | pub struct FpConst(f64);
method to_int (line 25) | fn to_int(self) -> i64 {
method raw_value (line 28) | pub fn raw_value(&self) -> f64 {
method hash (line 39) | fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
method from (line 44) | fn from(value: f64) -> Self {
method eq (line 33) | fn eq(&self, other: &Self) -> bool {
type ConstantValue (line 57) | pub enum ConstantValue {
method fmt (line 65) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
type ConstantValues (line 76) | pub struct ConstantValues {
method insert (line 86) | pub fn insert(&mut self, v: ConstantValue) -> Result<u16, ConstantValu...
method get (line 101) | pub fn get(&self, i: usize) -> Option<ConstantValue> {
method len (line 105) | pub fn len(&self) -> usize {
method is_empty (line 109) | pub fn is_empty(&self) -> bool {
method values (line 113) | pub fn values(&self) -> std::slice::Iter<'_, ConstantValue> {
type ConstantValuesError (line 81) | pub enum ConstantValuesError {
FILE: compiler-lib/src/do_compile/mod.rs
type CompilationErrorReason (line 24) | pub enum CompilationErrorReason {
method from (line 66) | fn from(value: &ScopeErrorReason) -> Self {
method from (line 87) | fn from(value: &ConstantValuesError) -> Self {
type CompilationError (line 94) | pub struct CompilationError {
method from (line 78) | fn from(value: ScopeError) -> Self {
method fmt (line 100) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
method fmt (line 106) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
type CompilationResult (line 111) | pub type CompilationResult<T = (), E = CompilationError> = Result<T, E>;
type ControlFlowTargets (line 114) | struct ControlFlowTargets {
type CompileParams (line 119) | struct CompileParams<'a> {
type CompileNode (line 127) | trait CompileNode<'a, T = (), E = CompilationError> {
method do_compile (line 128) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResu...
method insert_const_or_fail (line 130) | fn insert_const_or_fail(
method return_unit_value (line 145) | fn return_unit_value(
function ensure_arg_list_is_correct (line 162) | fn ensure_arg_list_is_correct(args: &ArgumentList) -> CompilationResult {
function ensure_unique_arg_names (line 168) | fn ensure_unique_arg_names(args: &ArgumentList) -> CompilationResult {
function ensure_default_args_trailing (line 184) | fn ensure_default_args_trailing(args: &ArgumentList) -> CompilationResult {
function emit_arg_at_target (line 200) | fn emit_arg_at_target(
type ArgumentCountInfo (line 251) | struct ArgumentCountInfo {
function emit_args_at_target (line 258) | fn emit_args_at_target(
function emit_type_mixin_include_decl_compile (line 317) | fn emit_type_mixin_include_decl_compile(
function emit_method_decl_compile (line 330) | fn emit_method_decl_compile(md: &MethodDecl, params: &mut CompileParams)...
type OperatorArity (line 348) | pub enum OperatorArity {
method unary (line 354) | fn unary() -> Self {
method any (line 358) | fn any() -> Self {
method is_acceptable (line 362) | fn is_acceptable(&self, arg_count: usize) -> bool {
method fmt (line 371) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
type OperatorInfo (line 379) | struct OperatorInfo {
function emit_operator_decl_compile (line 553) | fn emit_operator_decl_compile(op: &OperatorDecl, params: &mut CompilePar...
function emit_type_val_decl_compile (line 613) | fn emit_type_val_decl_compile(
function emit_type_members_compile (line 639) | fn emit_type_members_compile(
function do_struct_compile (line 715) | fn do_struct_compile(sd: &StructDecl, params: &mut CompileParams) -> Com...
function do_enum_compile (line 744) | fn do_enum_compile<T>(
function generate_is_case_helper_for_enum (line 789) | fn generate_is_case_helper_for_enum(case: &EnumCaseDecl) -> MethodDecl {
function generate_unwap_case_helper_for_enum (line 840) | fn generate_unwap_case_helper_for_enum(case: &EnumCaseDecl) -> MethodDecl {
function generate_case_helpers_extension_for_enum (line 903) | fn generate_case_helpers_extension_for_enum(cases: &[EnumCaseDecl]) -> V...
function emit_enum_cases (line 921) | fn emit_enum_cases(cases: &[EnumCaseDecl], params: &mut CompileParams) -...
function compile_from_ast (line 929) | pub(crate) fn compile_from_ast(
function compile_from_source (line 951) | pub(crate) fn compile_from_source(
FILE: compiler-lib/src/do_compile/nodes/add_operation.rs
function do_compile (line 8) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
FILE: compiler-lib/src/do_compile/nodes/assert_statement.rs
function do_compile (line 11) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
FILE: compiler-lib/src/do_compile/nodes/assign_statement.rs
function do_compile (line 11) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
FILE: compiler-lib/src/do_compile/nodes/break_statement.rs
function do_compile (line 10) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
FILE: compiler-lib/src/do_compile/nodes/code_block.rs
function do_compile (line 5) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
FILE: compiler-lib/src/do_compile/nodes/comp_operation.rs
function do_compile (line 8) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
FILE: compiler-lib/src/do_compile/nodes/continue_statement.rs
function do_compile (line 10) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
FILE: compiler-lib/src/do_compile/nodes/enum_case_decl.rs
function do_compile (line 11) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult...
FILE: compiler-lib/src/do_compile/nodes/enum_decl.rs
function do_compile (line 8) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
FILE: compiler-lib/src/do_compile/nodes/expression.rs
function do_compile (line 5) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
FILE: compiler-lib/src/do_compile/nodes/expression_list.rs
function do_compile (line 5) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult...
FILE: compiler-lib/src/do_compile/nodes/expression_statement.rs
function do_compile (line 5) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
FILE: compiler-lib/src/do_compile/nodes/extension_decl.rs
function do_compile (line 8) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
FILE: compiler-lib/src/do_compile/nodes/float_literal.rs
function do_compile (line 11) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
FILE: compiler-lib/src/do_compile/nodes/for_statement.rs
function do_compile (line 28) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
FILE: compiler-lib/src/do_compile/nodes/function_body.rs
function do_compile (line 5) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
FILE: compiler-lib/src/do_compile/nodes/function_decl.rs
function do_compile (line 14) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
FILE: compiler-lib/src/do_compile/nodes/identifier.rs
function do_compile (line 5) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
FILE: compiler-lib/src/do_compile/nodes/if_statement.rs
function do_compile (line 8) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
FILE: compiler-lib/src/do_compile/nodes/import_from_statement.rs
function do_compile (line 11) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
FILE: compiler-lib/src/do_compile/nodes/import_statement.rs
function do_compile (line 9) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
FILE: compiler-lib/src/do_compile/nodes/int_literal.rs
function do_compile (line 11) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
FILE: compiler-lib/src/do_compile/nodes/lambda.rs
function do_compile (line 7) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
FILE: compiler-lib/src/do_compile/nodes/list_literal.rs
function do_compile (line 10) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
FILE: compiler-lib/src/do_compile/nodes/logical_operation.rs
function do_compile (line 8) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
FILE: compiler-lib/src/do_compile/nodes/match_pattern.rs
function do_compile (line 5) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
FILE: compiler-lib/src/do_compile/nodes/match_pattern_comp.rs
function do_compile (line 8) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
FILE: compiler-lib/src/do_compile/nodes/match_pattern_enum_case.rs
function emit_case_without_payload (line 11) | fn emit_case_without_payload(
function emit_case_with_payload (line 28) | fn emit_case_with_payload(
function do_compile (line 114) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
FILE: compiler-lib/src/do_compile/nodes/match_pattern_rel.rs
function do_compile (line 8) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
FILE: compiler-lib/src/do_compile/nodes/match_statement.rs
function do_compile (line 8) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
FILE: compiler-lib/src/do_compile/nodes/method_decl.rs
function do_compile (line 17) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
FILE: compiler-lib/src/do_compile/nodes/mixin_decl.rs
function do_compile (line 11) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
FILE: compiler-lib/src/do_compile/nodes/mul_operation.rs
function do_compile (line 8) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
FILE: compiler-lib/src/do_compile/nodes/paren_expression.rs
function do_compile (line 5) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
FILE: compiler-lib/src/do_compile/nodes/parsed_module.rs
method do_compile (line 20) | fn do_compile(
FILE: compiler-lib/src/do_compile/nodes/postfix_rvalue.rs
function do_compile (line 5) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
FILE: compiler-lib/src/do_compile/nodes/primary.rs
function do_compile (line 5) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
FILE: compiler-lib/src/do_compile/nodes/rel_operation.rs
function do_compile (line 8) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
FILE: compiler-lib/src/do_compile/nodes/return_statement.rs
function do_compile (line 8) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
FILE: compiler-lib/src/do_compile/nodes/shift_operation.rs
function do_compile (line 8) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
FILE: compiler-lib/src/do_compile/nodes/statement.rs
function do_compile (line 5) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
FILE: compiler-lib/src/do_compile/nodes/string_literal.rs
function do_compile (line 9) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
FILE: compiler-lib/src/do_compile/nodes/struct_decl.rs
function do_compile (line 5) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
FILE: compiler-lib/src/do_compile/nodes/ternary_expression.rs
method do_compile (line 9) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
FILE: compiler-lib/src/do_compile/nodes/throw_statement.rs
function do_compile (line 8) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
FILE: compiler-lib/src/do_compile/nodes/try_block.rs
function do_compile (line 8) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
FILE: compiler-lib/src/do_compile/nodes/try_unwrap_expression.rs
method do_compile (line 14) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
FILE: compiler-lib/src/do_compile/nodes/unary_operation.rs
function do_compile (line 8) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
FILE: compiler-lib/src/do_compile/nodes/val_decl_entry.rs
function do_compile (line 12) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
FILE: compiler-lib/src/do_compile/nodes/val_decl_statement.rs
function do_compile (line 5) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
FILE: compiler-lib/src/do_compile/nodes/while_statement.rs
function do_compile (line 8) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
FILE: compiler-lib/src/do_compile/nodes/write_opeq_statement.rs
function do_compile (line 11) | fn do_compile(&self, params: &'a mut CompileParams) -> CompilationResult {
FILE: compiler-lib/src/do_compile/postfix.rs
type FieldWrite (line 12) | pub(super) struct FieldWrite {
type IndexWrite (line 18) | pub(super) struct IndexWrite {
type ObjWrite (line 25) | pub(super) enum ObjWrite {
method loc (line 31) | fn loc(&self) -> &SourcePointer {
type PostfixValue (line 40) | pub(super) enum PostfixValue {
method emit_read (line 54) | pub(super) fn emit_read(&self, params: &'a mut CompileParams) -> Compi...
method emit_write (line 215) | pub(super) fn emit_write(
method from (line 299) | fn from(value: &aria_parser::ast::PostfixExpression) -> Self {
FILE: compiler-lib/src/dump/mod.rs
type StringResolver (line 13) | pub trait StringResolver {
method resolve_compile_time_constant (line 14) | fn resolve_compile_time_constant(&self, _: u16) -> Option<String> {
method resolve_run_time_symbol (line 18) | fn resolve_run_time_symbol(&self, _: u32) -> Option<String> {
method resolve_compile_time_constant (line 24) | fn resolve_compile_time_constant(&self, idx: u16) -> Option<String> {
type ModuleDump (line 36) | trait ModuleDump {
method dump (line 37) | fn dump(
method dump (line 45) | fn dump(
method dump (line 60) | fn dump(
method dump (line 76) | fn dump(
method prettyprint (line 122) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: compiler-lib/src/dump/opcodes.rs
function const_best_repr (line 5) | fn const_best_repr(resolver: &dyn super::StringResolver, idx: u16) -> St...
function symbol_best_repr (line 12) | fn symbol_best_repr(resolver: &dyn super::StringResolver, idx: u32) -> S...
function try_protocol_mode_to_str (line 19) | fn try_protocol_mode_to_str(id: u8) -> &'static str {
function opcode_prettyprint (line 27) | pub fn opcode_prettyprint(
FILE: compiler-lib/src/lib.rs
type CompilationOptions (line 16) | pub struct CompilationOptions {
method default (line 22) | fn default() -> Self {
function compile_from_source (line 30) | pub fn compile_from_source(
function compile_from_ast (line 37) | pub fn compile_from_ast(
FILE: compiler-lib/src/line_table.rs
type LineTableImpl (line 7) | struct LineTableImpl {
type LineTable (line 12) | pub struct LineTable {
method insert (line 17) | pub fn insert(&self, idx: u16, ptr: SourcePointer) {
method get (line 21) | pub fn get(&self, idx: u16) -> Option<SourcePointer> {
method eq (line 27) | fn eq(&self, other: &Self) -> bool {
FILE: compiler-lib/src/module.rs
type CompiledModule (line 7) | pub struct CompiledModule {
method load_indexed_const (line 13) | pub fn load_indexed_const(&self, idx: u16) -> Option<ConstantValue> {
method load_entry_code_object (line 19) | pub fn load_entry_code_object(&self) -> CompiledCodeObject {
FILE: compiler-lib/src/scope.rs
type Numeric (line 12) | trait Numeric<Output = Self> {
method zero (line 13) | fn zero() -> Output;
method one (line 15) | fn one() -> Output;
method zero (line 19) | fn zero() -> u8 {
method one (line 23) | fn one() -> u8 {
method zero (line 29) | fn zero() -> u16 {
method one (line 33) | fn one() -> u16 {
type IndexProviderImpl (line 38) | struct IndexProviderImpl<T>
method default (line 49) | fn default() -> Self {
function next (line 60) | fn next(&mut self) -> T {
function get_max_index (line 66) | fn get_max_index(&self) -> T {
type ScopeErrorReason (line 71) | pub enum ScopeErrorReason {
type ScopeError (line 77) | pub struct ScopeError {
type ScopeResult (line 82) | pub type ScopeResult<T = ()> = Result<T, ScopeError>;
type ModuleRootScope (line 85) | pub struct ModuleRootScope {
method emit_typed_define (line 90) | pub fn emit_typed_define(
method emit_write (line 115) | pub fn emit_write(
method emit_read (line 142) | pub fn emit_read(
method resolve_uplevel_symbol (line 168) | fn resolve_uplevel_symbol(
type ModuleChildScope (line 179) | pub struct ModuleChildScope {
method new (line 185) | fn new(parent: CompilationScope) -> Self {
method emit_typed_define (line 192) | pub fn emit_typed_define(
method emit_write (line 217) | pub fn emit_write(
method emit_read (line 232) | pub fn emit_read(
method resolve_uplevel_symbol (line 247) | fn resolve_uplevel_symbol(
type UplevelInfo (line 259) | pub(crate) struct UplevelInfo {
type UplevelSymbolResolution (line 264) | struct UplevelSymbolResolution {
type FunctionRootScope (line 269) | pub struct FunctionRootScope {
method root_function (line 278) | fn root_function(parent: CompilationScope) -> Self {
method closure (line 288) | fn closure(lexical_parent: (CompilationScope, BasicBlock)) -> Self {
method num_locals (line 298) | pub fn num_locals(&self) -> u8 {
method emit_typed_define (line 302) | pub fn emit_typed_define(
method emit_write (line 315) | pub fn emit_write(
method store_uplevel_as_local (line 338) | fn store_uplevel_as_local(
method emit_read (line 373) | pub fn emit_read(
method resolve_uplevel_symbol (line 396) | fn resolve_uplevel_symbol(
type FunctionChildScope (line 424) | pub struct FunctionChildScope {
method new (line 430) | fn new(parent: CompilationScope) -> Self {
method get_function_root (line 437) | fn get_function_root(&self) -> Rc<FunctionRootScope> {
method emit_typed_define (line 445) | pub fn emit_typed_define(
method emit_write (line 458) | pub fn emit_write(
method emit_read (line 473) | pub fn emit_read(
method resolve_uplevel_symbol (line 488) | fn resolve_uplevel_symbol(
type CompilationScope (line 508) | pub enum CompilationScope {
method module (line 516) | pub fn module() -> Self {
method function (line 520) | pub fn function(&self) -> Self {
method closure (line 524) | pub fn closure(&self, dest: BasicBlock) -> Self {
method get_module_scope (line 528) | pub(crate) fn get_module_scope(&self) -> Option<CompilationScope> {
method child (line 537) | pub fn child(&self) -> Self {
method emit_typed_define (line 548) | pub fn emit_typed_define(
method emit_untyped_define (line 563) | pub fn emit_untyped_define(
method emit_write (line 578) | pub fn emit_write(
method emit_read (line 593) | pub fn emit_read(
method resolve_uplevel_symbol (line 608) | fn resolve_uplevel_symbol(
FILE: lsp/src/document.rs
type DocumentState (line 10) | pub struct DocumentState {
method new (line 19) | pub fn new(text: String) -> Self {
method update_text (line 33) | pub fn update_text(&mut self, text: String) {
method token_at_line_col (line 45) | pub fn token_at_line_col(&self, line: u32, col: u32) -> Option<SyntaxT...
method line_col (line 72) | pub fn line_col(&self, offset: rowan::TextSize) -> LineCol {
method text (line 76) | pub fn text(&self) -> String {
method offset_at_line_col (line 80) | pub fn offset_at_line_col(&self, line: u32, col: u32) -> Option<TextSi...
method def (line 85) | pub fn def(&self, line: u32, col: u32) -> Option<TextRange> {
method parse_error_ranges (line 117) | pub fn parse_error_ranges(&self) -> Vec<(TextRange, String)> {
type DefEntry (line 137) | struct DefEntry {
function build_index (line 144) | fn build_index(root: &SyntaxNode) -> HashMap<String, Vec<DefEntry>> {
function sample_text (line 194) | fn sample_text() -> String {
function token_at_line_col_out_of_bounds_is_none (line 202) | fn token_at_line_col_out_of_bounds_is_none() {
function line_col_matches_token_start (line 208) | fn line_col_matches_token_start() {
function parse_errors_include_expected_tokens (line 222) | fn parse_errors_include_expected_tokens() {
FILE: lsp/src/lexer.rs
type SyntaxKind (line 6) | pub enum SyntaxKind {
function lex (line 248) | pub fn lex(s: &str) -> Vec<Result<(SyntaxKind, &str, logos::Span), LexEr...
type LexError (line 271) | pub struct LexError {
function non_trivia_tokens (line 281) | fn non_trivia_tokens(input: &str) -> Vec<SyntaxKind> {
function test_keywords (line 292) | fn test_keywords() {
function test_identifiers (line 302) | fn test_identifiers() {
function test_literals (line 311) | fn test_literals() {
function test_operators (line 324) | fn test_operators() {
function test_comments_and_whitespace (line 343) | fn test_comments_and_whitespace() {
function test_complex_expression (line 351) | fn test_complex_expression() {
function test_files_in_directory (line 359) | fn test_files_in_directory(dir: &str) {
function test_example_files_lex_without_errors (line 411) | fn test_example_files_lex_without_errors() {
function test_files_lex_without_errors (line 416) | fn test_files_lex_without_errors() {
function test_std_lib_lex_without_errors (line 421) | fn test_std_lib_lex_without_errors() {
function test_std_lib_test_lex_without_errors (line 426) | fn test_std_lib_test_lex_without_errors() {
function test_error_reporting (line 431) | fn test_error_reporting() {
function test_star_number_separation (line 452) | fn test_star_number_separation() {
function test_operator_number_separation (line 467) | fn test_operator_number_separation() {
function test_emoji_identifiers (line 518) | fn test_emoji_identifiers() {
FILE: lsp/src/main.rs
type Logger (line 12) | struct Logger {
method new (line 17) | fn new(client: Client) -> Self {
method info (line 27) | fn info(&self, msg: impl Into<String>) {
type Backend (line 32) | struct Backend {
method info (line 39) | fn info(&self, msg: String) {
function to_lsp_position (line 44) | fn to_lsp_position(doc: &DocumentState, offset: rowan::TextSize) -> Posi...
function to_lsp_range (line 49) | fn to_lsp_range(doc: &DocumentState, range: TextRange) -> Range {
method initialize (line 58) | async fn initialize(&self, _: InitializeParams) -> Result<InitializeResu...
method initialized (line 72) | async fn initialized(&self, _: InitializedParams) {
method shutdown (line 76) | async fn shutdown(&self) -> Result<()> {
method did_open (line 80) | async fn did_open(&self, params: DidOpenTextDocumentParams) {
method did_change (line 115) | async fn did_change(&self, params: DidChangeTextDocumentParams) {
method did_close (line 190) | async fn did_close(&self, params: DidCloseTextDocumentParams) {
method goto_definition (line 196) | async fn goto_definition(
function main (line 228) | async fn main() {
FILE: lsp/src/parser.rs
function from (line 10) | fn from(kind: SyntaxKind) -> Self {
type Lang (line 16) | pub enum Lang {}
type Kind (line 18) | type Kind = SyntaxKind;
method kind_from_raw (line 19) | fn kind_from_raw(raw: rowan::SyntaxKind) -> Self::Kind {
method kind_to_raw (line 23) | fn kind_to_raw(kind: Self::Kind) -> rowan::SyntaxKind {
type ParseError (line 29) | pub struct ParseError {
method expected (line 50) | pub fn expected(&self) -> SyntaxKind {
method pos (line 53) | pub fn pos(&self) -> Option<Range<usize>> {
type Parse (line 34) | pub struct Parse {
method syntax (line 40) | pub fn syntax(&self) -> SyntaxNode {
method errors (line 44) | pub fn errors(&self) -> &Vec<ParseError> {
function parse (line 58) | pub fn parse(text: &str) -> Parse {
type SyntaxNode (line 1385) | pub type SyntaxNode = rowan::SyntaxNode<Lang>;
type SyntaxToken (line 1388) | pub type SyntaxToken = rowan::SyntaxToken<Lang>;
type SyntaxElement (line 1391) | pub type SyntaxElement = rowan::NodeOrToken<SyntaxNode, SyntaxToken>;
function tree_to_string (line 1399) | fn tree_to_string(node: SyntaxNode) -> String {
type CompressedIndex (line 1408) | struct CompressedIndex {
method new (line 1414) | fn new(root: &SyntaxNode) -> Self {
method token_range (line 1433) | fn token_range(&self, tok: &SyntaxToken) -> Option<(usize, usize)> {
method node_range (line 1440) | fn node_range(&self, node: &SyntaxNode) -> Option<(usize, usize)> {
function tree_to_string_impl (line 1464) | fn tree_to_string_impl(
function expect_tree (line 1504) | fn expect_tree(input: &str, lines: &[&str]) {
function test_empty (line 1516) | fn test_empty() {
function test_empty_function (line 1521) | fn test_empty_function() {
function test_param_list (line 1540) | fn test_param_list() {
function test_val (line 1564) | fn test_val() {
function test_binary_expr (line 1590) | fn test_binary_expr() {
function test_list_literal_empty (line 1624) | fn test_list_literal_empty() {
function test_list_literal_with_elements (line 1651) | fn test_list_literal_with_elements() {
function test_list_literal_nested (line 1686) | fn test_list_literal_nested() {
function test_unary_expr (line 1727) | fn test_unary_expr() {
function test_member_access (line 1755) | fn test_member_access() {
function test_array_access (line 1784) | fn test_array_access() {
function test_function_call (line 1815) | fn test_function_call() {
function test_chained_postfix (line 1850) | fn test_chained_postfix() {
function test_files_in_directory_parse (line 1890) | fn test_files_in_directory_parse(dir: &str, dir_should_error: Vec<String...
function test_assignment_basic (line 1957) | fn test_assignment_basic() {
function test_assignment_compound (line 1984) | fn test_assignment_compound() {
function test_assignment_all_compound_operators (line 2011) | fn test_assignment_all_compound_operators() {
function test_assignment_precedence (line 2062) | fn test_assignment_precedence() {
function test_assignment_right_associative (line 2093) | fn test_assignment_right_associative() {
function test_simple_binary_expr (line 2124) | fn test_simple_binary_expr() {
function test_assert_statement (line 2154) | fn test_assert_statement() {
function test_example_files_parse_without_errors (line 2182) | fn test_example_files_parse_without_errors() {
function test_files_parse_without_errors (line 2187) | fn test_files_parse_without_errors() {
function test_std_lib_files_parse_without_errors (line 2192) | fn test_std_lib_files_parse_without_errors() {
function test_std_lib_test_files_parse_without_errors (line 2197) | fn test_std_lib_test_files_parse_without_errors() {
FILE: native-libs/file/src/lib.rs
constant FILE_MODE_READ (line 24) | const FILE_MODE_READ: i64 = 1;
constant FILE_MODE_WRITE (line 25) | const FILE_MODE_WRITE: i64 = 2;
constant FILE_MODE_APPEND (line 26) | const FILE_MODE_APPEND: i64 = 4;
constant FILE_MODE_TRUNCATE (line 27) | const FILE_MODE_TRUNCATE: i64 = 8;
constant FILE_MODE_NEED_NEW (line 28) | const FILE_MODE_NEED_NEW: i64 = 16;
function open_options_from_int (line 30) | fn open_options_from_int(n: i64) -> OpenOptions {
type MutableFile (line 64) | struct MutableFile {
function file_symbol (line 68) | fn file_symbol(builtins: &VmGlobals) -> Result<Symbol, VmErrorReason> {
function mut_file_from_aria (line 74) | fn mut_file_from_aria(
function throw_io_error (line 87) | fn throw_io_error(
type New (line 106) | struct New {}
method eval (line 108) | fn eval(
method attrib_byte (line 145) | fn attrib_byte(&self) -> u8 {
method arity (line 149) | fn arity(&self) -> haxby_vm::arity::Arity {
method name (line 153) | fn name(&self) -> &str {
type Close (line 159) | struct Close {}
method eval (line 161) | fn eval(
method attrib_byte (line 176) | fn attrib_byte(&self) -> u8 {
method arity (line 180) | fn arity(&self) -> haxby_vm::arity::Arity {
method name (line 184) | fn name(&self) -> &str {
type ReadAll (line 190) | struct ReadAll {}
method eval (line 192) | fn eval(
method attrib_byte (line 217) | fn attrib_byte(&self) -> u8 {
method arity (line 221) | fn arity(&self) -> haxby_vm::arity::Arity {
method name (line 225) | fn name(&self) -> &str {
type ReadCount (line 231) | struct ReadCount {}
method eval (line 233) | fn eval(
method attrib_byte (line 267) | fn attrib_byte(&self) -> u8 {
method arity (line 271) | fn arity(&self) -> haxby_vm::arity::Arity {
method name (line 275) | fn name(&self) -> &str {
type WriteStr (line 281) | struct WriteStr {}
method eval (line 283) | fn eval(
method attrib_byte (line 307) | fn attrib_byte(&self) -> u8 {
method arity (line 311) | fn arity(&self) -> haxby_vm::arity::Arity {
method name (line 315) | fn name(&self) -> &str {
type GetPos (line 321) | struct GetPos {}
method eval (line 323) | fn eval(
method attrib_byte (line 347) | fn attrib_byte(&self) -> u8 {
method arity (line 351) | fn arity(&self) -> haxby_vm::arity::Arity {
method name (line 355) | fn name(&self) -> &str {
type SetPos (line 361) | struct SetPos {}
method eval (line 363) | fn eval(
method attrib_byte (line 388) | fn attrib_byte(&self) -> u8 {
method arity (line 392) | fn arity(&self) -> haxby_vm::arity::Arity {
method name (line 396) | fn name(&self) -> &str {
type GetSize (line 402) | struct GetSize {}
method eval (line 404) | fn eval(
method attrib_byte (line 430) | fn attrib_byte(&self) -> u8 {
method arity (line 434) | fn arity(&self) -> haxby_vm::arity::Arity {
method name (line 438) | fn name(&self) -> &str {
type Flush (line 444) | struct Flush {}
method eval (line 446) | fn eval(
method attrib_byte (line 467) | fn attrib_byte(&self) -> u8 {
method arity (line 471) | fn arity(&self) -> haxby_vm::arity::Arity {
method name (line 475) | fn name(&self) -> &str {
function dylib_haxby_inject (line 482) | pub extern "C" fn dylib_haxby_inject(
FILE: native-libs/network/src/lib.rs
type RequestGet (line 11) | struct RequestGet {}
method eval (line 13) | fn eval(
method attrib_byte (line 152) | fn attrib_byte(&self) -> u8 {
method arity (line 156) | fn arity(&self) -> haxby_vm::arity::Arity {
method name (line 160) | fn name(&self) -> &str {
type RequestPost (line 166) | struct RequestPost {}
method eval (line 168) | fn eval(
method attrib_byte (line 312) | fn attrib_byte(&self) -> u8 {
method arity (line 316) | fn arity(&self) -> haxby_vm::arity::Arity {
method name (line 320) | fn name(&self) -> &str {
function dylib_haxby_inject (line 327) | pub extern "C" fn dylib_haxby_inject(
FILE: native-libs/path/src/lib.rs
type MutablePath (line 21) | struct MutablePath {
function new_from_path (line 25) | fn new_from_path<P: AsRef<std::path::Path>>(
function create_path_result_err (line 44) | fn create_path_result_err(
function mut_path_from_aria (line 71) | fn mut_path_from_aria(
function path_symbol (line 86) | fn path_symbol(vm: &mut vm::VirtualMachine) -> Symbol {
type New (line 93) | struct New {}
method eval (line 95) | fn eval(
method attrib_byte (line 113) | fn attrib_byte(&self) -> u8 {
method arity (line 117) | fn arity(&self) -> haxby_vm::arity::Arity {
method name (line 121) | fn name(&self) -> &str {
type PathBufAriaIterator (line 126) | struct PathBufAriaIterator {
type Item (line 133) | type Item = RuntimeValue;
method next (line 135) | fn next(&mut self, vm: &mut crate::vm::VirtualMachine) -> Option<Self::I...
type Glob (line 150) | struct Glob {}
method eval (line 152) | fn eval(
method attrib_byte (line 195) | fn attrib_byte(&self) -> u8 {
method arity (line 199) | fn arity(&self) -> haxby_vm::arity::Arity {
method name (line 203) | fn name(&self) -> &str {
type Cwd (line 209) | struct Cwd {}
method eval (line 211) | fn eval(
method attrib_byte (line 227) | fn attrib_byte(&self) -> u8 {
method arity (line 231) | fn arity(&self) -> haxby_vm::arity::Arity {
method name (line 235) | fn name(&self) -> &str {
type Prettyprint (line 241) | struct Prettyprint {}
method eval (line 243) | fn eval(
method attrib_byte (line 263) | fn attrib_byte(&self) -> u8 {
method arity (line 267) | fn arity(&self) -> haxby_vm::arity::Arity {
method name (line 271) | fn name(&self) -> &str {
type Append (line 277) | struct Append {}
method eval (line 279) | fn eval(
method attrib_byte (line 296) | fn attrib_byte(&self) -> u8 {
method arity (line 300) | fn arity(&self) -> haxby_vm::arity::Arity {
method name (line 304) | fn name(&self) -> &str {
type Pop (line 310) | struct Pop {}
method eval (line 312) | fn eval(
method attrib_byte (line 327) | fn attrib_byte(&self) -> u8 {
method arity (line 331) | fn arity(&self) -> haxby_vm::arity::Arity {
method name (line 335) | fn name(&self) -> &str {
type IsAbsolutePath (line 341) | struct IsAbsolutePath {}
method eval (line 343) | fn eval(
method attrib_byte (line 359) | fn attrib_byte(&self) -> u8 {
method arity (line 363) | fn arity(&self) -> haxby_vm::arity::Arity {
method name (line 367) | fn name(&self) -> &str {
type Exists (line 373) | struct Exists {}
method eval (line 375) | fn eval(
method attrib_byte (line 391) | fn attrib_byte(&self) -> u8 {
method arity (line 395) | fn arity(&self) -> haxby_vm::arity::Arity {
method name (line 399) | fn name(&self) -> &str {
type IsDirectory (line 405) | struct IsDirectory {}
method eval (line 407) | fn eval(
method attrib_byte (line 423) | fn attrib_byte(&self) -> u8 {
method arity (line 427) | fn arity(&self) -> haxby_vm::arity::Arity {
method name (line 431) | fn name(&self) -> &str {
type IsFile (line 437) | struct IsFile {}
method eval (line 439) | fn eval(
method attrib_byte (line 455) | fn attrib_byte(&self) -> u8 {
method arity (line 459) | fn arity(&self) -> haxby_vm::arity::Arity {
method name (line 463) | fn name(&self) -> &str {
type IsSymlink (line 469) | struct IsSymlink {}
method eval (line 471) | fn eval(
method attrib_byte (line 487) | fn attrib_byte(&self) -> u8 {
method arity (line 491) | fn arity(&self) -> haxby_vm::arity::Arity {
method name (line 495) | fn name(&self) -> &str {
type Canonical (line 501) | struct Canonical {}
method eval (line 503) | fn eval(
method attrib_byte (line 528) | fn attrib_byte(&self) -> u8 {
method arity (line 532) | fn arity(&self) -> haxby_vm::arity::Arity {
method name (line 536) | fn name(&self) -> &str {
type Size (line 542) | struct Size {}
method eval (line 544) | fn eval(
method attrib_byte (line 565) | fn attrib_byte(&self) -> u8 {
method arity (line 569) | fn arity(&self) -> haxby_vm::arity::Arity {
method name (line 573) | fn name(&self) -> &str {
type CreatedTime (line 579) | struct CreatedTime {}
method eval (line 581) | fn eval(
method attrib_byte (line 610) | fn attrib_byte(&self) -> u8 {
method arity (line 614) | fn arity(&self) -> haxby_vm::arity::Arity {
method name (line 618) | fn name(&self) -> &str {
type AccessedTime (line 624) | struct AccessedTime {}
method eval (line 626) | fn eval(
method attrib_byte (line 655) | fn attrib_byte(&self) -> u8 {
method arity (line 659) | fn arity(&self) -> haxby_vm::arity::Arity {
method name (line 663) | fn name(&self) -> &str {
type ModifiedTime (line 669) | struct ModifiedTime {}
method eval (line 671) | fn eval(
method attrib_byte (line 700) | fn attrib_byte(&self) -> u8 {
method arity (line 704) | fn arity(&self) -> haxby_vm::arity::Arity {
method name (line 708) | fn name(&self) -> &str {
type Filename (line 714) | struct Filename {}
method eval (line 716) | fn eval(
method attrib_byte (line 742) | fn attrib_byte(&self) -> u8 {
method arity (line 746) | fn arity(&self) -> haxby_vm::arity::Arity {
method name (line 750) | fn name(&self) -> &str {
type Extension (line 756) | struct Extension {}
method eval (line 758) | fn eval(
method attrib_byte (line 784) | fn attrib_byte(&self) -> u8 {
method arity (line 788) | fn arity(&self) -> haxby_vm::arity::Arity {
method name (line 792) | fn name(&self) -> &str {
type Entries (line 798) | struct Entries {}
method eval (line 800) | fn eval(
method attrib_byte (line 847) | fn attrib_byte(&self) -> u8 {
method arity (line 851) | fn arity(&self) -> haxby_vm::arity::Arity {
method name (line 855) | fn name(&self) -> &str {
type MakeDirectory (line 861) | struct MakeDirectory {}
method eval (line 863) | fn eval(
method attrib_byte (line 879) | fn attrib_byte(&self) -> u8 {
method arity (line 883) | fn arity(&self) -> haxby_vm::arity::Arity {
method name (line 887) | fn name(&self) -> &str {
type MakeDirectories (line 893) | struct MakeDirectories {}
method eval (line 895) | fn eval(
method attrib_byte (line 911) | fn attrib_byte(&self) -> u8 {
method arity (line 915) | fn arity(&self) -> haxby_vm::arity::Arity {
method name (line 919) | fn name(&self) -> &str {
type RemoveDirectory (line 925) | struct RemoveDirectory {}
method eval (line 927) | fn eval(
method attrib_byte (line 943) | fn attrib_byte(&self) -> u8 {
method arity (line 947) | fn arity(&self) -> haxby_vm::arity::Arity {
method name (line 951) | fn name(&self) -> &str {
type RemoveFile (line 957) | struct RemoveFile {}
method eval (line 959) | fn eval(
method attrib_byte (line 975) | fn attrib_byte(&self) -> u8 {
method arity (line 979) | fn arity(&self) -> haxby_vm::arity::Arity {
method name (line 983) | fn name(&self) -> &str {
type Copy (line 989) | struct Copy {}
method eval (line 991) | fn eval(
method attrib_byte (line 1013) | fn attrib_byte(&self) -> u8 {
method arity (line 1017) | fn arity(&self) -> haxby_vm::arity::Arity {
method name (line 1021) | fn name(&self) -> &str {
type CommonAncestor (line 1027) | struct CommonAncestor {}
method eval (line 1029) | fn eval(
method attrib_byte (line 1057) | fn attrib_byte(&self) -> u8 {
method arity (line 1061) | fn arity(&self) -> haxby_vm::arity::Arity {
method name (line 1065) | fn name(&self) -> &str {
type Equals (line 1071) | struct Equals {}
method eval (line 1073) | fn eval(
method attrib_byte (line 1093) | fn attrib_byte(&self) -> u8 {
method arity (line 1097) | fn arity(&self) -> haxby_vm::arity::Arity {
method name (line 1101) | fn name(&self) -> &str {
function dylib_haxby_inject (line 1108) | pub extern "C" fn dylib_haxby_inject(
FILE: native-libs/platform/src/lib.rs
constant LINUX_CASE (line 11) | const LINUX_CASE: usize = 0;
constant MACOS_CASE (line 13) | const MACOS_CASE: usize = 1;
constant UNKNOWN_CASE (line 15) | const UNKNOWN_CASE: usize = 2;
type GetPlatformInfo (line 18) | struct GetPlatformInfo {}
method eval (line 21) | fn eval(
method eval (line 67) | fn eval(
method eval (line 117) | fn eval(
method arity (line 140) | fn arity(&self) -> haxby_vm::arity::Arity {
method attrib_byte (line 144) | fn attrib_byte(&self) -> u8 {
method name (line 148) | fn name(&self) -> &str {
function dylib_haxby_inject (line 155) | pub extern "C" fn dylib_haxby_inject(
FILE: native-libs/regex/src/lib.rs
function create_regex_error (line 16) | fn create_regex_error(
type New (line 42) | struct New {}
method eval (line 44) | fn eval(&self, frame: &mut Frame, vm: &mut VirtualMachine) -> ExecutionR...
method attrib_byte (line 85) | fn attrib_byte(&self) -> u8 {
method arity (line 89) | fn arity(&self) -> haxby_vm::arity::Arity {
method name (line 93) | fn name(&self) -> &str {
type AnyMatch (line 99) | struct AnyMatch {}
method eval (line 101) | fn eval(&self, frame: &mut Frame, vm: &mut VirtualMachine) -> ExecutionR...
method attrib_byte (line 124) | fn attrib_byte(&self) -> u8 {
method arity (line 128) | fn arity(&self) -> haxby_vm::arity::Arity {
method name (line 132) | fn name(&self) -> &str {
type Matches (line 138) | struct Matches {}
method eval (line 140) | fn eval(&self, frame: &mut Frame, vm: &mut VirtualMachine) -> ExecutionR...
method attrib_byte (line 209) | fn attrib_byte(&self) -> u8 {
method arity (line 213) | fn arity(&self) -> haxby_vm::arity::Arity {
method name (line 217) | fn name(&self) -> &str {
type Replace (line 223) | struct Replace {}
method eval (line 225) | fn eval(&self, frame: &mut Frame, vm: &mut VirtualMachine) -> ExecutionR...
method attrib_byte (line 253) | fn attrib_byte(&self) -> u8 {
method arity (line 257) | fn arity(&self) -> haxby_vm::arity::Arity {
method name (line 261) | fn name(&self) -> &str {
function dylib_haxby_inject (line 268) | pub extern "C" fn dylib_haxby_inject(
FILE: native-libs/timezone/src/lib.rs
type TimezoneInfo (line 10) | struct TimezoneInfo {}
method eval (line 12) | fn eval(
method arity (line 57) | fn arity(&self) -> haxby_vm::arity::Arity {
method name (line 61) | fn name(&self) -> &str {
function dylib_haxby_inject (line 68) | pub extern "C" fn dylib_haxby_inject(
FILE: native-libs/unicode/src/lib.rs
type CharFunctionImpl (line 14) | trait CharFunctionImpl {
method do_check (line 15) | fn do_check(c: char) -> bool;
method name (line 16) | fn name() -> &'static str;
type CharBuiltinFunction (line 42) | struct CharBuiltinFunction<T: CharFunctionImpl + Default> {
method default (line 47) | fn default() -> Self {
method eval (line 55) | fn eval(
method arity (line 71) | fn arity(&self) -> haxby_vm::arity::Arity {
method name (line 75) | fn name(&self) -> &str {
function dylib_haxby_inject (line 82) | pub extern "C" fn dylib_haxby_inject(
FILE: opcodes-lib/src/lib.rs
constant OPCODE_NOP (line 2) | pub const OPCODE_NOP: u8 = 0;
constant OPCODE_PUSH (line 3) | pub const OPCODE_PUSH: u8 = 1;
constant OPCODE_PUSH_0 (line 4) | pub const OPCODE_PUSH_0: u8 = 2;
constant OPCODE_PUSH_1 (line 5) | pub const OPCODE_PUSH_1: u8 = 3;
constant OPCODE_PUSH_TRUE (line 6) | pub const OPCODE_PUSH_TRUE: u8 = 4;
constant OPCODE_PUSH_FALSE (line 7) | pub const OPCODE_PUSH_FALSE: u8 = 5;
constant OPCODE_PUSH_BUILTIN_TYPE (line 8) | pub const OPCODE_PUSH_BUILTIN_TYPE: u8 = 6;
constant OPCODE_PUSH_RUNTIME_VALUE (line 9) | pub const OPCODE_PUSH_RUNTIME_VALUE: u8 = 7;
constant OPCODE_POP (line 10) | pub const OPCODE_POP: u8 = 8;
constant OPCODE_DUP (line 11) | pub const OPCODE_DUP: u8 = 9;
constant OPCODE_SWAP (line 12) | pub const OPCODE_SWAP: u8 = 10;
constant OPCODE_COPY (line 13) | pub const OPCODE_COPY: u8 = 11;
constant OPCODE_ADD (line 15) | pub const OPCODE_ADD: u8 = 20;
constant OPCODE_SUB (line 16) | pub const OPCODE_SUB: u8 = 21;
constant OPCODE_MUL (line 17) | pub const OPCODE_MUL: u8 = 22;
constant OPCODE_DIV (line 18) | pub const OPCODE_DIV: u8 = 23;
constant OPCODE_REM (line 19) | pub const OPCODE_REM: u8 = 24;
constant OPCODE_NEG (line 20) | pub const OPCODE_NEG: u8 = 25;
constant OPCODE_SHL (line 21) | pub const OPCODE_SHL: u8 = 26;
constant OPCODE_SHR (line 22) | pub const OPCODE_SHR: u8 = 27;
constant OPCODE_READ_LOCAL (line 24) | pub const OPCODE_READ_LOCAL: u8 = 30;
constant OPCODE_WRITE_LOCAL (line 25) | pub const OPCODE_WRITE_LOCAL: u8 = 31;
constant OPCODE_TYPEDEF_LOCAL (line 26) | pub const OPCODE_TYPEDEF_LOCAL: u8 = 32;
constant OPCODE_READ_NAMED (line 27) | pub const OPCODE_READ_NAMED: u8 = 33;
constant OPCODE_WRITE_NAMED (line 28) | pub const OPCODE_WRITE_NAMED: u8 = 34;
constant OPCODE_TYPEDEF_NAMED (line 29) | pub const OPCODE_TYPEDEF_NAMED: u8 = 35;
constant OPCODE_READ_INDEX (line 30) | pub const OPCODE_READ_INDEX: u8 = 36;
constant OPCODE_WRITE_INDEX (line 31) | pub const OPCODE_WRITE_INDEX: u8 = 37;
constant OPCODE_READ_ATTRIBUTE (line 32) | pub const OPCODE_READ_ATTRIBUTE: u8 = 38;
constant OPCODE_WRITE_ATTRIBUTE (line 33) | pub const OPCODE_WRITE_ATTRIBUTE: u8 = 39;
constant OPCODE_READ_UPLEVEL (line 34) | pub const OPCODE_READ_UPLEVEL: u8 = 40;
constant OPCODE_EQ (line 36) | pub const OPCODE_EQ: u8 = 50;
constant OPCODE_LT (line 37) | pub const OPCODE_LT: u8 = 51;
constant OPCODE_GT (line 38) | pub const OPCODE_GT: u8 = 52;
constant OPCODE_LTE (line 39) | pub const OPCODE_LTE: u8 = 53;
constant OPCODE_GTE (line 40) | pub const OPCODE_GTE: u8 = 54;
constant OPCODE_ISA (line 41) | pub const OPCODE_ISA: u8 = 55;
constant OPCODE_LOGICAL_AND (line 42) | pub const OPCODE_LOGICAL_AND: u8 = 56;
constant OPCODE_LOGICAL_OR (line 43) | pub const OPCODE_LOGICAL_OR: u8 = 57;
constant OPCODE_XOR (line 44) | pub const OPCODE_XOR: u8 = 58;
constant OPCODE_NOT (line 45) | pub const OPCODE_NOT: u8 = 59;
constant OPCODE_BITWISE_AND (line 46) | pub const OPCODE_BITWISE_AND: u8 = 60;
constant OPCODE_BITWISE_OR (line 47) | pub const OPCODE_BITWISE_OR: u8 = 61;
constant OPCODE_JUMP (line 48) | pub const OPCODE_JUMP: u8 = 62;
constant OPCODE_JUMP_TRUE (line 49) | pub const OPCODE_JUMP_TRUE: u8 = 63;
constant OPCODE_JUMP_FALSE (line 50) | pub const OPCODE_JUMP_FALSE: u8 = 64;
constant OPCODE_JUMP_CONDITIONALLY (line 51) | pub const OPCODE_JUMP_CONDITIONALLY: u8 = 65;
constant OPCODE_JUMP_IF_ARG_SUPPLIED (line 52) | pub const OPCODE_JUMP_IF_ARG_SUPPLIED: u8 = 66;
constant OPCODE_TRY_ENTER (line 54) | pub const OPCODE_TRY_ENTER: u8 = 72;
constant OPCODE_TRY_EXIT (line 55) | pub const OPCODE_TRY_EXIT: u8 = 73;
constant OPCODE_THROW (line 56) | pub const OPCODE_THROW: u8 = 74;
constant OPCODE_CALL (line 57) | pub const OPCODE_CALL: u8 = 75;
constant OPCODE_RETURN (line 58) | pub const OPCODE_RETURN: u8 = 76;
constant OPCODE_RETURN_UNIT (line 59) | pub const OPCODE_RETURN_UNIT: u8 = 77;
constant OPCODE_BUILD_LIST (line 61) | pub const OPCODE_BUILD_LIST: u8 = 80;
constant OPCODE_BUILD_FUNCTION (line 62) | pub const OPCODE_BUILD_FUNCTION: u8 = 81;
constant OPCODE_STORE_UPLEVEL (line 63) | pub const OPCODE_STORE_UPLEVEL: u8 = 82;
constant OPCODE_BUILD_STRUCT (line 64) | pub const OPCODE_BUILD_STRUCT: u8 = 83;
constant OPCODE_BUILD_ENUM (line 65) | pub const OPCODE_BUILD_ENUM: u8 = 84;
constant OPCODE_BUILD_MIXIN (line 66) | pub const OPCODE_BUILD_MIXIN: u8 = 85;
constant OPCODE_BIND_CASE (line 67) | pub const OPCODE_BIND_CASE: u8 = 87;
constant OPCODE_INCLUDE_MIXIN (line 68) | pub const OPCODE_INCLUDE_MIXIN: u8 = 88;
constant OPCODE_NEW_ENUM_VAL (line 69) | pub const OPCODE_NEW_ENUM_VAL: u8 = 89;
constant OPCODE_ENUM_CHECK_IS_CASE (line 70) | pub const OPCODE_ENUM_CHECK_IS_CASE: u8 = 90;
constant OPCODE_ENUM_TRY_EXTRACT_PAYLOAD (line 71) | pub const OPCODE_ENUM_TRY_EXTRACT_PAYLOAD: u8 = 91;
constant OPCODE_TRY_UNWRAP_PROTOCOL (line 72) | pub const OPCODE_TRY_UNWRAP_PROTOCOL: u8 = 92;
constant OPCODE_READ_ATTRIBUTE_SYMBOL (line 74) | pub const OPCODE_READ_ATTRIBUTE_SYMBOL: u8 = 100;
constant OPCODE_WRITE_ATTRIBUTE_SYMBOL (line 75) | pub const OPCODE_WRITE_ATTRIBUTE_SYMBOL: u8 = 101;
constant OPCODE_NEW_ENUM_VAL_SYMBOL (line 76) | pub const OPCODE_NEW_ENUM_VAL_SYMBOL: u8 = 102;
constant OPCODE_ENUM_CHECK_IS_CASE_SYMBOL (line 77) | pub const OPCODE_ENUM_CHECK_IS_CASE_SYMBOL: u8 = 103;
constant OPCODE_BIND_CASE_SYMBOL (line 78) | pub const OPCODE_BIND_CASE_SYMBOL: u8 = 104;
constant OPCODE_IMPORT (line 80) | pub const OPCODE_IMPORT: u8 = 250;
constant OPCODE_LIFT_MODULE (line 81) | pub const OPCODE_LIFT_MODULE: u8 = 251;
constant OPCODE_LOAD_DYLIB (line 82) | pub const OPCODE_LOAD_DYLIB: u8 = 252;
constant OPCODE_ASSERT (line 83) | pub const OPCODE_ASSERT: u8 = 253;
constant OPCODE_HALT (line 84) | pub const OPCODE_HALT: u8 = 254;
constant FUNC_IS_METHOD (line 88) | pub const FUNC_IS_METHOD: u8 = 1_u8 << 0;
constant METHOD_ATTRIBUTE_TYPE (line 89) | pub const METHOD_ATTRIBUTE_TYPE: u8 = 1_u8 << 1;
constant FUNC_ACCEPTS_VARARG (line 90) | pub const FUNC_ACCEPTS_VARARG: u8 = 1_u8 << 2;
type BuiltinValueId (line 98) | pub enum BuiltinValueId {
method to_u8 (line 103) | pub fn to_u8(&self) -> u8 {
method name (line 107) | pub fn name(&self) -> &'static str {
type Error (line 115) | type Error = ();
method try_from (line 117) | fn try_from(value: u8) -> Result<Self, Self::Error> {
type BuiltinTypeId (line 127) | pub enum BuiltinTypeId {
method to_u8 (line 144) | pub fn to_u8(&self) -> u8 {
method last (line 148) | pub fn last() -> Self {
method name (line 152) | pub fn name(&self) -> &'static str {
type Error (line 172) | type Error = ();
method try_from (line 174) | fn try_from(value: u8) -> Result<Self, Self::Error> {
constant CASE_HAS_PAYLOAD (line 196) | pub const CASE_HAS_PAYLOAD: u8 = 1_u8 << 0;
constant PROPAGATE_ERROR (line 204) | pub const PROPAGATE_ERROR: u8 = 1;
constant ASSERT_ERROR (line 205) | pub const ASSERT_ERROR: u8 = 2;
constant FLAG_TO_CALLER (line 206) | pub const FLAG_TO_CALLER: u8 = 3;
type Opcode (line 213) | pub enum Opcode {
method fmt (line 293) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
FILE: parser-lib/src/ast/derive/mod.rs
type Derive (line 6) | pub(super) trait Derive {
method from_parse_tree (line 7) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &Source...
FILE: parser-lib/src/ast/mod.rs
type Location (line 13) | pub struct Location {
method from (line 139) | fn from(value: &pest::Span<'i>) -> Self {
method from (line 148) | fn from(value: &InputLocation) -> Self {
type SourceBuffer (line 19) | pub struct SourceBuffer {
method as_ref (line 25) | fn as_ref(&self) -> &str {
method stdin (line 31) | pub fn stdin(input: &str) -> Self {
method stdin_with_name (line 38) | pub fn stdin_with_name(input: &str, name: &str) -> Self {
method from_path (line 45) | pub fn from_path(path: &Path) -> Result<Self, std::io::Error> {
method file (line 57) | pub fn file(path: &str) -> Result<Self, std::io::Error> {
method as_str (line 73) | pub fn as_str(&self) -> String {
method pointer (line 77) | pub fn pointer(&self, loc: Location) -> SourcePointer {
method lines (line 86) | pub fn lines(&self) -> Vec<String> {
method indices_for_position (line 90) | pub fn indices_for_position(&self, pos: usize) -> (usize, usize) {
method line_for_position (line 98) | pub fn line_for_position(&self, pos: usize) -> String {
method line_index_for_position (line 103) | pub fn line_index_for_position(&self, pos: usize) -> usize {
method pointer_to_whole_buffer (line 107) | pub fn pointer_to_whole_buffer(&self) -> SourcePointer {
method pointer_to_last_line (line 114) | pub fn pointer_to_last_line(&self) -> SourcePointer {
type SourcePointer (line 122) | pub struct SourcePointer {
method fmt (line 128) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
type IntLiteralBase (line 163) | pub enum IntLiteralBase {
type IntLiteral (line 171) | pub struct IntLiteral {
type FloatLiteral (line 178) | pub struct FloatLiteral {
type StringLiteral (line 184) | pub struct StringLiteral {
type Identifier (line 190) | pub struct Identifier {
type IdentifierList (line 196) | pub struct IdentifierList {
method empty (line 202) | pub fn empty(loc: SourcePointer) -> Self {
type ExpressionList (line 211) | pub struct ExpressionList {
method empty (line 217) | pub fn empty(loc: SourcePointer) -> Self {
type ListLiteral (line 226) | pub struct ListLiteral {
type ParenExpression (line 232) | pub struct ParenExpression {
method from (line 238) | fn from(value: &Expression) -> Self {
type Primary (line 247) | pub enum Primary {
method loc (line 257) | pub fn loc(&self) -> &SourcePointer {
method is_int_literal (line 268) | pub fn is_int_literal(&self) -> bool {
method is_float_literal (line 272) | pub fn is_float_literal(&self) -> bool {
method as_int_literal (line 276) | pub fn as_int_literal(&self) -> Option<&IntLiteral> {
method as_float_literal (line 284) | pub fn as_float_literal(&self) -> Option<&FloatLiteral> {
type PostfixTermAttribute (line 294) | pub struct PostfixTermAttribute {
type PostfixTermIndex (line 300) | pub struct PostfixTermIndex {
type PostfixTermCall (line 306) | pub struct PostfixTermCall {
type PostfixTermEnumCase (line 312) | pub struct PostfixTermEnumCase {
type PostfixTermFieldWrite (line 319) | pub struct PostfixTermFieldWrite {
type PostfixTermIndexWrite (line 326) | pub struct PostfixTermIndexWrite {
type PostfixTermWrite (line 334) | pub enum PostfixTermWrite {
method loc (line 340) | pub fn loc(&self) -> &SourcePointer {
type PostfixTermWriteList (line 349) | pub struct PostfixTermWriteList {
type PostfixTermObjectWrite (line 355) | pub struct PostfixTermObjectWrite {
type TryProtocolMode (line 361) | pub enum TryProtocolMode {
type PostfixTermTryProtocol (line 367) | pub struct PostfixTermTryProtocol {
type PostfixTerm (line 374) | pub enum PostfixTerm {
type PostfixExpression (line 384) | pub struct PostfixExpression {
method attrib_read (line 391) | pub fn attrib_read(base: &Primary, name: &str) -> PostfixExpression {
method method_call (line 406) | pub fn method_call(base: &Primary, name: &str, args: &[Expression]) ->...
method from (line 430) | fn from(value: &Primary) -> Self {
type PostfixRvalue (line 440) | pub struct PostfixRvalue {
method from (line 446) | fn from(value: &PostfixExpression) -> Self {
type UnarySymbol (line 455) | pub enum UnarySymbol {
type UnaryOperation (line 461) | pub struct UnaryOperation {
method from (line 468) | fn from(value: &PostfixRvalue) -> Self {
type MulSymbol (line 478) | pub enum MulSymbol {
type AddSymbol (line 485) | pub enum AddSymbol {
type AddEqSymbol (line 491) | pub enum AddEqSymbol {
type MulOperation (line 502) | pub struct MulOperation {
method from (line 509) | fn from(value: &UnaryOperation) -> Self {
type AddOperation (line 519) | pub struct AddOperation {
method from (line 526) | fn from(value: &MulOperation) -> Self {
type ShiftSymbol (line 536) | pub enum ShiftSymbol {
type ShiftOperation (line 542) | pub struct ShiftOperation {
method from (line 549) | fn from(value: &AddOperation) -> Self {
type RelSymbol (line 559) | pub enum RelSymbol {
type RelOperation (line 567) | pub struct RelOperation {
method from (line 574) | fn from(value: &ShiftOperation) -> Self {
type CompSymbol (line 584) | pub enum CompSymbol {
type CompOperation (line 591) | pub struct CompOperation {
method from (line 598) | fn from(value: &RelOperation) -> Self {
type LogSymbol (line 608) | pub enum LogSymbol {
type LogOperation (line 617) | pub struct LogOperation {
method from (line 624) | fn from(value: &CompOperation) -> Self {
type LambdaBody (line 635) | pub enum LambdaBody {
type LambdaFunction (line 661) | pub struct LambdaFunction {
type FunctionBody (line 667) | pub struct FunctionBody {
method from (line 641) | fn from(value: &LambdaBody) -> Self {
method loc (line 672) | pub fn loc(&self) -> &SourcePointer {
type TernaryExpression (line 678) | pub struct TernaryExpression {
type TryUnwrapExpression (line 686) | pub struct TryUnwrapExpression {
type Expression (line 694) | pub enum Expression {
method from (line 702) | fn from(value: &LogOperation) -> Self {
method from (line 708) | fn from(value: &Identifier) -> Self {
method from (line 715) | fn from(value: &Primary) -> Self {
method from (line 722) | fn from(value: &UnaryOperation) -> Self {
method from (line 732) | fn from(value: &PostfixExpression) -> Self {
method loc (line 742) | pub fn loc(&self) -> &SourcePointer {
method call_function_passing_me (line 753) | pub fn call_function_passing_me(&self, func_name: &str) -> Expression {
method is_function_call (line 782) | pub fn is_function_call(&self) -> (bool, Option<&str>) {
type DeclarationId (line 844) | pub struct DeclarationId {
method from (line 851) | fn from(value: &Identifier) -> Self {
type ExpressionStatement (line 861) | pub struct ExpressionStatement {
type ValDeclEntry (line 867) | pub struct ValDeclEntry {
type ValDeclStatement (line 874) | pub struct ValDeclStatement {
type AssignStatement (line 880) | pub struct AssignStatement {
type WriteOpEqStatement (line 887) | pub struct WriteOpEqStatement {
type IfCondPiece (line 895) | pub struct IfCondPiece {
type ElsePiece (line 902) | pub struct ElsePiece {
type ElsifPiece (line 908) | pub struct ElsifPiece {
type IfPiece (line 913) | pub struct IfPiece {
type IfStatement (line 918) | pub struct IfStatement {
type MatchPatternComp (line 926) | pub struct MatchPatternComp {
method isa (line 940) | pub fn isa(loc: SourcePointer, expr: Expression) -> Self {
type MatchPatternRel (line 933) | pub struct MatchPatternRel {
type MatchPatternEnumCase (line 950) | pub struct MatchPatternEnumCase {
type MatchPattern (line 957) | pub enum MatchPattern {
method loc (line 964) | pub fn loc(&self) -> &SourcePointer {
type MatchRule (line 974) | pub struct MatchRule {
method enum_and_case (line 981) | pub fn enum_and_case(
type MatchStatement (line 1016) | pub struct MatchStatement {
type WhileStatement (line 1024) | pub struct WhileStatement {
type ForStatement (line 1032) | pub struct ForStatement {
type ReturnStatement (line 1041) | pub struct ReturnStatement {
method from (line 1047) | fn from(val: &Expression) -> Self {
type ThrowStatement (line 1056) | pub struct ThrowStatement {
type AssertStatement (line 1062) | pub struct AssertStatement {
type BreakStatement (line 1068) | pub struct BreakStatement {
type ContinueStatement (line 1073) | pub struct ContinueStatement {
type TryBlock (line 1078) | pub struct TryBlock {
type Statement (line 1087) | pub enum Statement {
method loc (line 1109) | pub fn loc(&self) -> &SourcePointer {
type CodeBlock (line 1134) | pub struct CodeBlock {
method from (line 1140) | fn from(value: &Statement) -> Self {
type ArgumentDecl (line 1149) | pub struct ArgumentDecl {
method name (line 1156) | pub fn name(&self) -> &String {
method type_info (line 1160) | pub fn type_info(&self) -> Option<&Expression> {
method from (line 1166) | fn from(value: &DeclarationId) -> Self {
type ArgumentList (line 1176) | pub struct ArgumentList {
method empty (line 1183) | pub fn empty(loc: SourcePointer) -> Self {
method len (line 1191) | pub fn len(&self) -> usize {
method is_empty (line 1195) | pub fn is_empty(&self) -> bool {
type FunctionDecl (line 1201) | pub struct FunctionDecl {
type MethodAccess (line 1209) | pub enum MethodAccess {
type MethodDecl (line 1215) | pub struct MethodDecl {
type OperatorSymbol (line 1224) | pub enum OperatorSymbol {
type OperatorDecl (line 1247) | pub struct OperatorDecl {
type MixinIncludeDecl (line 1256) | pub struct MixinIncludeDecl {
type StructEntry (line 1262) | pub enum StructEntry {
method loc (line 1272) | pub fn loc(&self) -> &SourcePointer {
type StructDecl (line 1285) | pub struct StructDecl {
type MixinDecl (line 1293) | pub struct MixinDecl {
type EnumCaseDecl (line 1300) | pub struct EnumCaseDecl {
type EnumDeclEntry (line 1308) | pub enum EnumDeclEntry {
method loc (line 1314) | pub fn loc(&self) -> &SourcePointer {
type EnumDecl (line 1323) | pub struct EnumDecl {
type ExtensionDecl (line 1330) | pub struct ExtensionDecl {
type ImportPath (line 1338) | pub struct ImportPath {
method from_dotted_string (line 1344) | pub fn from_dotted_string(loc: SourcePointer, dotted: &str) -> Self {
method to_dotted_string (line 1357) | pub fn to_dotted_string(&self) -> String {
method to_path_string (line 1365) | pub fn to_path_string(&self) -> String {
type ImportStatement (line 1375) | pub struct ImportStatement {
type ImportTarget (line 1381) | pub enum ImportTarget {
type ImportFromStatement (line 1387) | pub struct ImportFromStatement {
type ModuleFlag (line 1394) | pub enum ModuleFlag {
type ModuleFlags (line 1400) | pub struct ModuleFlags {
method empty (line 1405) | pub fn empty() -> Self {
type TopLevelEntry (line 1412) | pub enum TopLevelEntry {
type ParsedModule (line 1434) | pub struct ParsedModule {
type ParserError (line 1441) | pub struct ParserError {
method fmt (line 1447) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
type ParserResult (line 1452) | pub type ParserResult<T> = Result<T, ParserError>;
function source_to_ast (line 1454) | pub fn source_to_ast(source: &SourceBuffer) -> ParserResult<ParsedModule> {
FILE: parser-lib/src/ast/nodes/add_eq_symbol.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, _: &SourceBuffer)...
method prettyprint (line 28) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/add_operation.rs
method from_parse_tree (line 13) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 52) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/add_symbol.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, _: &SourceBuffer)...
method prettyprint (line 23) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/argument_decl.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 27) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/argument_list.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 36) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/assert_statement.rs
method prettyprint (line 16) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/assign_statement.rs
method from_parse_tree (line 9) | fn from_parse_tree(
method prettyprint (line 38) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/break_statement.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 22) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/code_block.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 27) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/comp_operation.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 38) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/comp_symbol.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, _: &SourceBuffer)...
method prettyprint (line 24) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/continue_statement.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 22) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/declaration_id.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 29) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/else_piece.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 26) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/elsif_piece.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 22) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/enum_case_decl.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 29) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/enum_decl.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 46) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/enum_decl_entry.rs
method prettyprint (line 18) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/expression.rs
method from_parse_tree (line 13) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 33) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/expression_list.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 27) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/expression_statement.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 25) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/extension_decl.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 45) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/float_literal.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 23) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/for_statement.rs
method from_parse_tree (line 12) | fn from_parse_tree(
method prettyprint (line 37) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/function_body.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 40) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/function_decl.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 35) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/identifier.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 23) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/identifier_list.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 27) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/if_cond_piece.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 29) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/if_piece.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 22) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/if_statement.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 49) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/import_from_statement.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 27) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/import_path.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 27) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/import_statement.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 25) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/import_target.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 25) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/int_literal.rs
method from_parse_tree (line 9) | fn from_parse_tree(
method prettyprint (line 37) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/lambda_body.rs
method prettyprint (line 16) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/lambda_function.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 27) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/list_literal.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 29) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/log_operation.rs
method from_parse_tree (line 13) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 52) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/log_symbol.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, _: &SourceBuffer)...
method prettyprint (line 26) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/match_pattern.rs
method prettyprint (line 21) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/match_pattern_comp.rs
method prettyprint (line 16) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/match_pattern_enum_case.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 29) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/match_pattern_rel.rs
method prettyprint (line 16) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/match_rule.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 40) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/match_statement.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 47) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/method_access.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, _: &SourceBuffer)...
method prettyprint (line 23) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/method_decl.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 42) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/mixin_decl.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 31) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/mixin_include_decl.rs
method prettyprint (line 16) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/module_flag.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 28) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/module_flags.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 29) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/mul_operation.rs
method from_parse_tree (line 13) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 51) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/mul_symbol.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, _: &SourceBuffer)...
method prettyprint (line 24) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/operator_decl.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 44) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/operator_symbol.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, _: &SourceBuffer)...
method prettyprint (line 40) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/paren_expression.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 25) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/parsed_module.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 36) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/postfix_expression.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 35) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/postfix_rvalue.rs
method prettyprint (line 16) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/postfix_term.rs
method prettyprint (line 29) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/postfix_term_attribute.rs
method prettyprint (line 16) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/postfix_term_call.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 30) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/postfix_term_enum_case.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 29) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/postfix_term_field_write.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 27) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/postfix_term_index.rs
method from_parse_tree (line 9) | fn from_parse_tree(
method prettyprint (line 29) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/postfix_term_index_write.rs
method from_parse_tree (line 9) | fn from_parse_tree(
method prettyprint (line 38) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/postfix_term_object_write.rs
method prettyprint (line 16) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/postfix_term_try_protocol.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 35) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/postfix_term_write.rs
method prettyprint (line 16) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/postfix_term_write_list.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 27) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/primary.rs
method prettyprint (line 31) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/rel_operation.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 41) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/rel_symbol.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, _: &SourceBuffer)...
method prettyprint (line 25) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/return_statement.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 25) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/shift_operation.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 39) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/shift_symbol.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, _: &SourceBuffer)...
method prettyprint (line 23) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/statement.rs
method prettyprint (line 39) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/string_literal.rs
function process_string_literal (line 14) | fn process_string_literal(s: &str) -> String {
method from_parse_tree (line 88) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 99) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/struct_decl.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 45) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/struct_entry.rs
method from_parse_tree (line 13) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 39) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/ternary_expression.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 29) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/throw_statement.rs
method prettyprint (line 16) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/top_level_entry.rs
method prettyprint (line 39) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/try_block.rs
method prettyprint (line 16) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/try_unwrap_expression.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 27) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/unary_operation.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 71) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/unary_symbol.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, _: &SourceBuffer)...
method prettyprint (line 23) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/val_decl_entry.rs
method prettyprint (line 16) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/val_decl_statement.rs
method from_parse_tree (line 12) | fn from_parse_tree(p: pest::iterators::Pair<'_, Rule>, source: &SourceBu...
method prettyprint (line 27) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/while_statement.rs
method from_parse_tree (line 12) | fn from_parse_tree(
method prettyprint (line 35) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/nodes/write_op_eq_statement.rs
method prettyprint (line 16) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumulator {
FILE: parser-lib/src/ast/prettyprint/mod.rs
type PrettyPrintable (line 7) | pub trait PrettyPrintable {
method prettyprint (line 8) | fn prettyprint(
method prettyprint (line 18) | fn prettyprint(&self, buffer: PrintoutAccumulator) -> PrintoutAccumula...
FILE: parser-lib/src/ast/prettyprint/printout_accumulator.rs
type PrintoutAccumulator (line 5) | pub struct PrintoutAccumulator {
method indent_more (line 11) | pub(crate) fn indent_more(mut self) -> Self {
method indent_less (line 16) | pub(crate) fn indent_less(mut self) -> Self {
method write (line 23) | pub(crate) fn write(mut self, text: &str) -> Self {
method write_indented_list (line 37) | pub(crate) fn write_indented_list<T: PrettyPrintable + std::fmt::Debug>(
method write_separated_list (line 57) | pub(crate) fn write_separated_list<T: PrettyPrintable + std::fmt::Debug>(
method value (line 75) | pub fn value(&self) -> String {
type Output (line 81) | type Output = Self;
method shl (line 83) | fn shl(self, item: &'a T) -> Self::Output {
type Output (line 89) | type Output = Self;
method shl (line 91) | fn shl(self, text: &'a str) -> Self::Output {
type Output (line 97) | type Output = Self;
method shl (line 99) | fn shl(self, text: String) -> Self::Output {
type Output (line 105) | type Output = Self;
method shl (line 107) | fn shl(self, n: &i64) -> Self::Output {
type Output (line 113) | type Output = Self;
method shl (line 115) | fn shl(self, n: f64) -> Self::Output {
type Output (line 121) | type Output = Self;
method shl (line 123) | fn shl(self, n: usize) -> Self::Output {
type Output (line 129) | type Output = Self;
method shl (line 131) | fn shl(self, n: u32) -> Self::Output {
type Output (line 137) | type Output = Self;
method shl (line 139) | fn shl(self, n: u16) -> Self::Output {
type Output (line 145) | type Output = Self;
method shl (line 147) | fn shl(self, n: u8) -> Self::Output {
type Output (line 153) | type Output = Self;
method shl (line 155) | fn shl(self, n: &usize) -> Self::Output {
type Output (line 164) | type Output = Self;
method shl (line 166) | fn shl(self, val: &'a Option<T>) -> Self::Output {
FILE: parser-lib/src/grammar/mod.rs
type HaxbyParser (line 6) | pub struct HaxbyParser;
FILE: test-bin/src/main.rs
type SortBy (line 20) | enum SortBy {
type Args (line 28) | struct Args {
type TestCaseOutcome (line 50) | enum TestCaseOutcome {
method result_emoji (line 58) | fn result_emoji(&self) -> &'static str {
method display_error_reason (line 66) | fn display_error_reason(&self) -> String {
type TestCaseResult (line 76) | struct TestCaseResult {
method pass (line 83) | fn pass(test: &str, duration: Duration) -> Self {
method fail (line 91) | fn fail(test: &str, duration: Duration, reason: String) -> Self {
method xfail (line 99) | fn xfail(test: &str, duration: Duration, reason: String) -> Self {
method fmt (line 109) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
function should_skip_file_name (line 122) | fn should_skip_file_name(path: &std::path::Path, skip_regex: &[Regex]) -...
function parse_tags_from_file (line 129) | fn parse_tags_from_file(path: &str) -> HashSet<String> {
function run_test_from_pattern (line 153) | fn run_test_from_pattern(path: &str) -> TestCaseResult {
type SuiteReport (line 242) | struct SuiteReport {
method num_fails (line 250) | fn num_fails(&self) -> usize {
method num_passes (line 254) | fn num_passes(&self) -> usize {
method num_xfails (line 258) | fn num_xfails(&self) -> usize {
method len (line 262) | fn len(&self) -> usize {
method pass (line 266) | fn pass(&mut self, result: TestCaseResult) {
method fail (line 270) | fn fail(&mut self, result: TestCaseResult) {
method xfail (line 274) | fn xfail(&mut self, result: TestCaseResult) {
method sort (line 278) | fn sort(&mut self, by: &SortBy) -> &mut Self {
method fmt (line 297) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
method report (line 322) | fn report(self) -> ExitCode {
function run_tests_from_pattern (line 331) | fn run_tests_from_pattern(patterns: Paths, args: &Args, skip_regex: &[Re...
function main (line 386) | fn main() -> SuiteReport {
FILE: vm-lib/benches/control_flow.rs
function bench_aria_code_aux (line 9) | fn bench_aria_code_aux(bench_name: &str, src: &str, c: &mut Criterion) {
function bench_if (line 30) | fn bench_if(c: &mut Criterion) {
function bench_for (line 49) | fn bench_for(c: &mut Criterion) {
function bench_while (line 61) | fn bench_while(c: &mut Criterion) {
function bench_empty_function_call (line 74) | fn bench_empty_function_call(c: &mut Criterion) {
function bench_list_read (line 89) | fn bench_list_read(c: &mut Criterion) {
function bench_object_read (line 105) | fn bench_object_read(c: &mut Criterion) {
FILE: vm-lib/src/arity.rs
type Arity (line 4) | pub struct Arity {
method zero (line 10) | pub fn zero() -> Self {
method required (line 17) | pub fn required(r: u8) -> Self {
FILE: vm-lib/src/builtins/alloc.rs
type Alloc (line 14) | struct Alloc {}
method eval (line 16) | fn eval(
method arity (line 48) | fn arity(&self) -> Arity {
method name (line 55) | fn name(&self) -> &str {
function insert_builtins (line 60) | pub(super) fn insert_builtins(builtins: &mut VmGlobals) {
FILE: vm-lib/src/builtins/arity.rs
type Cache (line 13) | struct Cache {
type Arity (line 21) | struct Arity {
method fill_in_cache (line 25) | fn fill_in_cache(&self, vm: &mut crate::vm::VirtualMachine) -> Result<...
function get_to_function_for_callable (line 75) | fn get_to_function_for_callable(
method eval (line 91) | fn eval(
method arity (line 150) | fn arity(&self) -> crate::arity::Arity {
method name (line 157) | fn name(&self) -> &str {
function insert_builtins (line 162) | pub(super) fn insert_builtins(builtins: &mut VmGlobals) {
FILE: vm-lib/src/builtins/boolean.rs
function insert_boolean_builtins (line 8) | pub(super) fn insert_boolean_builtins(builtins: &mut VmGlobals) {
FILE: vm-lib/src/builtins/cmdline_args.rs
type CmdlineArgs (line 10) | struct CmdlineArgs {}
method eval (line 12) | fn eval(
method arity (line 28) | fn arity(&self) -> crate::arity::Arity {
method name (line 32) | fn name(&self) -> &str {
function insert_builtins (line 37) | pub(super) fn insert_builtins(builtins: &mut VmGlobals) {
FILE: vm-lib/src/builtins/exit.rs
type Exit (line 8) | struct Exit {}
method eval (line 10) | fn eval(
method arity (line 19) | fn arity(&self) -> crate::arity::Arity {
method name (line 23) | fn name(&self) -> &str {
function insert_builtins (line 28) | pub(super) fn insert_builtins(builtins: &mut VmGlobals) {
FILE: vm-lib/src/builtins/float.rs
type FpHash (line 17) | struct FpHash {}
method eval (line 19) | fn eval(
method attrib_byte (line 30) | fn attrib_byte(&self) -> u8 {
method arity (line 34) | fn arity(&self) -> crate::arity::Arity {
method name (line 38) | fn name(&self) -> &str {
type FpFloor (line 44) | struct FpFloor {}
method eval (line 46) | fn eval(
method attrib_byte (line 57) | fn attrib_byte(&self) -> u8 {
method arity (line 61) | fn arity(&self) -> crate::arity::Arity {
method name (line 65) | fn name(&self) -> &str {
type FpCeil (line 71) | struct FpCeil {}
method eval (line 73) | fn eval(
method attrib_byte (line 84) | fn attrib_byte(&self) -> u8 {
method arity (line 88) | fn arity(&self) -> crate::arity::Arity {
method name (line 92) | fn name(&self) -> &str {
type FpInt (line 98) | struct FpInt {}
method eval (line 100) | fn eval(
method attrib_byte (line 111) | fn attrib_byte(&self) -> u8 {
method arity (line 115) | fn arity(&self) -> crate::arity::Arity {
method name (line 119) | fn name(&self) -> &str {
type FpPrettyprint (line 125) | struct FpPrettyprint {}
method eval (line 127) | fn eval(
method attrib_byte (line 160) | fn attrib_byte(&self) -> u8 {
method arity (line 164) | fn arity(&self) -> crate::arity::Arity {
method name (line 171) | fn name(&self) -> &str {
function insert_float_builtins (line 176) | pub(super) fn insert_float_builtins(builtins: &mut VmGlobals) {
FILE: vm-lib/src/builtins/getenv.rs
type Getenv (line 10) | struct Getenv {}
method eval (line 12) | fn eval(
method arity (line 36) | fn arity(&self) -> crate::arity::Arity {
method name (line 40) | fn name(&self) -> &str {
function insert_builtins (line 45) | pub(super) fn insert_builtins(builtins: &mut VmGlobals) {
FILE: vm-lib/src/builtins/hasattr.rs
type HasAttr (line 10) | struct HasAttr {}
method eval (line 12) | fn eval(
method arity (line 29) | fn arity(&self) -> crate::arity::Arity {
method name (line 33) | fn name(&self) -> &str {
function insert_builtins (line 38) | pub(super) fn insert_builtins(builtins: &mut VmGlobals) {
FILE: vm-lib/src/builtins/integer.rs
function int_format (line 16) | fn int_format(n: i64, fmt: &str) -> String {
type Prettyprint (line 44) | struct Prettyprint {}
method eval (line 46) | fn eval(
method attrib_byte (line 58) | fn attrib_byte(&self) -> u8 {
method arity (line 62) | fn arity(&self) -> crate::arity::Arity {
method name (line 66) | fn name(&self) -> &str {
function insert_integer_builtins (line 71) | pub(super) fn insert_integer_builtins(builtins: &mut VmGlobals) {
FILE: vm-lib/src/builtins/list.rs
type ListLen (line 17) | struct ListLen {}
method eval (line 19) | fn eval(
method attrib_byte (line 30) | fn attrib_byte(&self) -> u8 {
method arity (line 34) | fn arity(&self) -> crate::arity::Arity {
method name (line 38) | fn name(&self) -> &str {
type ListAppend (line 44) | struct ListAppend {}
method eval (line 46) | fn eval(
method attrib_byte (line 58) | fn attrib_byte(&self) -> u8 {
method arity (line 62) | fn arity(&self) -> crate::arity::Arity {
method name (line 66) | fn name(&self) -> &str {
type Drop (line 72) | struct Drop {}
method eval (line 74) | fn eval(
method attrib_byte (line 90) | fn attrib_byte(&self) -> u8 {
method arity (line 94) | fn arity(&self) -> crate::arity::Arity {
method name (line 98) | fn name(&self) -> &str {
type GetAt (line 104) | struct GetAt {}
method eval (line 106) | fn eval(
method attrib_byte (line 123) | fn attrib_byte(&self) -> u8 {
method arity (line 127) | fn arity(&self) -> crate::arity::Arity {
method name (line 131) | fn name(&self) -> &str {
type OpReadIndex (line 137) | struct OpReadIndex {}
method eval (line 139) | fn eval(
method attrib_byte (line 160) | fn attrib_byte(&self) -> u8 {
method arity (line 164) | fn arity(&self) -> crate::arity::Arity {
method name (line 168) | fn name(&self) -> &str {
type SetAt (line 174) | struct SetAt {}
method eval (line 176) | fn eval(
method attrib_byte (line 194) | fn attrib_byte(&self) -> u8 {
method arity (line 198) | fn arity(&self) -> crate::arity::Arity {
method name (line 202) | fn name(&self) -> &str {
type OpWriteIndex (line 208) | struct OpWriteIndex {}
method eval (line 210) | fn eval(
method attrib_byte (line 232) | fn attrib_byte(&self) -> u8 {
method arity (line 236) | fn arity(&self) -> crate::arity::Arity {
method name (line 240) | fn name(&self) -> &str {
type NewWithCapacity (line 246) | struct NewWithCapacity {}
method eval (line 248) | fn eval(
method attrib_byte (line 261) | fn attrib_byte(&self) -> u8 {
method arity (line 265) | fn arity(&self) -> crate::arity::Arity {
method name (line 269) | fn name(&self) -> &str {
function insert_list_builtins (line 274) | pub(super) fn insert_list_builtins(builtins: &mut VmGlobals) {
FILE: vm-lib/src/builtins/listattrs.rs
type ListAttrs (line 10) | struct ListAttrs {}
method eval (line 12) | fn eval(
method arity (line 28) | fn arity(&self) -> crate::arity::Arity {
method name (line 32) | fn name(&self) -> &str {
function insert_builtins (line 37) | pub(super) fn insert_builtins(builtins: &mut VmGlobals) {
FILE: vm-lib/src/builtins/maybe.rs
function insert_maybe_builtins (line 10) | pub(super) fn insert_maybe_builtins(builtins: &mut VmGlobals) {
FILE: vm-lib/src/builtins/mod.rs
type AriaBuiltinTypes (line 51) | pub struct AriaBuiltinTypes {
method register_builtin_type (line 57) | pub fn register_builtin_type(&mut self, bt: RuntimeValueType) -> Built...
method get_builtin_type (line 64) | pub fn get_builtin_type(&self, id: BuiltinTypeId) -> RuntimeValueType {
type VmGlobals (line 72) | pub struct VmGlobals {
method insert_builtin (line 80) | pub fn insert_builtin<T>(&mut self)
method extract_arg (line 89) | pub fn extract_arg<T, U>(frame: &mut Frame, f: T) -> crate::vm::Execut...
method register_builtin_type (line 106) | pub fn register_builtin_type(&mut self, id: BuiltinTypeId, ty: Runtime...
method intern_symbol (line 171) | pub fn intern_symbol(&mut self, s: &str) -> Result<crate::symbol::Symb...
method lookup_symbol (line 177) | pub fn lookup_symbol(&self, s: &str) -> Option<crate::symbol::Symbol> {
method resolve_symbol (line 181) | pub fn resolve_symbol(&self, sym: crate::symbol::Symbol) -> Option<&st...
method load_named_value (line 185) | pub fn load_named_value(&self, name: &str) -> Option<RuntimeValue> {
method insert (line 190) | pub fn insert(&mut self, name: &str, val: RuntimeValue) {
method get_builtin_type_by_name (line 201) | pub fn get_builtin_type_by_name(&self, name: &str) -> Option<RuntimeVa...
method get_builtin_type_by_id (line 209) | pub fn get_builtin_type_by_id(&self, bt_id: BuiltinTypeId) -> RuntimeV...
method create_maybe_some (line 215) | pub fn create_maybe_some(&self, x: RuntimeValue) -> Result<RuntimeValu...
method create_result_ok (line 228) | pub fn create_result_ok(&self, x: RuntimeValue) -> Result<RuntimeValue...
method create_maybe_none (line 241) | pub fn create_maybe_none(&self) -> Result<RuntimeValue, VmErrorReason> {
method create_result_err (line 254) | pub fn create_result_err(&self, x: RuntimeValue) -> Result<RuntimeValu...
method create_unit_object (line 267) | pub fn create_unit_object(&self) -> Result<RuntimeValue, VmErrorReason> {
method default (line 122) | fn default() -> Self {
FILE: vm-lib/src/builtins/native_iterator.rs
type AriaNativeIterator (line 23) | pub trait AriaNativeIterator {
method next (line 26) | fn next(&mut self, _: &mut crate::vm::VirtualMachine) -> Option<Self::...
type Item (line 33) | type Item = RuntimeValue;
type Item (line 56) | type Item = RuntimeValue;
method next (line 58) | fn next(&mut self, vm: &mut crate::vm::VirtualMachine) -> Option<Self:...
type EmptyIterator (line 31) | struct EmptyIterator {}
type NativeIteratorImpl (line 36) | pub struct NativeIteratorImpl {
method new (line 41) | pub fn new<T>(iter: T) -> Self
method empty (line 50) | pub fn empty() -> Self {
type Next (line 64) | struct Next {}
method eval (line 66) | fn eval(
method attrib_byte (line 91) | fn attrib_byte(&self) -> u8 {
method arity (line 95) | fn arity(&self) -> Arity {
method name (line 99) | fn name(&self) -> &str {
function create_iterator_struct (line 104) | pub fn create_iterator_struct(
FILE: vm-lib/src/builtins/now.rs
type Now (line 10) | struct Now {}
method eval (line 12) | fn eval(
method arity (line 25) | fn arity(&self) -> crate::arity::Arity {
method name (line 29) | fn name(&self) -> &str {
function insert_builtins (line 34) | pub(super) fn insert_builtins(builtins: &mut VmGlobals) {
FILE: vm-lib/src/builtins/prettyprint.rs
type Prettyprint (line 10) | struct Prettyprint {}
method eval (line 12) | fn eval(
method arity (line 23) | fn arity(&self) -> crate::arity::Arity {
method name (line 27) | fn name(&self) -> &str {
function insert_builtins (line 32) | pub(super) fn insert_builtins(builtins: &mut VmGlobals) {
FILE: vm-lib/src/builtins/print.rs
type Print (line 8) | struct Print {}
method eval (line 10) | fn eval(
method arity (line 24) | fn arity(&self) -> crate::arity::Arity {
method name (line 28) | fn name(&self) -> &str {
function insert_builtins (line 33) | pub(super) fn insert_builtins(builtins: &mut VmGlobals) {
FILE: vm-lib/src/builtins/println.rs
type Println (line 8) | struct Println {}
method eval (line 10) | fn eval(
method arity (line 26) | fn arity(&self) -> crate::arity::Arity {
method name (line 33) | fn name(&self) -> &str {
function insert_builtins (line 38) | pub(super) fn insert_builtins(builtins: &mut VmGlobals) {
FILE: vm-lib/src/builtins/readattr.rs
type ReadAttr (line 8) | struct ReadAttr {}
method eval (line 10) | fn eval(
method arity (line 27) | fn arity(&self) -> crate::arity::Arity {
method name (line 31) | fn name(&self) -> &str {
function insert_builtins (line 36) | pub(super) fn insert_builtins(builtins: &mut VmGlobals) {
FILE: vm-lib/src/builtins/readln.rs
type Readln (line 13) | struct Readln {}
method eval (line 15) | fn eval(
method arity (line 37) | fn arity(&self) -> crate::arity::Arity {
method name (line 41) | fn name(&self) -> &str {
function insert_builtins (line 46) | pub(super) fn insert_builtins(builtins: &mut VmGlobals) {
FILE: vm-lib/src/builtins/result.rs
function insert_result_builtins (line 10) | pub(super) fn insert_result_builtins(builtins: &mut VmGlobals) {
FILE: vm-lib/src/builtins/runtime_error.rs
constant RUNTIME_ERR_CASE_DIVISION_BY_ZERO_IDX (line 17) | pub const RUNTIME_ERR_CASE_DIVISION_BY_ZERO_IDX: usize = 0;
constant RUNTIME_ERR_CASE_ENUM_WITHOUT_PAYLOAD_IDX (line 18) | pub const RUNTIME_ERR_CASE_ENUM_WITHOUT_PAYLOAD_IDX: usize = 1;
constant RUNTIME_ERR_CASE_INDEX_OUT_OF_BOUNDS_IDX (line 19) | pub const RUNTIME_ERR_CASE_INDEX_OUT_OF_BOUNDS_IDX: usize = 2;
constant RUNTIME_ERR_CASE_MISMATCHED_ARGC_IDX (line 20) | pub const RUNTIME_ERR_CASE_MISMATCHED_ARGC_IDX: usize = 3;
constant RUNTIME_ERR_CASE_NO_SUCH_CASE_IDX (line 21) | pub const RUNTIME_ERR_CASE_NO_SUCH_CASE_IDX: usize = 4;
constant RUNTIME_ERR_CASE_NO_SUCH_IDENTIFIER_IDX (line 22) | pub const RUNTIME_ERR_CASE_NO_SUCH_IDENTIFIER_IDX: usize = 5;
constant RUNTIME_ERR_CASE_OPERATION_FAILED_IDX (line 23) | pub const RUNTIME_ERR_CASE_OPERATION_FAILED_IDX: usize = 6;
constant RUNTIME_ERR_CASE_UNEXPECTED_TYPE_IDX (line 24) | pub const RUNTIME_ERR_CASE_UNEXPECTED_TYPE_IDX: usize = 7;
function insert_runtime_error_builtins (line 26) | pub(super) fn insert_runtime_error_builtins(builtins: &mut VmGlobals) {
FILE: vm-lib/src/builtins/setenv.rs
type Setenv (line 8) | struct Setenv {}
method eval (line 10) | fn eval(
method arity (line 33) | fn arity(&self) -> crate::arity::Arity {
method name (line 37) | fn name(&self) -> &str {
function insert_builtins (line 42) | pub(super) fn insert_builtins(builtins: &mut VmGlobals) {
FILE: vm-lib/src/builtins/sleep.rs
type Sleep (line 11) | struct Sleep {}
method eval (line 13) | fn eval(
method arity (line 31) | fn arity(&self) -> crate::arity::Arity {
method name (line 35) | fn name(&self) -> &str {
function insert_builtins (line 40) | pub(super) fn insert_builtins(builtins: &mut VmGlobals) {
FILE: vm-lib/src/builtins/string.rs
type StringLen (line 17) | struct StringLen {}
method eval (line 19) | fn eval(
method attrib_byte (line 34) | fn attrib_byte(&self) -> u8 {
method arity (line 38) | fn arity(&self) -> crate::arity::Arity {
method name (line 42) | fn name(&self) -> &str {
type StringHasPrefix (line 48) | struct StringHasPrefix {}
method eval (line 50) | fn eval(
method attrib_byte (line 72) | fn attrib_byte(&self) -> u8 {
method arity (line 76) | fn arity(&self) -> crate::arity::Arity {
method name (line 80) | fn name(&self) -> &str {
type StringHasSuffix (line 86) | struct StringHasSuffix {}
method eval (line 88) | fn eval(
method attrib_byte (line 110) | fn attrib_byte(&self) -> u8 {
method arity (line 114) | fn arity(&self) -> crate::arity::Arity {
method name (line 118) | fn name(&self) -> &str {
type StringReplace (line 124) | struct StringReplace {}
method eval (line 126) | fn eval(
method attrib_byte (line 156) | fn attrib_byte(&self) -> u8 {
method arity (line 160) | fn arity(&self) -> crate::arity::Arity {
method name (line 164) | fn name(&self) -> &str {
type StringSplit (line 170) | struct StringSplit {}
method eval (line 172) | fn eval(
method attrib_byte (line 198) | fn attrib_byte(&self) -> u8 {
method arity (line 202) | fn arity(&self) -> crate::arity::Arity {
method name (line 206) | fn name(&self) -> &str {
type StringChars (line 212) | struct StringChars {}
method eval (line 214) | fn eval(
method attrib_byte (line 236) | fn attrib_byte(&self) -> u8 {
method arity (line 240) | fn arity(&self) -> crate::arity::Arity {
method name (line 244) | fn name(&self) -> &str {
type StringBytes (line 250) | struct StringBytes {}
method eval (line 252) | fn eval(
method attrib_byte (line 274) | fn attrib_byte(&self) -> u8 {
method arity (line 278) | fn arity(&self) -> crate::arity::Arity {
method name (line 282) | fn name(&self) -> &str {
type FromBytes (line 288) | struct FromBytes {}
method eval (line 290) | fn eval(
method attrib_byte (line 350) | fn attrib_byte(&self) -> u8 {
method arity (line 354) | fn arity(&self) -> crate::arity::Arity {
method name (line 358) | fn name(&self) -> &str {
type ToNumericEncoding (line 364) | struct ToNumericEncoding {}
method eval (line 366) | fn eval(
method attrib_byte (line 387) | fn attrib_byte(&self) -> u8 {
method arity (line 391) | fn arity(&self) -> crate::arity::Arity {
method name (line 395) | fn name(&self) -> &str {
type TrimHead (line 401) | struct TrimHead {}
method eval (line 403) | fn eval(
method attrib_byte (line 420) | fn attrib_byte(&self) -> u8 {
method arity (line 424) | fn arity(&self) -> crate::arity::Arity {
method name (line 428) | fn name(&self) -> &str {
type TrimTail (line 434) | struct TrimTail {}
method eval (line 436) | fn eval(
method attrib_byte (line 453) | fn attrib_byte(&self) -> u8 {
method arity (line 457) | fn arity(&self) -> crate::arity::Arity {
method name (line 461) | fn name(&self) -> &str {
type Uppercase (line 467) | struct Uppercase {}
method eval (line 469) | fn eval(
method attrib_byte (line 486) | fn attrib_byte(&self) -> u8 {
method arity (line 490) | fn arity(&self) -> crate::arity::Arity {
method name (line 494) | fn name(&self) -> &str {
type Lowercase (line 500) | struct Lowercase {}
method eval (line 502) | fn eval(
method attrib_byte (line 519) | fn attrib_byte(&self) -> u8 {
method arity (line 523) | fn arity(&self) -> crate::arity::Arity {
method name (line 527) | fn name(&self) -> &str {
type Contains (line 533) | struct Contains {}
method eval (line 535) | fn eval(
method attrib_byte (line 549) | fn attrib_byte(&self) -> u8 {
method arity (line 553) | fn arity(&self) -> crate::arity::Arity {
method name (line 557) | fn name(&self) -> &str {
type GetAt (line 563) | struct GetAt {}
method eval (line 565) | fn eval(
method attrib_byte (line 582) | fn attrib_byte(&self) -> u8 {
method arity (line 586) | fn arity(&self) -> crate::arity::Arity {
method name (line 590) | fn name(&self) -> &str {
function insert_string_builtins (line 595) | pub(super) fn insert_string_builtins(builtins: &mut VmGlobals) {
FILE: vm-lib/src/builtins/system.rs
function get_shell_path (line 12) | fn get_shell_path() -> String {
type System (line 21) | struct System {}
method eval (line 23) | fn eval(
method arity (line 61) | fn arity(&self) -> crate::arity::Arity {
method name (line 65) | fn name(&self) -> &str {
function insert_builtins (line 70) | pub(super) fn insert_builtins(builtins: &mut VmGlobals) {
FILE: vm-lib/src/builtins/typ.rs
function insert_type_builtins (line 6) | pub(super) fn insert_type_builtins(builtins: &mut VmGlobals) {
FILE: vm-lib/src/builtins/typeof_builtin.rs
type Typeof (line 10) | struct Typeof {}
method eval (line 12) | fn eval(
method arity (line 23) | fn arity(&self) -> crate::arity::Arity {
method name (line 27) | fn name(&self) -> &str {
function insert_builtins (line 32) | pub(super) fn insert_builtins(builtins: &mut VmGlobals) {
FILE: vm-lib/src/builtins/unimplemented.rs
function insert_unimplemented_builtins (line 6) | pub(super) fn insert_unimplemented_builtins(builtins: &mut VmGlobals) {
FILE: vm-lib/src/builtins/unit.rs
function insert_unit_builtins (line 9) | pub(super) fn insert_unit_builtins(builtins: &mut VmGlobals) {
FILE: vm-lib/src/builtins/writeattr.rs
type WriteAttr (line 8) | struct WriteAttr {}
method eval (line 10) | fn eval(
method arity (line 26) | fn arity(&self) -> crate::arity::Arity {
method name (line 30) | fn name(&self) -> &str {
function insert_builtins (line 35) | pub(super) fn insert_builtins(builtins: &mut VmGlobals) {
FILE: vm-lib/src/console.rs
type Console (line 2) | pub trait Console: std::any::Any {
method print (line 3) | fn print(&mut self, s: &str) -> std::io::Result<()> {
method println (line 7) | fn println(&mut self, s: &str) -> std::io::Result<()> {
method eprintln (line 11) | fn eprintln(&mut self, s: &str) -> std::io::Result<()> {
method as_any (line 16) | fn as_any(&self) -> &dyn std::any::Any;
method as_any (line 22) | fn as_any(&self) -> &dyn std::any::Any {
method print (line 34) | fn print(&mut self, s: &str) -> std::io::Result<()> {
method println (line 39) | fn println(&mut self, s: &str) -> std::io::Result<()> {
method eprintln (line 45) | fn eprintln(&mut self, s: &str) -> std::io::Result<()> {
method as_any (line 51) | fn as_any(&self) -> &dyn std::any::Any {
type StdConsole (line 20) | pub struct StdConsole;
type TestConsole (line 28) | pub struct TestConsole {
method clear (line 57) | pub fn clear(&mut self) {
function write (line 64) | fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> {
function flush (line 71) | fn flush(&mut self) -> std::io::Result<()> {
FILE: vm-lib/src/error/backtrace.rs
type Backtrace (line 6) | pub struct Backtrace {
method first_entry (line 11) | pub fn first_entry(&self) -> Option<SourcePointer> {
method entries_iter (line 15) | pub fn entries_iter(&self) -> std::slice::Iter<'_, SourcePointer> {
method push (line 19) | pub fn push(&mut self, loc: SourcePointer) {
method len (line 23) | pub fn len(&self) -> usize {
method is_empty (line 27) | pub fn is_empty(&self) -> bool {
FILE: vm-lib/src/error/dylib_load.rs
type LoadStatus (line 6) | pub enum LoadStatus {
type LoadResult (line 12) | pub struct LoadResult {
method success (line 18) | pub fn success() -> Self {
method error (line 25) | pub fn error(message: &str) -> Self {
method free (line 33) | pub(crate) fn free(self) {
method into_rust_string (line 41) | pub(crate) fn into_rust_string(self) -> String {
FILE: vm-lib/src/error/exception.rs
type VmException (line 17) | pub struct VmException {
method from_value (line 23) | pub fn from_value(value: RuntimeValue) -> Self {
method from_value_and_loc (line 30) | pub fn from_value_and_loc(value: RuntimeValue, loc: Option<SourcePoint...
method thrown_at (line 39) | pub fn thrown_at(self, loc: SourcePointer) -> Self {
method is_builtin_unimplemented (line 52) | pub fn is_builtin_unimplemented(&self, vm: &mut VirtualMachine) -> bool {
method fill_in_backtrace (line 58) | pub(crate) fn fill_in_backtrace(&self, builtins: &mut VmGlobals) {
method from_vmerror (line 78) | pub fn from_vmerror(err: VmError, builtins: &mut VmGlobals) -> Result<...
FILE: vm-lib/src/error/vm_error.rs
type SymbolKind (line 14) | pub enum SymbolKind {
method fmt (line 20) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
type VmErrorReason (line 29) | pub enum VmErrorReason {
method from (line 110) | fn from(value: DecodeError) -> Self {
type VmError (line 122) | pub struct VmError {
method prettyprint (line 130) | pub fn prettyprint(&self, module: Option<RuntimeModule>) -> String {
method fmt (line 153) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
method from (line 159) | fn from(reason: VmErrorReason) -> Self {
FILE: vm-lib/src/frame.rs
type LocalVariable (line 12) | pub struct LocalVariable {
method default (line 18) | fn default() -> Self {
type ControlBlock (line 27) | pub enum ControlBlock {
type Frame (line 31) | pub struct Frame {
method drop_to_first_try (line 41) | pub(crate) fn drop_to_first_try(&mut self, _: &mut VirtualMachine) -> ...
method new_with_function (line 55) | pub fn new_with_function(f: Function) -> Self {
method new_with_n_locals (line 62) | pub(crate) fn new_with_n_locals(n: u8) -> Self {
method set_argc (line 77) | pub(crate) fn set_argc(&mut self, argc: u8) -> &mut Self {
method set_line_table (line 82) | pub(crate) fn set_line_table(&mut self, lt: Option<&LineTable>) -> &mu...
method get_line_table (line 87) | pub(crate) fn get_line_table(&self) -> Option<&LineTable> {
method get_line_entry_at_pos (line 91) | pub fn get_line_entry_at_pos(&self, pos: u16) -> Option<SourcePointer> {
method reset_for_function (line 99) | pub(crate) fn reset_for_function(&mut self, f: &Function) {
method reset_for_pool (line 110) | pub(crate) fn reset_for_pool(mut self) -> Self {
method default (line 122) | fn default() -> Self {
FILE: vm-lib/src/lib.rs
type HaxbyEvalResult (line 22) | pub struct HaxbyEvalResult {
function haxby_eval (line 27) | pub fn haxby_eval(module: CompiledModule, options: VmOptions) -> Executi...
FILE: vm-lib/src/mixin_includer.rs
type MixinIncluder (line 12) | pub struct MixinIncluder {
method load_named_value (line 17) | pub fn load_named_value(&self, builtins: &VmGlobals, name: Symbol) -> ...
method include (line 24) | pub fn include(&mut self, mixin: Mixin) {
method contains (line 28) | pub fn contains(&self, mixin: &Mixin) -> bool {
method list_attributes (line 37) | pub fn list_attributes(&self, builtins: &VmGlobals) -> HashSet<Symbol> {
FILE: vm-lib/src/opcodes/prettyprint.rs
type RuntimeOpcodePrinter (line 9) | pub(crate) struct RuntimeOpcodePrinter<'a> {
method resolve_compile_time_constant (line 15) | fn resolve_compile_time_constant(&self, idx: u16) -> Option<String> {
method resolve_run_time_symbol (line 25) | fn resolve_run_time_symbol(&self, idx: u32) -> Option<String> {
function opcode_prettyprint (line 36) | pub(crate) fn opcode_prettyprint(
FILE: vm-lib/src/opcodes/sidecar.rs
type ReadAttributeSidecar (line 10) | pub struct ReadAttributeSidecar {
constant MAXIMUM_ALLOWED_MISSES (line 17) | pub const MAXIMUM_ALLOWED_MISSES: u8 = 16;
type NewEnumValSidecar (line 21) | pub struct NewEnumValSidecar {
constant MAXIMUM_ALLOWED_MISSES (line 35) | pub const MAXIMUM_ALLOWED_MISSES: u8 = 16;
type EnumCheckIsCaseSidecar (line 28) | pub struct EnumCheckIsCaseSidecar {
type OpcodeSidecar (line 39) | pub enum OpcodeSidecar {
type SidecarCell (line 45) | pub type SidecarCell = Cell<Option<OpcodeSidecar>>;
type SidecarSlice (line 46) | pub type SidecarSlice = [SidecarCell];
function sidecar_prettyprint (line 49) | pub(crate) fn sidecar_prettyprint(
FILE: vm-lib/src/runtime_module.rs
type NamedValue (line 20) | pub struct NamedValue {
type RuntimeModuleImpl (line 25) | struct RuntimeModuleImpl {
method new (line 151) | fn new(vm: &mut VirtualMachine, cm: CompiledModule) -> Result<Self, Vm...
method named_values_of_this (line 178) | fn named_values_of_this(&self) -> Vec<(String, NamedValue)> {
method load_named_value (line 188) | fn load_named_value(&self, name: &str) -> Option<RuntimeValue> {
method typedef_named_value (line 192) | fn typedef_named_value(&self, name: &str, ty: IsaCheckable) {
method store_typechecked_named_value (line 207) | fn store_typechecked_named_value(
method store_named_value (line 226) | fn store_named_value(&self, name: &str, val: RuntimeValue) {
method load_indexed_const (line 241) | fn load_indexed_const(&self, idx: u16) -> Option<&RuntimeValue> {
method list_named_values (line 245) | fn list_named_values(&self) -> HashSet<String> {
function byte_array_to_opcode_array (line 32) | fn byte_array_to_opcode_array(bytes: &[u8]) -> aria_compiler::bc_reader:...
function replace_attribute_access_with_interned (line 71) | fn replace_attribute_access_with_interned(
function compiled_code_object_to_runtime_code_object (line 111) | fn compiled_code_object_to_runtime_code_object(
function compiled_constant_to_runtime_value (line 132) | fn compiled_constant_to_runtime_value(
type RuntimeModule (line 251) | pub struct RuntimeModule {
method new (line 256) | pub fn new(vm: &mut VirtualMachine, cm: CompiledModule) -> Result<Self...
method load_entry_code_object (line 262) | pub fn load_entry_code_object(&self) -> &crate::runtime_value::runtime...
method named_values_of_this (line 266) | pub(crate) fn named_values_of_this(&self) -> Vec<(String, NamedValue)> {
method get_compiled_module (line 270) | pub(crate) fn get_compiled_module(&self) -> &CompiledModule {
method load_named_value (line 274) | pub fn load_named_value(&self, name: &str) -> Option<RuntimeValue> {
method typedef_named_value (line 278) | pub fn typedef_named_value(&self, name: &str, ty: IsaCheckable) {
method store_named_value (line 282) | pub fn store_named_value(&self, name: &str, val: RuntimeValue) {
method list_named_values (line 286) | pub fn list_named_values(&self) -> HashSet<String> {
method store_typechecked_named_value (line 290) | pub fn store_typechecked_named_value(
method load_indexed_const (line 299) | pub fn load_indexed_const(&self, idx: u16) -> Option<&RuntimeValue> {
method lift_all_symbols_from_other (line 303) | pub fn lift_all_symbols_from_other(
method extract_value (line 315) | pub fn extract_value<T, U>(&self, name: &str, f: T) -> Option<U>
method insert_builtin (line 322) | pub fn insert_builtin<T>(&self)
method eq (line 333) | fn eq(&self, other: &Self) -> bool {
FILE: vm-lib/src/runtime_value/boolean.rs
type BooleanValue (line 4) | pub type BooleanValue = BuiltinValue<bool>;
method eq (line 7) | fn eq(&self, other: &BooleanValue) -> bool {
type Output (line 14) | type Output = BooleanValue;
method not (line 16) | fn not(self) -> Self::Output {
type Output (line 22) | type Output = BooleanValue;
function bitxor (line 24) | fn bitxor(self, rhs: Self) -> Self::Output {
type Output (line 30) | type Output = BooleanValue;
function bitand (line 32) | fn bitand(self, rhs: Self) -> Self::Output {
type Output (line 38) | type Output = BooleanValue;
function bitor (line 40) | fn bitor(self, rhs: Self) -> Self::Output {
FILE: vm-lib/src/runtime_value/bound_function.rs
type BoundFunctionImpl (line 12) | struct BoundFunctionImpl {
type BoundFunction (line 18) | pub struct BoundFunction {
method bind (line 23) | pub(super) fn bind(this: RuntimeValue, func: Function) -> Self {
method this (line 29) | pub fn this(&self) -> &RuntimeValue {
method func (line 33) | pub fn func(&self) -> &Function {
method eval (line 37) | pub fn eval(
method eq (line 52) | fn eq(&self, other: &Self) -> bool {
FILE: vm-lib/src/runtime_value/builtin_value.rs
type BuiltinValueImpl (line 11) | pub(crate) struct BuiltinValueImpl<T>
function list_attributes (line 24) | fn list_attributes(&self, builtins: &VmGlobals) -> FxHashSet<Symbol> {
type BuiltinValue (line 30) | pub struct BuiltinValue<T>
type GetBuiltinTypeId (line 37) | trait GetBuiltinTypeId {
method get_builtin_type_id (line 38) | fn get_builtin_type_id() -> BuiltinTypeId;
method get_builtin_type_id (line 43) | fn get_builtin_type_id() -> BuiltinTypeId {
method get_builtin_type_id (line 49) | fn get_builtin_type_id() -> BuiltinTypeId {
method get_builtin_type_id (line 55) | fn get_builtin_type_id() -> BuiltinTypeId {
method get_builtin_type_id (line 61) | fn get_builtin_type_id() -> BuiltinTypeId {
function from (line 71) | fn from(val: T) -> Self {
function from (line 85) | fn from(val: T) -> Self {
function builtin_type_id (line 97) | pub fn builtin_type_id(&self) -> BuiltinTypeId {
function raw_value (line 102) | pub fn raw_value(&self) -> &T {
function list_attributes (line 106) | pub fn list_attributes(&self, builtins: &VmGlobals) -> FxHashSet<Symbol> {
FILE: vm-lib/src/runtime_value/enum_case.rs
type EnumValueImpl (line 11) | pub(super) struct EnumValueImpl {
method builtin_equals (line 41) | fn builtin_equals(&self, other: &Self, cur_frame: &mut Frame, vm: &mut...
type EnumValue (line 18) | pub struct EnumValue {
method get_container_enum (line 23) | pub fn get_container_enum(&self) -> &Enum {
method get_case_index (line 27) | pub fn get_case_index(&self) -> usize {
method get_payload (line 31) | pub fn get_payload(&self) -> Option<&RuntimeValue> {
method read (line 35) | pub fn read(&self, builtins: &VmGlobals, name: Symbol) -> Option<Runti...
method builtin_equals (line 54) | pub(super) fn builtin_equals(
FILE: vm-lib/src/runtime_value/enumeration.rs
type EnumCase (line 28) | pub struct EnumCase {
type EnumImpl (line 33) | pub struct EnumImpl {
method new (line 42) | fn new(name: &str) -> Self {
method add_case (line 52) | pub fn add_case(&self, builtins: &mut VmGlobals, case: EnumCase) -> us...
method add_cases (line 67) | pub fn add_cases(&self, builtins: &mut VmGlobals, cases: &[EnumCase]) {
method get_case_by_idx (line 73) | fn get_case_by_idx(&self, idx: usize) -> Option<EnumCase> {
method get_idx_of_case_by_symbol (line 78) | fn get_idx_of_case_by_symbol(&self, builtins: &VmGlobals, name: Symbol...
method load_named_value (line 85) | fn load_named_value(&self, builtins: &VmGlobals, name: Symbol) -> Opti...
method store_named_value (line 93) | fn store_named_value(&self, builtins: &mut VmGlobals, name: Symbol, va...
method include_mixin (line 97) | fn include_mixin(&self, mixin: &Mixin) {
method isa_mixin (line 101) | fn isa_mixin(&self, mixin: &Mixin) -> bool {
method list_attributes (line 105) | fn list_attributes(&self, builtins: &VmGlobals) -> FxHashSet<Symbol> {
method case_shape_id (line 111) | fn case_shape_id(&self) -> ShapeId {
method resolve_to_slot (line 115) | pub(super) fn resolve_to_slot(
method default (line 127) | fn default() -> Self {
type Enum (line 133) | pub struct Enum {
method new (line 138) | pub fn new(name: &str) -> Self {
method new_with_cases (line 144) | pub fn new_with_cases(name: &str, cases: &[EnumCase], builtins: &mut V...
method name (line 150) | pub fn name(&self) -> &str {
method add_case (line 154) | pub fn add_case(&self, builtins: &mut VmGlobals, case: EnumCase) -> us...
method get_idx_of_case_by_symbol (line 158) | pub fn get_idx_of_case_by_symbol(&self, builtins: &VmGlobals, name: Sy...
method get_case_by_idx (line 162) | pub fn get_case_by_idx(&self, idx: usize) -> Option<EnumCase> {
method load_named_value (line 166) | pub fn load_named_value(&self, builtins: &VmGlobals, name: Symbol) -> ...
method include_mixin (line 170) | pub fn include_mixin(&self, mixin: &Mixin) {
method isa_mixin (line 174) | pub fn isa_mixin(&self, mixin: &Mixin) -> bool {
method make_value (line 178) | pub fn make_value(&self, cidx: usize, payload: Option<RuntimeValue>) -...
method list_attributes (line 197) | pub fn list_attributes(&self, builtins: &VmGlobals) -> FxHashSet<Symbo...
method case_shape_id (line 201) | pub(crate) fn case_shape_id(&self) -> ShapeId {
method insert_builtin (line 205) | pub fn insert_builtin<T>(&self, builtins: &mut VmGlobals)
method resolve_to_slot (line 220) | pub fn resolve_to_slot(
method eq (line 230) | fn eq(&self, other: &Self) -> bool {
FILE: vm-lib/src/runtime_value/float.rs
type FloatValue (line 4) | pub type FloatValue = BuiltinValue<f64>;
method eq (line 7) | fn eq(&self, other: &IntegerValue) -> bool {
method eq (line 61) | fn eq(&self, other: &FloatValue) -> bool {
method partial_cmp (line 68) | fn partial_cmp(&self, other: &FloatValue) -> Option<std::cmp::Ordering> {
type Output (line 13) | type Output = FloatValue;
function add (line 15) | fn add(self, rhs: &FloatValue) -> Self::Output {
type Output (line 21) | type Output = FloatValue;
function sub (line 23) | fn sub(self, rhs: &FloatValue) -> Self::Output {
type Output (line 29) | type Output = FloatValue;
function mul (line 31) | fn mul(self, rhs: &FloatValue) -> Self::Output {
type Output (line 37) | type Output = FloatValue;
function div (line 39) | fn div(self, rhs: &FloatValue) -> Self::Output {
type Output (line 45) | type Output = FloatValue;
function rem (line 47) | fn rem(self, rhs: &FloatValue) -> Self::Output {
type Output (line 53) | type Output = FloatValue;
function neg (line 55) | fn neg(self) -> Self::Output {
method cmp (line 73) | fn cmp(&self, other: &Self) -> std::cmp::Ordering {
FILE: vm-lib/src/runtime_value/function.rs
type BuiltinFunctionImpl (line 25) | pub trait BuiltinFunctionImpl {
method eval (line 26) | fn eval(&self, frame: &mut Frame, vm: &mut VirtualMachine) -> Executio...
method arity (line 27) | fn arity(&self) -> Arity;
method attrib_byte (line 28) | fn attrib_byte(&self) -> u8 {
method name (line 31) | fn name(&self) -> &str;
type BuiltinFunction (line 34) | pub struct BuiltinFunction {
method new (line 40) | pub fn new(body: Rc<dyn BuiltinFunctionImpl>) -> Self {
type BytecodeFunction (line 48) | pub struct BytecodeFunction {
method store_uplevel (line 63) | pub(crate) fn store_uplevel(&self, idx: u8, val: RuntimeValue) {
method read_uplevel (line 67) | pub(crate) fn read_uplevel(&self, idx: u8) -> Option<RuntimeValue> {
type FunctionImpl (line 73) | pub(crate) enum FunctionImpl {
method attribute (line 84) | pub(crate) fn attribute(&self) -> FunctionAttribute {
method line_table (line 91) | pub(crate) fn line_table(&self) -> Option<&LineTable> {
method arity (line 98) | pub(crate) fn arity(&self) -> Arity {
method frame_size (line 105) | pub(crate) fn frame_size(&self) -> u8 {
method name (line 112) | pub(crate) fn name(&self) -> &str {
method loc (line 119) | pub(crate) fn loc(&self) -> Option<&SourcePointer> {
method get_attribute_store (line 126) | fn get_attribute_store(&self) -> &ObjectBox {
method new_builtin (line 201) | pub fn new_builtin<T>() -> Self
method builtin_from (line 208) | pub fn builtin_from<T>(val: T) -> Self
method from_code_object (line 215) | pub fn from_code_object(co: &CodeObject, m: &RuntimeModule) -> Self {
method read (line 240) | fn read(&self, builtins: &VmGlobals, name: Symbol) -> Option<RuntimeVa...
method list_attributes (line 248) | fn list_attributes(&self, builtins: &VmGlobals) -> FxHashSet<Symbol> {
type Function (line 79) | pub struct Function {
method attribute (line 135) | pub fn attribute(&self) -> FunctionAttribute {
method line_table (line 139) | pub fn line_table(&self) -> Option<&LineTable> {
method arity (line 143) | pub fn arity(&self) -> Arity {
method frame_size (line 147) | pub fn frame_size(&self) -> u8 {
method varargs (line 151) | pub fn varargs(&self) -> bool {
method name (line 155) | pub fn name(&self) -> &str {
method loc (line 159) | pub fn loc(&self) -> Option<&SourcePointer> {
method get_attribute_store (line 163) | pub(super) fn get_attribute_store(&self) -> &ObjectBox {
method new_builtin (line 269) | pub fn new_builtin<T>() -> Self
method builtin_from (line 278) | pub fn builtin_from<T>(val: T) -> Self
method from_code_object (line 287) | pub fn from_code_object(co: &CodeObject, m: &RuntimeModule) -> Self {
method read (line 293) | pub fn read(&self, builtins: &VmGlobals, name: Symbol) -> Option<Runti...
method list_attributes (line 297) | pub fn list_attributes(&self, builtins: &VmGlobals) -> FxHashSet<Symbo...
method eval_in_frame (line 302) | pub(super) fn eval_in_frame(
method eval (line 317) | pub fn eval(
method fmt (line 429) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
type FunctionAttribute (line 168) | pub struct FunctionAttribute {
method from (line 173) | fn from(val: u8) -> Self {
method is_free (line 179) | pub fn is_free(&self) -> bool {
method is_vararg (line 183) | pub fn is_vararg(&self) -> bool {
method is_method (line 187) | pub fn is_method(&self) -> bool {
method is_instance_method (line 191) | pub fn is_instance_method(&self) -> bool {
method is_type_method (line 195) | pub fn is_type_method(&self) -> bool {
type PartialFunctionApplication (line 257) | pub struct PartialFunctionApplication {
method with_suffix_arg (line 262) | pub fn with_suffix_arg(mut self, arg: RuntimeValue) -> Self {
method eq (line 407) | fn eq(&self, other: &Self) -> bool {
method eq (line 422) | fn eq(&self, other: &Self) -> bool {
FILE: vm-lib/src/runtime_value/integer.rs
type IntegerValue (line 4) | pub type IntegerValue = BuiltinValue<i64>;
method to_fp (line 7) | pub fn to_fp(&self) -> FloatValue {
method eq (line 13) | fn eq(&self, other: &FloatValue) -> bool {
method eq (line 119) | fn eq(&self, other: &IntegerValue) -> bool {
method partial_cmp (line 127) | fn partial_cmp(&self, other: &IntegerValue) -> Option<std::cmp::Orderi...
method eq (line 140) | fn eq(&self, other: &i64) -> bool {
type Output (line 19) | type Output = IntegerValue;
function add (line 22) | fn add(self, rhs: &IntegerValue) -> Self::Output {
type Output (line 28) | type Output = IntegerValue;
function sub (line 31) | fn sub(self, rhs: &IntegerValue) -> Self::Output {
type Output (line 37) | type Output = IntegerValue;
function mul (line 40) | fn mul(self, rhs: &IntegerValue) -> Self::Output {
type Output (line 46) | type Output = IntegerValue;
function div (line 49) | fn div(self, rhs: &IntegerValue) -> Self::Output {
type Output (line 55) | type Output = IntegerValue;
function rem (line 58) | fn rem(self, rhs: &IntegerValue) -> Self::Output {
type Output (line 64) | type Output = IntegerValue;
function neg (line 67) | fn neg(self) -> Self::Output {
type Output (line 73) | type Output = IntegerValue;
function bitand (line 76) | fn bitand(self, rhs: &IntegerValue) -> Self::Output {
type Output (line 82) | type Output = IntegerValue;
function bitor (line 85) | fn bitor(self, rhs: &IntegerValue) -> Self::Output {
type Output (line 91) | type Output = IntegerValue;
function bitxor (line 94) | fn bitxor(self, rhs: &IntegerValue) -> Self::Output {
type Output (line 100) | type Output = IntegerValue;
function shl (line 103) | fn shl(self, rhs: &IntegerValue) -> Self::Output {
type Output (line 109) | type Output = IntegerValue;
function shr (line 112) | fn shr(self, rhs: &IntegerValue) -> Self::Output {
method cmp (line 133) | fn cmp(&self, other: &Self) -> std::cmp::Ordering {
FILE: vm-lib/src/runtime_value/isa.rs
type IsaCheckable (line 7) | pub enum IsaCheckable {
method fmt (line 15) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
method isa (line 44) | fn isa(val: &RuntimeValue, t: &RuntimeValueType, builtins: &VmGlobals)...
method isa_mixin (line 59) | fn isa_mixin(val: &RuntimeValue, mixin: &Mixin, builtins: &VmGlobals) ...
method isa_check (line 79) | pub fn isa_check(&self, other: &RuntimeValue, builtins: &VmGlobals) ->...
method any (line 88) | pub fn any() -> Self {
type Error (line 94) | type Error = ();
method try_from (line 96) | fn try_from(value: &RuntimeValue) -> Result<Self, Self::Error> {
type Output (line 110) | type Output = IsaCheckable;
method bitor (line 112) | fn bitor(self, rhs: &IsaCheckable) -> Self::Output {
type Output (line 152) | type Output = IsaCheckable;
method bitand (line 154) | fn bitand(self, rhs: &IsaCheckable) -> Self::Output {
FILE: vm-lib/src/runtime_value/kind.rs
type FunctionType (line 15) | pub struct FunctionType {
method fmt (line 21) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
type RuntimeValueType (line 33) | pub enum RuntimeValueType {
method get_type (line 75) | pub fn get_type(value: &RuntimeValue, builtins: &VmGlobals) -> Self {
method fmt (line 103) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
method read_attribute (line 171) | pub fn read_attribute(
method get_attribute_store (line 196) | pub(super) fn get_attribute_store(&self) -> Option<&super::object::Obj...
method list_attributes (line 213) | pub fn list_attributes(&self, builtins: &VmGlobals) -> FxHashSet<Symbo...
method eq (line 49) | fn eq(&self, other: &Self) -> bool {
type Output (line 129) | type Output = RuntimeValueType;
function bitor (line 131) | fn bitor(self, rhs: &RuntimeValueType) -> Self::Output {
FILE: vm-lib/src/runtime_value/list.rs
type ListImpl (line 18) | pub(super) struct ListImpl {
method get (line 26) | fn get(&self) -> &Vec<RuntimeValue> {
method get_mut (line 32) | fn get_mut(&self) -> &mut Vec<RuntimeValue> {
method new_with_capacity (line 36) | fn new_with_capacity(cap: usize) -> Self {
method len (line 43) | fn len(&self) -> usize {
method is_empty (line 47) | fn is_empty(&self) -> bool {
method get_at (line 51) | fn get_at(&self, idx: usize) -> Option<RuntimeValue> {
method append (line 55) | fn append(&self, val: RuntimeValue) {
method pop (line 59) | fn pop(&self) {
method set_at (line 63) | fn set_at(&self, idx: usize, val: RuntimeValue) -> Result<(), VmErrorR...
method read (line 77) | fn read(&self, builtins: &VmGlobals, name: Symbol) -> Option<RuntimeVa...
method list_attributes (line 81) | fn list_attributes(&self, builtins: &VmGlobals) -> FxHashSet<Symbol> {
method fmt (line 87) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
type List (line 101) | pub struct List {
method from (line 106) | pub fn from(values: &[RuntimeValue]) -> Self {
method new_with_capacity (line 112) | pub fn new_with_capacity(cap: usize) -> Self {
method len (line 118) | pub fn len(&self) -> usize {
method is_empty (line 122) | pub fn is_empty(&self) -> bool {
method get_at (line 126) | pub fn get_at(&self, idx: usize) -> Option<RuntimeValue> {
method append (line 130) | pub fn append(&self, val: RuntimeValue) {
method pop (line 134) | pub fn pop(&self) {
method set_at (line 138) | pub fn set_at(&self, idx: usize, val: RuntimeValue) -> Result<(), VmEr...
method read_index (line 142) | pub fn read_index(
method write_index (line 158) | pub fn write_index(
method read (line 173) | pub fn read(&self, builtins: &VmGlobals, name: Symbol) -> Option<Runti...
method list_attributes (line 177) | pub fn list_attributes(&self, builtins: &VmGlobals) -> FxHashSet<Symbo...
method fmt (line 183) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
method eq (line 189) | fn eq(&self, other: &Self) -> bool {
FILE: vm-lib/src/runtime_value/mixin.rs
type MixinImpl (line 10) | pub(super) struct MixinImpl {
method new (line 17) | fn new(name: &str) -> Self {
method load_named_value (line 25) | fn load_named_value(&self, builtins: &VmGlobals, name: Symbol) -> Opti...
method named_values (line 33) | fn named_values(&self, builtins: &VmGlobals) -> Vec<Symbol> {
method include_mixin (line 37) | fn include_mixin(&self, mixin: &Mixin) {
method isa_mixin (line 41) | fn isa_mixin(&self, mixin: &Mixin) -> bool {
method list_attributes (line 45) | fn list_attributes(&self, builtins: &VmGlobals) -> FxHashSet<Symbol> {
type Mixin (line 53) | pub struct Mixin {
method new (line 58) | pub fn new(name: &str) -> Self {
method name (line 64) | pub fn name(&self) -> &str {
method load_named_value (line 68) | pub fn load_named_value(&self, builtins: &VmGlobals, name: Symbol) -> ...
method named_values (line 72) | pub fn named_values(&self, builtins: &VmGlobals) -> Vec<Symbol> {
method include_mixin (line 76) | pub fn include_mixin(&self, mixin: &Mixin) {
method isa_mixin (line 80) | pub fn isa_mixin(&self, mixin: &Mixin) -> bool {
method list_attributes (line 84) | pub fn list_attributes(&self, builtins: &VmGlobals) -> FxHashSet<Symbo...
method eq (line 90) | fn eq(&self, other: &Self) -> bool {
FILE: vm-lib/src/runtime_value/mod.rs
type RuntimeValue (line 58) | pub enum RuntimeValue {
method builtin_equals (line 77) | pub fn builtin_equals(
method is_builtin_unimplemented (line 119) | pub(crate) fn is_builtin_unimplemented(&self, vm: &mut VirtualMachine)...
method try_eval_rel_op (line 131) | fn try_eval_rel_op(
method try_eval_bin_op (line 159) | fn try_eval_bin_op(
method try_eval_unary_op (line 181) | fn try_eval_unary_op(
method equals (line 201) | pub fn equals(
method fmt (line 446) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
method fmt (line 475) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
type Error (line 484) | type Error = aria_compiler::bc_reader::DecodeError;
method try_from (line 486) | fn try_from(value: &ConstantValue) -> Result<Self, Self::Error> {
method bind (line 532) | pub fn bind(&self, f: Function) -> RuntimeValue {
method as_struct (line 536) | pub fn as_struct(&self) -> Option<&Struct> {
method as_enum (line 540) | pub fn as_enum(&self) -> Option<&Enum> {
method is_struct (line 544) | pub fn is_struct(&self) -> bool {
method is_enum (line 548) | pub fn is_enum(&self) -> bool {
method as_rust_native (line 552) | pub fn as_rust_native(&self) -> Option<&RustNativeType> {
method as_opaque_concrete (line 556) | pub fn as_opaque_concrete<T: 'static>(&self) -> Option<Rc<T>> {
method is_builtin_type (line 560) | pub fn is_builtin_type(&self) -> bool {
method get_builtin_type_id (line 577) | pub fn get_builtin_type_id(&self) -> Option<BuiltinTypeId> {
method eval (line 597) | pub fn eval(
method prettyprint (line 616) | pub fn prettyprint(&self, cur_frame: &mut Frame, vm: &mut VirtualMachi...
method get_attribute_store (line 631) | fn get_attribute_store(&self) -> Option<&object::ObjectBox> {
method write_attribute (line 651) | pub fn write_attribute(
method list_attributes (line 670) | pub fn list_attributes(&self, builtins: &VmGlobals) -> Vec<String> {
method read_slot (line 724) | pub(crate) fn read_slot(
method read_slot_from_type (line 802) | fn read_slot_from_type(
method resolve_to_slot_from_type (line 815) | fn resolve_to_slot_from_type(
method resolve_to_slot (line 830) | pub(crate) fn resolve_to_slot(
method read_attribute (line 938) | pub fn read_attribute(
method read_index (line 1022) | pub fn read_index(
method write_index (line 1039) | pub fn write_index(
type OperatorEvalAttemptOutcome (line 105) | pub(crate) enum OperatorEvalAttemptOutcome<SuccessType> {
type OperatorEvalOutcome (line 112) | pub(crate) enum OperatorEvalOutcome<SuccessType> {
type AttributeError (line 499) | pub enum AttributeError {
method to_vm_error_reason (line 506) | pub fn to_vm_error_reason(&self, name: &str) -> VmErrorReason {
type CallResult (line 529) | pub type CallResult = crate::vm::RunloopExit<RuntimeValue>;
FILE: vm-lib/src/runtime_value/object.rs
type ObjectBox (line 14) | pub struct ObjectBox {
method get (line 31) | fn get(&self) -> &Vec<RuntimeValue> {
method get_mut (line 37) | fn get_mut(&self) -> &mut Vec<RuntimeValue> {
method write (line 41) | pub fn write(
method read (line 60) | pub fn read(
method read_slot (line 69) | pub(super) fn read_slot(&self, slot_id: SlotId, sid: ShapeId) -> Optio...
method resolve_to_slot (line 76) | pub(super) fn resolve_to_slot(
method list_attributes (line 87) | pub(super) fn list_attributes(
method contains (line 105) | pub(crate) fn contains(&self, builtins: &crate::builtins::VmGlobals, n...
method default (line 20) | fn default() -> Self {
type ObjectImpl (line 115) | pub(super) struct ObjectImpl {
method new (line 126) | fn new(kind: &Struct) -> Self {
method read_slot (line 133) | fn read_slot(&self, slot_id: SlotId, sid: ShapeId) -> Option<RuntimeVa...
method resolve_to_slot (line 137) | fn resolve_to_slot(
method write (line 145) | fn write(&self, builtins: &mut crate::builtins::VmGlobals, name: Symbo...
method read (line 149) | fn read(&self, builtins: &crate::builtins::VmGlobals, name: Symbol) ->...
method list_attributes (line 153) | fn list_attributes(&self, builtins: &crate::builtins::VmGlobals) -> Fx...
type Object (line 121) | pub struct Object {
method new (line 159) | pub fn new(kind: &Struct) -> Self {
method read_slot (line 165) | pub(crate) fn read_slot(&self, slot_id: SlotId, sid: ShapeId) -> Optio...
method resolve_to_slot (line 169) | pub(crate) fn resolve_to_slot(
method read (line 177) | pub fn read(
method write (line 185) | pub fn write(
method list_attributes (line 194) | pub fn list_attributes(&self, builtins: &crate::builtins::VmGlobals) -...
method get_struct (line 198) | pub fn get_struct(&self) -> &Struct {
method with_value (line 202) | pub fn with_value(
method extract_field (line 221) | pub fn extract_field<FnType, OkType>(
method eq (line 214) | fn eq(&self, other: &Self) -> bool {
FILE: vm-lib/src/runtime_value/opaque.rs
type OpaqueValueImpl (line 5) | struct OpaqueValueImpl {
type OpaqueValue (line 10) | pub struct OpaqueValue {
method fmt (line 15) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
method fmt (line 21) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
method as_concrete_object (line 27) | pub(crate) fn as_concrete_object<T: 'static>(&self) -> Option<Rc<T>> {
method new (line 31) | pub fn new<T: 'static>(x: T) -> Self {
FILE: vm-lib/src/runtime_value/runtime_code_object.rs
type CodeObject (line 13) | pub struct CodeObject {
type Error (line 49) | type Error = aria_compiler::bc_reader::DecodeError;
method try_from (line 51) | fn try_from(value: &CompiledCodeObject) -> Result<Self, Self::Error> {
method fmt (line 69) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
method eq (line 25) | fn eq(&self, other: &Self) -> bool {
function byte_array_to_opcode_array (line 30) | fn byte_array_to_opcode_array(bytes: &[u8]) -> DecodeResult<Vec<Opcode>> {
FILE: vm-lib/src/runtime_value/rust_native_type.rs
type RustNativeValueKind (line 17) | pub enum RustNativeValueKind {
type RustNativeTypeImpl (line 26) | struct RustNativeTypeImpl {
method write (line 33) | fn write(&self, builtins: &mut VmGlobals, name: Symbol, val: RuntimeVa...
method read (line 37) | fn read(&self, builtins: &VmGlobals, name: Symbol) -> Option<RuntimeVa...
method include_mixin (line 44) | fn include_mixin(&self, mixin: &Mixin) {
method isa_mixin (line 48) | fn isa_mixin(&self, mixin: &Mixin) -> bool {
method list_attributes (line 52) | fn list_attributes(&self, builtins: &VmGlobals) -> FxHashSet<Symbol> {
type RustNativeType (line 60) | pub struct RustNativeType {
method new (line 65) | pub fn new(rvt: RustNativeValueKind) -> Self {
method get_tag (line 75) | pub fn get_tag(&self) -> &RustNativeValueKind {
method get_boxx (line 79) | pub fn get_boxx(&self) -> &Rc<ObjectBox> {
method write (line 83) | pub(crate) fn write(&self, builtins: &mut VmGlobals, name: Symbol, val...
method read (line 87) | pub fn read(&self, builtins: &VmGlobals, name: Symbol) -> Option<Runti...
method include_mixin (line 91) | pub fn include_mixin(&self, mixin: &Mixin) {
method isa_mixin (line 95) | pub fn isa_mixin(&self, mixin: &Mixin) -> bool {
method insert_builtin (line 99) | pub fn insert_builtin<T>(&self, builtins: &mut VmGlobals)
method list_attributes (line 114) | pub fn list_attributes(&self, builtins: &VmGlobals) -> FxHashSet<Symbo...
method fmt (line 127) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
method eq (line 120) | fn eq(&self, other: &Self) -> bool {
FILE: vm-lib/src/runtime_value/string.rs
type StringValue (line 7) | pub type StringValue = BuiltinValue<String>;
method from (line 10) | fn from(value: &str) -> Self {
method len (line 16) | pub fn len(&self) -> usize {
method is_empty (line 20) | pub fn is_empty(&self) -> bool {
method contains (line 24) | pub fn contains(&self, pat: &str) -> bool {
method eq (line 38) | fn eq(&self, other: &StringValue) -> bool {
method partial_cmp (line 45) | fn partial_cmp(&self, other: &StringValue) -> Option<std::cmp::Orderin...
method eq (line 56) | fn eq(&self, other: &str) -> bool {
method get_at (line 62) | pub fn get_at(&self, idx: usize) -> Option<RuntimeValue> {
method read_index (line 69) | pub fn read_index(
type Output (line 30) | type Output = StringValue;
function add (line 32) | fn add(self, rhs: &StringValue) -> Self::Output {
method cmp (line 50) | fn cmp(&self, other: &Self) -> std::cmp::Ordering {
FILE: vm-lib/src/runtime_value/structure.rs
type StructImpl (line 20) | pub(super) struct StructImpl {
method new (line 27) | fn new(name: &str) -> Self {
method isa_mixin (line 35) | fn isa_mixin(&self, mixin: &Mixin) -> bool {
method read_slot (line 39) | fn read_slot(&self, slot_id: SlotId, sid: ShapeId) -> Option<RuntimeVa...
method resolve_to_slot (line 43) | fn resolve_to_slot(
method load_named_value (line 51) | fn load_named_value(&self, builtins: &VmGlobals, name: Symbol) -> Opti...
method store_named_value (line 59) | fn store_named_value(&self, builtins: &mut VmGlobals, name: Symbol, va...
method include_mixin (line 63) | fn include_mixin(&self, mixin: &Mixin) {
method list_attributes (line 67) | fn list_attributes(&self, builtins: &VmGlobals) -> FxHashSet<Symbol> {
type Struct (line 75) | pub struct Struct {
method new (line 80) | pub fn new(name: &str) -> Self {
method name (line 86) | pub fn name(&self) -> &str {
method load_named_value (line 90) | pub fn load_named_value(&self, builtins: &VmGlobals, name: Symbol) -> ...
method include_mixin (line 94) | pub fn include_mixin(&self, mixin: &Mixin) {
method isa_mixin (line 98) | pub fn isa_mixin(&self, mixin: &Mixin) -> bool {
method list_attributes (line 102) | pub fn list_attributes(&self, builtins: &VmGlobals) -> FxHashSet<Symbo...
method read_slot (line 115) | pub(crate) fn read_slot(&self, slot_id: SlotId, sid: ShapeId) -> Optio...
method resolve_to_slot (line 119) | pub(crate) fn resolve_to_slot(
method insert_builtin (line 127) | pub fn insert_builtin<T>(&self, builtins: &mut VmGlobals)
method extract_field (line 142) | pub fn extract_field<FnType, OkType>(
method eq (line 108) | fn eq(&self, other: &Self) -> bool {
FILE: vm-lib/src/shape.rs
type ShapeId (line 7) | pub struct ShapeId(pub u32);
type SlotId (line 10) | pub struct SlotId(pub u32);
type Shape (line 12) | pub struct Shape {
method empty (line 21) | pub fn empty() -> Self {
type Shapes (line 31) | pub struct Shapes {
constant EMPTY_SHAPE_INDEX (line 44) | pub const EMPTY_SHAPE_INDEX: ShapeId = ShapeId(0);
method transition (line 46) | pub fn transition(&mut self, cur_sid: ShapeId, name: Symbol) -> (Shape...
method resolve_slot (line 82) | pub fn resolve_slot(&self, sid: ShapeId, name: Symbol) -> Option<SlotI...
method resolve_symbol (line 88) | pub fn resolve_symbol(&self, sid: ShapeId, slot_id: SlotId) -> Option<...
method get_shape (line 94) | pub(crate) fn get_shape(&self, sid: ShapeId) -> Option<&Shape> {
method default (line 36) | fn default() -> Self {
FILE: vm-lib/src/stack.rs
type Stack (line 2) | pub struct Stack<T>
method default (line 13) | fn default() -> Self {
function push (line 24) | pub fn push(&mut self, val: T) {
function peek (line 28) | pub fn peek(&mut self) -> Option<&T> {
function try_pop (line 32) | pub fn try_pop(&mut self) -> Option<T> {
function pop (line 36) | pub fn pop(&mut self) -> T {
function pop_count (line 40) | pub fn pop_count(&mut self, count: usize) -> Vec<T> {
function try_pop_if (line 53) | pub fn try_pop_if<F, U>(&mut self, f: F) -> Option<U>
function pop_if (line 63) | pub fn pop_if<F, U>(&mut self, f: F) -> Option<U>
function len (line 70) | pub fn len(&self) -> usize {
function is_empty (line 74) | pub fn is_empty(&self) -> bool {
function clear (line 78) | pub fn clear(&mut self) {
function peek_at_offset (line 82) | pub fn peek_at_offset(&mut self, i: usize) -> Option<&T> {
function contains (line 87) | pub fn contains(&self, val: &T) -> bool
function dump (line 99) | pub fn dump(&self) {
FILE: vm-lib/src/symbol.rs
type Symbol (line 6) | pub struct Symbol(pub u32);
method fmt (line 9) | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
constant INTERNED_OP_IMPL_CALL (line 14) | pub const INTERNED_OP_IMPL_CALL: Symbol = Symbol(0);
constant INTERNED_OP_IMPL_EQUALS (line 15) | pub const INTERNED_OP_IMPL_EQUALS: Symbol = Symbol(1);
constant INTERNED_OP_IMPL_READ_INDEX (line 16) | pub const INTERNED_OP_IMPL_READ_INDEX: Symbol = Symbol(2);
constant INTERNED_OP_IMPL_WRITE_INDEX (line 17) | pub const INTERNED_OP_IMPL_WRITE_INDEX: Symbol = Symbol(3);
constant INTERNED_OP_IMPL_ADD (line 18) | pub const INTERNED_OP_IMPL_ADD: Symbol = Symbol(4);
constant INTERNED_OP_IMPL_RADD (line 19) | pub const INTERNED_OP_IMPL_RADD: Symbol = Symbol(5);
constant INTERNED_OP_IMPL_SUB (line 20) | pub const INTERNED_OP_IMPL_SUB: Symbol = Symbol(6);
constant INTERNED_OP_IMPL_RSUB (line 21) | pub const INTERNED_OP_IMPL_RSUB: Symbol = Symbol(7);
constant INTERNED_OP_IMPL_MUL (line 22) | pub const INTERNED_OP_IMPL_MUL: Symbol = Symbol(8);
constant INTERNED_OP_IMPL_RMUL (line 23) | pub const INTERNED_OP_IMPL_RMUL: Symbol = Symbol(9);
constant INTERNED_OP_IMPL_DIV (line 24) | pub const INTERNED_OP_IMPL_DIV: Symbol = Symbol(10);
constant INTERNED_OP_IMPL_RDIV (line 25) | pub const INTERNED_OP_IMPL_RDIV: Symbol = Symbol(11);
constant INTERNED_OP_IMPL_REM (line 26) | pub const INTERNED_OP_IMPL_REM: Symbol = Symbol(12);
constant INTERNED_OP_IMPL_RREM (line 27) | pub const INTERNED_OP_IMPL_RREM: Symbol = Symbol(13);
constant INTERNED_OP_IMPL_LSHIFT (line 28) | pub const INTERNED_OP_IMPL_LSHIFT: Symbol = Symbol(14);
constant INTERNED_OP_IMPL_RLSHIFT (line 29) | pub const INTERNED_OP_IMPL_RLSHIFT: Symbol = Symbol(15);
constant INTERNED_OP_IMPL_RSHIFT (line 30) | pub const INTERNED_OP_IMPL_RSHIFT: Symbol = Symbol(16);
constant INTERNED_OP_IMPL_RRSHIFT (line 31) | pub const INTERNED_OP_IMPL_RRSHIFT: Symbol = Symbol(17);
constant INTERNED_OP_IMPL_BWAND (line 32) | pub const INTERNED_OP_IMPL_BWAND: Symbol = Symbol(18);
constant INTERNED_OP_IMPL_RBWAND (line 33) | pub const INTERNED_OP_IMPL_RBWAND: Symbol = Symbol(19);
constant INTERNED_OP_IMPL_BWOR (line 34) | pub const INTERNED_OP_IMPL_BWOR: Symbol = Symbol(20);
constant INTERNED_OP_IMPL_RBWOR (line 35) | pub const INTERNED_OP_IMPL_RBWOR: Symbol = Symbol(21);
constant INTERNED_OP_IMPL_XOR (line 36) | pub const INTERNED_OP_IMPL_XOR: Symbol = Symbol(22);
constant INTERNED_OP_IMPL_RXOR (line 37) | pub const INTERNED_OP_IMPL_RXOR: Symbol = Symbol(23);
constant INTERNED_OP_IMPL_LT (line 38) | pub const INTERNED_OP_IMPL_LT: Symbol = Symbol(24);
constant INTERNED_OP_IMPL_GT (line 39) | pub const INTERNED_OP_IMPL_GT: Symbol = Symbol(25);
constant INTERNED_OP_IMPL_LTEQ (line 40) | pub const INTERNED_OP_IMPL_LTEQ: Symbol = Symbol(26);
constant INTERNED_OP_IMPL_GTEQ (line 41) | pub const INTERNED_OP_IMPL_GTEQ: Symbol = Symbol(27);
constant INTERNED_OP_IMPL_NEG (line 42) | pub const INTERNED_OP_IMPL_NEG: Symbol = Symbol(28);
constant INTERNED_OP_PRETTYPRINT (line 43) | pub const INTERNED_OP_PRETTYPRINT: Symbol = Symbol(29);
constant INTERNED_ATTR_BACKTRACE (line 45) | pub const INTERNED_ATTR_BACKTRACE: Symbol = Symbol(30);
constant INTERNED_ATTR_IMPL (line 46) | pub const INTERNED_ATTR_IMPL: Symbol = Symbol(31);
constant INTERNED_ATTR_NEXT (line 47) | pub const INTERNED_ATTR_NEXT: Symbol = Symbol(32);
constant INTERNED_ATTR_MSG (line 48) | pub const INTERNED_ATTR_MSG: Symbol = Symbol(33);
constant INTERNED_ATTR_ARGC_MISMATCH (line 49) | pub const INTERNED_ATTR_ARGC_MISMATCH: Symbol = Symbol(34);
constant INTERNED_ATTR_STDOUT (line 50) | pub const INTERNED_ATTR_STDOUT: Symbol = Symbol(35);
constant INTERNED_ATTR_STDERR (line 51) | pub const INTERNED_ATTR_STDERR: Symbol = Symbol(36);
constant INTERNED_ATTR_EXPECTED (line 52) | pub const INTERNED_ATTR_EXPECTED: Symbol = Symbol(37);
constant INTERNED_ATTR_ACTUAL (line 53) | pub const INTERNED_ATTR_ACTUAL: Symbol = Symbol(38);
constant INTERNED_CASE_VARARGS (line 55) | pub const INTERNED_CASE_VARARGS: Symbol = Symbol(39);
constant INTERNED_CASE_BOUNDED (line 56) | pub const INTERNED_CASE_BOUNDED: Symbol = Symbol(40);
type Interner (line 58) | pub struct Interner {
method intern (line 127) | pub fn intern(&mut self, s: &str) -> Result<Symbol, InternError> {
method lookup (line 145) | pub fn lookup(&self, s: &str) -> Option<Symbol> {
method resolve (line 149) | pub fn resolve(&self, sym: Symbol) -> Option<&str> {
type InternError (line 64) | pub enum InternError {
method default (line 70) | fn default() -> Self {
FILE: vm-lib/src/test.rs
function exec_code (line 13) | fn exec_code(src: &'static str) -> ExecutionResult<HaxbyEvalResult> {
function exec_code_with_vm_options (line 17) | fn exec_code_with_vm_options(
function test_assert_can_pass (line 27) | fn test_assert_can_pass() {
function test_assert_can_fail (line 39) | fn test_assert_can_fail() {
function test_toplevel_assert_can_fail (line 54) | fn test_toplevel_assert_can_fail() {
function test_circular_import_detected (line 67) | fn test_circular_import_detected() {
function test_module_val_typecheck_fails (line 84) | fn test_module_val_typecheck_fails() {
function test_err_in_op_is_caught (line 115) | fn test_err_in_op_is_caught() {
function test_err_in_rop_is_caught (line 135) | fn test_err_in_rop_is_caught() {
function test_uncaught_exception_bubbles_up (line 155) | fn test_uncaught_exception_bubbles_up() {
function test_cmdline_arguments (line 179) | fn test_cmdline_arguments() {
function test_force_unwrap_asserts (line 202) | fn test_force_unwrap_asserts() {
function test_cmdline_args_list (line 216) | fn test_cmdline_args_list() {
function test_cmdline_args_va (line 233) | fn test_cmdline_args_va() {
function test_cmdline_args_mismatch (line 250) | fn test_cmdline_args_mismatch() {
FILE: vm-lib/src/vm.rs
type ConsoleHandle (line 45) | pub type ConsoleHandle = Rc<RefCell<dyn Console>>;
type VmOptions (line 48) | pub struct VmOptions {
method default (line 58) | fn default() -> Self {
type VirtualMachine (line 70) | pub struct VirtualMachine {
method console (line 81) | pub fn console(&self) -> &ConsoleHandle {
method acquire_frame (line 85) | pub(crate) fn acquire_frame(&mut self, f: &Function) -> Frame {
method release_frame (line 91) | pub(crate) fn release_frame(&mut self, frame: Frame) {
method load_version_into_globals (line 95) | fn load_version_into_globals(mut self) -> Self {
method with_options (line 112) | pub fn with_options(options: VmOptions) -> Self {
method get_system_import_paths (line 245) | fn get_system_import_paths() -> Vec<PathBuf> {
method get_aria_library_paths (line 327) | pub fn get_aria_library_paths() -> &'static Vec<PathBuf> {
method try_get_import_path_from_name (line 352) | fn try_get_import_path_from_name(
method resolve_import_path_to_path (line 365) | fn resolve_import_path_to_path(
method create_import_model_from_path (line 401) | fn create_import_model_from_path(
method load_into_module (line 456) | pub fn load_into_module(
method load_module (line 479) | pub fn load_module(
method get_module_by_name (line 488) | pub fn get_module_by_name(&self, name: &str) -> Option<RuntimeModule> {
method find_imported_module (line 492) | pub(crate) fn find_imported_module(&self, name: &str) -> Option<Runtim...
method inject_imported_module (line 498) | pub fn inject_imported_module(&mut self, name: &str, module: RuntimeMo...
method execute_module (line 503) | pub fn execute_module(&mut self, m: &RuntimeModule) -> ExecutionResult...
method read_named_symbol (line 546) | fn read_named_symbol(
method eval_bytecode_in_frame (line 560) | pub(crate) fn eval_bytecode_in_frame(
method run_opcode (line 570) | fn run_opcode(
method runloop (line 1975) | fn runloop(
method default (line 105) | fn default() -> Self {
type ExecutionResult (line 152) | pub type ExecutionResult<T = (), U = VmError> = Result<T, U>;
type ModuleLoadInfo (line 154) | pub struct ModuleLoadInfo {
type RunloopExit (line 158) | pub enum RunloopExit<T = ()> {
method throw_object (line 164) | pub fn throw_object(value: RuntimeValue) -> Self {
method throw_struct (line 171) | pub fn throw_struct(
type OpcodeRunExit (line 185) | enum OpcodeRunExit {
function get_lib_path (line 227) | fn get_lib_path(lib_name: &str) -> PathBuf {
function unique_insert (line 234) | fn unique_insert<T>(vec: &mut Vec<T>, item: T) -> &Vec<T>
FILE: vscode/aria/src/extension.ts
function activate (line 12) | async function activate(context: ExtensionContext) {
function deactivate (line 44) | function deactivate(): Thenable<void> | undefined {
function activateInlayHints (line 51) | function activateInlayHints(ctx: ExtensionContext) {
Condensed preview — 900 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (2,164K chars).
[
{
"path": ".github/dependabot.yml",
"chars": 527,
"preview": "# To get started with Dependabot version updates, you'll need to specify which\n# package ecosystems to update and where "
},
{
"path": ".github/workflows/clippy.yml",
"chars": 2091,
"preview": "name: Run Clippy on PR\n\non:\n repository_dispatch:\n types: [clippy-command]\n\npermissions:\n contents: write\n pull-re"
},
{
"path": ".github/workflows/fmt.yml",
"chars": 1584,
"preview": "name: Check PR Formatting with cargo fmt\n\non:\n repository_dispatch:\n types: [fmt-command]\n\npermissions:\n contents: "
},
{
"path": ".github/workflows/linux_build_test.yml",
"chars": 406,
"preview": "name: LinuxBuildAndTest\npermissions:\n contents: read\n\non:\n push:\n branches: [ \"master\" ]\n pull_request:\n branch"
},
{
"path": ".github/workflows/macos_build_test.yml",
"chars": 405,
"preview": "name: MacOSBuildAndTest\npermissions:\n contents: read\n\non:\n push:\n branches: [ \"master\" ]\n pull_request:\n branch"
},
{
"path": ".github/workflows/release.yml",
"chars": 902,
"preview": "permissions:\n contents: write\nname: release\non:\n push:\n tags: [\"v*.*.*\"]\n\njobs:\n build:\n strategy:\n matrix"
},
{
"path": ".github/workflows/slash_clippy.yml",
"chars": 671,
"preview": "name: SlashClippy\n\non:\n issue_comment:\n types: [created]\n\npermissions:\n contents: write\n issues: write\n pull-requ"
},
{
"path": ".github/workflows/slash_fmt.yml",
"chars": 814,
"preview": "name: SlashFmt\n\non:\n issue_comment:\n types: [created]\n\n# Needed:\n# - issues: write → add 👍 reaction\n# - contents: w"
},
{
"path": ".gitignore",
"chars": 224,
"preview": "# Rust & Cargo\n/target\n\n# Profilers\ncallgrind.out.*\nperf.*\n\n# IDEs and Editors\n.vscode/\n.idea/\n*.swp\n*.swo\n\n# NPM\nnode_m"
},
{
"path": ".pre-commit-config.yaml",
"chars": 644,
"preview": "repos:\n- repo: https://github.com/doublify/pre-commit-rust\n rev: v1.0\n hooks:\n - id: fmt\n - id: cargo-"
},
{
"path": "CHANGELOG.md",
"chars": 2592,
"preview": "# Changelog\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Change"
},
{
"path": "CODEOWNERS",
"chars": 361,
"preview": "# Failsafe, if nobody else can pick up a review, I can\n* @egranata\n\n# List more specific code owners here\n.github/wor"
},
{
"path": "Cargo.toml",
"chars": 318,
"preview": "[workspace]\nmembers = [\n \"aria-bin\",\n \"compiler-lib\",\n \"lsp\",\n \"native-libs/*\",\n \"opcodes-lib\",\n \"pars"
},
{
"path": "Dockerfile",
"chars": 1951,
"preview": "# syntax=docker/dockerfile:1\n# This Docker container installs Aria from prebuilt binaries on Ubuntu 24.04.\n# It can be u"
},
{
"path": "LICENSE",
"chars": 11344,
"preview": "\n Apache License\n Version 2.0, January 2004\n "
},
{
"path": "README.md",
"chars": 5765,
"preview": "# Aria: A Fresh, Safe, and Flexible Language for High-Level Development\n[ {\n if x > 0 {\n throw \"x is positive "
},
{
"path": "aria-bin/src/error_reporting_test/util.aria",
"chars": 76,
"preview": "# SPDX-License-Identifier: Apache-2.0\nfunc foo(f, n) {\n return f(3,n);\n}\n"
},
{
"path": "aria-bin/src/file_eval.rs",
"chars": 4342,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse aria_compiler::{CompilationOptions, compile_from_ast};\nuse aria_parser::ast::"
},
{
"path": "aria-bin/src/main.rs",
"chars": 3003,
"preview": "// SPDX-License-Identifier: Apache-2.0\nmod error_reporting;\nmod file_eval;\nmod repl_eval;\n\n#[cfg(test)]\nmod test;\n\nuse c"
},
{
"path": "aria-bin/src/repl_eval.rs",
"chars": 11957,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse std::ops::DerefMut;\n\nuse aria_compiler::{CompilationOptions, compile_from_ast"
},
{
"path": "aria-bin/src/repl_preamble.aria",
"chars": 374,
"preview": "# SPDX-License-Identifier: Apache-2.0\nimport File from aria.io.file;\nimport Path from aria.io.path;\nimport Request from "
},
{
"path": "aria-bin/src/test.rs",
"chars": 8340,
"preview": "// SPDX-License-Identifier: Apache-2.0\n\nuse std::{cell::RefCell, rc::Rc};\n\nuse haxby_vm::console::TestConsole;\n\nuse crat"
},
{
"path": "aria-bin/test_assert.aria",
"chars": 106,
"preview": "# SPDX-License-Identifier: Apache-2.0\nfunc foo() {\n assert false;\n}\n\nfunc main() {\n return foo();\n}\n"
},
{
"path": "aria-bin/test_uncaught_exception.aria",
"chars": 106,
"preview": "# SPDX-License-Identifier: Apache-2.0\nfunc foo() {\n return 3 / 0;\n}\n\nfunc main() {\n return foo();\n}\n"
},
{
"path": "b",
"chars": 2275,
"preview": "#!/usr/bin/env bash\nset -e\n\nprint_usage() {\n echo \"Usage: $0 <command> <bench>\"\n echo \"command: bench, micro, perf"
},
{
"path": "ci_tests.sh",
"chars": 116,
"preview": "#!/usr/bin/env bash\nset -e\n\nSELF_DIR=\"$(dirname \"$(readlink -f \"${BASH_SOURCE[0]}\")\")\"\n\n${SELF_DIR}/t --sequential\n"
},
{
"path": "compiler-lib/Cargo.toml",
"chars": 326,
"preview": "[package]\nname = \"compiler-lib\"\nversion = \"0.9.20251222\"\nedition = \"2024\"\n\n[lib]\nname = \"aria_compiler\"\npath = \"src/lib."
},
{
"path": "compiler-lib/src/bc_reader.rs",
"chars": 15603,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse haxby_opcodes::{BuiltinTypeId, BuiltinValueId, Opcode};\n\npub struct BytecodeR"
},
{
"path": "compiler-lib/src/bc_writer.rs",
"chars": 8758,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse haxby_opcodes::Opcode;\n\n#[derive(Default)]\npub(crate) struct BytecodeWriter {"
},
{
"path": "compiler-lib/src/builder/block.rs",
"chars": 11820,
"preview": "// SPDX-License-Identifier: Apache-2.0\n\nuse std::{cell::RefCell, collections::HashSet, rc::Rc};\n\nuse aria_parser::ast::S"
},
{
"path": "compiler-lib/src/builder/compiler_opcodes.rs",
"chars": 14462,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse enum_as_inner::EnumAsInner;\nuse haxby_opcodes::{\n BuiltinTypeId, BuiltinVa"
},
{
"path": "compiler-lib/src/builder/func.rs",
"chars": 6364,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse std::collections::HashSet;\n\nuse crate::{\n CompilationOptions,\n bc_write"
},
{
"path": "compiler-lib/src/builder/mod.rs",
"chars": 94,
"preview": "// SPDX-License-Identifier: Apache-2.0\npub mod block;\npub mod compiler_opcodes;\npub mod func;\n"
},
{
"path": "compiler-lib/src/constant_value.rs",
"chars": 2957,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse std::collections::HashMap;\n\nuse aria_parser::ast::SourcePointer;\nuse enum_as_"
},
{
"path": "compiler-lib/src/do_compile/mod.rs",
"chars": 28962,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse std::{collections::HashSet, fmt::Display, path::PathBuf};\n\nuse aria_parser::a"
},
{
"path": "compiler-lib/src/do_compile/nodes/add_operation.rs",
"chars": 865,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse crate::{\n builder::compiler_opcodes::CompilerOpcode,\n do_compile::{Comp"
},
{
"path": "compiler-lib/src/do_compile/nodes/assert_statement.rs",
"chars": 868,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse aria_parser::ast::prettyprint::{PrettyPrintable, printout_accumulator::Printo"
},
{
"path": "compiler-lib/src/do_compile/nodes/assign_statement.rs",
"chars": 2346,
"preview": "// SPDX-License-Identifier: Apache-2.0\n\nuse aria_parser::ast::{\n DeclarationId, Expression, Identifier, IntLiteral, P"
},
{
"path": "compiler-lib/src/do_compile/nodes/break_statement.rs",
"chars": 893,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse crate::{\n builder::compiler_opcodes::CompilerOpcode,\n do_compile::{\n "
},
{
"path": "compiler-lib/src/do_compile/nodes/code_block.rs",
"chars": 634,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse crate::do_compile::{CompilationResult, CompileNode, CompileParams};\n\nimpl<'a>"
},
{
"path": "compiler-lib/src/do_compile/nodes/comp_operation.rs",
"chars": 1266,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse crate::{\n builder::compiler_opcodes::CompilerOpcode,\n do_compile::{Comp"
},
{
"path": "compiler-lib/src/do_compile/nodes/continue_statement.rs",
"chars": 905,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse crate::{\n builder::compiler_opcodes::CompilerOpcode,\n do_compile::{\n "
},
{
"path": "compiler-lib/src/do_compile/nodes/enum_case_decl.rs",
"chars": 1168,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse haxby_opcodes::enum_case_attribs::CASE_HAS_PAYLOAD;\n\nuse crate::{\n builder"
},
{
"path": "compiler-lib/src/do_compile/nodes/enum_decl.rs",
"chars": 866,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse crate::{\n builder::compiler_opcodes::CompilerOpcode,\n do_compile::{Comp"
},
{
"path": "compiler-lib/src/do_compile/nodes/expression.rs",
"chars": 548,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse crate::do_compile::{CompilationResult, CompileNode, CompileParams};\n\nimpl<'a>"
},
{
"path": "compiler-lib/src/do_compile/nodes/expression_list.rs",
"chars": 400,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse crate::do_compile::{CompilationResult, CompileNode, CompileParams};\n\nimpl<'a>"
},
{
"path": "compiler-lib/src/do_compile/nodes/expression_statement.rs",
"chars": 629,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse crate::do_compile::{CompilationResult, CompileNode, CompileParams};\n\nimpl<'a>"
},
{
"path": "compiler-lib/src/do_compile/nodes/extension_decl.rs",
"chars": 982,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse crate::do_compile::{\n CompilationResult, CompileNode, CompileParams, Mixin"
},
{
"path": "compiler-lib/src/do_compile/nodes/float_literal.rs",
"chars": 1024,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse crate::{\n builder::compiler_opcodes::CompilerOpcode,\n constant_value::C"
},
{
"path": "compiler-lib/src/do_compile/nodes/for_statement.rs",
"chars": 8077,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse aria_parser::ast::{\n AssignStatement, BreakStatement, CodeBlock, Declarati"
},
{
"path": "compiler-lib/src/do_compile/nodes/function_body.rs",
"chars": 298,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse crate::do_compile::{CompilationResult, CompileNode, CompileParams};\n\nimpl<'a>"
},
{
"path": "compiler-lib/src/do_compile/nodes/function_decl.rs",
"chars": 3046,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse haxby_opcodes::function_attribs::FUNC_ACCEPTS_VARARG;\n\nuse crate::{\n build"
},
{
"path": "compiler-lib/src/do_compile/nodes/identifier.rs",
"chars": 462,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse crate::do_compile::{CompilationResult, CompileNode, CompileParams};\n\nimpl<'a>"
},
{
"path": "compiler-lib/src/do_compile/nodes/if_statement.rs",
"chars": 4197,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse crate::{\n builder::compiler_opcodes::CompilerOpcode,\n do_compile::{Comp"
},
{
"path": "compiler-lib/src/do_compile/nodes/import_from_statement.rs",
"chars": 2623,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse haxby_opcodes::BuiltinValueId;\n\nuse crate::{\n builder::compiler_opcodes::C"
},
{
"path": "compiler-lib/src/do_compile/nodes/import_statement.rs",
"chars": 703,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse crate::{\n builder::compiler_opcodes::CompilerOpcode,\n constant_value::C"
},
{
"path": "compiler-lib/src/do_compile/nodes/int_literal.rs",
"chars": 2596,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse crate::{\n builder::compiler_opcodes::CompilerOpcode,\n constant_value::C"
},
{
"path": "compiler-lib/src/do_compile/nodes/lambda.rs",
"chars": 1276,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse aria_parser::ast::{FunctionBody, FunctionDecl, Identifier};\n\nuse crate::do_co"
},
{
"path": "compiler-lib/src/do_compile/nodes/list_literal.rs",
"chars": 1013,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse crate::{\n builder::compiler_opcodes::CompilerOpcode,\n do_compile::{\n "
},
{
"path": "compiler-lib/src/do_compile/nodes/logical_operation.rs",
"chars": 4928,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse crate::{\n builder::compiler_opcodes::CompilerOpcode,\n do_compile::{Comp"
},
{
"path": "compiler-lib/src/do_compile/nodes/match_pattern.rs",
"chars": 484,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse crate::do_compile::{CompilationResult, CompileNode, CompileParams};\n\nimpl<'a>"
},
{
"path": "compiler-lib/src/do_compile/nodes/match_pattern_comp.rs",
"chars": 1251,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse crate::{\n builder::compiler_opcodes::CompilerOpcode,\n do_compile::{Comp"
},
{
"path": "compiler-lib/src/do_compile/nodes/match_pattern_enum_case.rs",
"chars": 4176,
"preview": "// SPDX-License-Identifier: Apache-2.0\n\nuse aria_parser::ast::SourcePointer;\n\nuse crate::{\n builder::compiler_opcodes"
},
{
"path": "compiler-lib/src/do_compile/nodes/match_pattern_rel.rs",
"chars": 1520,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse crate::{\n builder::compiler_opcodes::CompilerOpcode,\n do_compile::{Comp"
},
{
"path": "compiler-lib/src/do_compile/nodes/match_statement.rs",
"chars": 3640,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse crate::{\n builder::compiler_opcodes::CompilerOpcode,\n do_compile::{Comp"
},
{
"path": "compiler-lib/src/do_compile/nodes/method_decl.rs",
"chars": 3020,
"preview": "// SPDX-License-Identifier: Apache-2.0\n\nuse aria_parser::ast::{DeclarationId, Identifier};\nuse haxby_opcodes::function_a"
},
{
"path": "compiler-lib/src/do_compile/nodes/mixin_decl.rs",
"chars": 1052,
"preview": "// SPDX-License-Identifier: Apache-2.0\n\nuse aria_parser::ast::StringLiteral;\n\nuse crate::{\n builder::compiler_opcodes"
},
{
"path": "compiler-lib/src/do_compile/nodes/mod.rs",
"chars": 1085,
"preview": "// SPDX-License-Identifier: Apache-2.0\nmod add_operation;\nmod assert_statement;\nmod assign_statement;\nmod break_statemen"
},
{
"path": "compiler-lib/src/do_compile/nodes/mul_operation.rs",
"chars": 950,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse crate::{\n builder::compiler_opcodes::CompilerOpcode,\n do_compile::{Comp"
},
{
"path": "compiler-lib/src/do_compile/nodes/paren_expression.rs",
"chars": 302,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse crate::do_compile::{CompilationResult, CompileNode, CompileParams};\n\nimpl<'a>"
},
{
"path": "compiler-lib/src/do_compile/nodes/parsed_module.rs",
"chars": 6713,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse aria_parser::ast::{ImportFromStatement, ImportPath, ParsedModule};\nuse haxby_"
},
{
"path": "compiler-lib/src/do_compile/nodes/postfix_rvalue.rs",
"chars": 363,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse crate::do_compile::{CompilationResult, CompileNode, CompileParams, postfix::P"
},
{
"path": "compiler-lib/src/do_compile/nodes/primary.rs",
"chars": 652,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse crate::do_compile::{CompilationResult, CompileNode, CompileParams};\n\nimpl<'a>"
},
{
"path": "compiler-lib/src/do_compile/nodes/rel_operation.rs",
"chars": 1137,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse crate::{\n builder::compiler_opcodes::CompilerOpcode,\n do_compile::{Comp"
},
{
"path": "compiler-lib/src/do_compile/nodes/return_statement.rs",
"chars": 663,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse crate::{\n builder::compiler_opcodes::CompilerOpcode,\n do_compile::{Comp"
},
{
"path": "compiler-lib/src/do_compile/nodes/shift_operation.rs",
"chars": 895,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse crate::{\n builder::compiler_opcodes::CompilerOpcode,\n do_compile::{Comp"
},
{
"path": "compiler-lib/src/do_compile/nodes/statement.rs",
"chars": 1780,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse crate::do_compile::{CompilationResult, CompileNode, CompileParams};\n\nimpl<'a>"
},
{
"path": "compiler-lib/src/do_compile/nodes/string_literal.rs",
"chars": 691,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse crate::{\n builder::compiler_opcodes::CompilerOpcode,\n constant_value::C"
},
{
"path": "compiler-lib/src/do_compile/nodes/struct_decl.rs",
"chars": 540,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse crate::do_compile::{CompilationResult, CompileNode, CompileParams, do_struct_"
},
{
"path": "compiler-lib/src/do_compile/nodes/ternary_expression.rs",
"chars": 1534,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse crate::{\n builder::compiler_opcodes::CompilerOpcode,\n do_compile::{Comp"
},
{
"path": "compiler-lib/src/do_compile/nodes/throw_statement.rs",
"chars": 524,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse crate::{\n builder::compiler_opcodes::CompilerOpcode,\n do_compile::{Comp"
},
{
"path": "compiler-lib/src/do_compile/nodes/try_block.rs",
"chars": 2577,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse crate::{\n builder::compiler_opcodes::CompilerOpcode,\n do_compile::{Comp"
},
{
"path": "compiler-lib/src/do_compile/nodes/try_unwrap_expression.rs",
"chars": 2617,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse aria_parser::ast::TryUnwrapExpression;\nuse haxby_opcodes::BuiltinTypeId;\n\nuse"
},
{
"path": "compiler-lib/src/do_compile/nodes/unary_operation.rs",
"chars": 841,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse crate::{\n builder::compiler_opcodes::CompilerOpcode,\n do_compile::{Comp"
},
{
"path": "compiler-lib/src/do_compile/nodes/val_decl_entry.rs",
"chars": 1554,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse haxby_opcodes::BuiltinTypeId;\n\nuse crate::{\n builder::compiler_opcodes::Co"
},
{
"path": "compiler-lib/src/do_compile/nodes/val_decl_statement.rs",
"chars": 362,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse crate::do_compile::{CompilationResult, CompileNode, CompileParams};\n\nimpl<'a>"
},
{
"path": "compiler-lib/src/do_compile/nodes/while_statement.rs",
"chars": 3619,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse crate::{\n builder::compiler_opcodes::CompilerOpcode,\n do_compile::{Comp"
},
{
"path": "compiler-lib/src/do_compile/nodes/write_opeq_statement.rs",
"chars": 5497,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse aria_parser::ast::{\n AddOperation, AddSymbol, AssignStatement, CompOperati"
},
{
"path": "compiler-lib/src/do_compile/postfix.rs",
"chars": 14459,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse aria_parser::ast::{Expression, ExpressionList, Identifier, SourcePointer};\nus"
},
{
"path": "compiler-lib/src/dump/mod.rs",
"chars": 3576,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse aria_parser::ast::prettyprint::{PrettyPrintable, printout_accumulator::Printo"
},
{
"path": "compiler-lib/src/dump/opcodes.rs",
"chars": 6351,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse aria_parser::ast::prettyprint::printout_accumulator::PrintoutAccumulator;\nuse"
},
{
"path": "compiler-lib/src/lib.rs",
"chars": 986,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse aria_parser::ast::{ParsedModule, SourceBuffer};\nuse do_compile::{CompilationE"
},
{
"path": "compiler-lib/src/line_table.rs",
"chars": 703,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse std::{cell::RefCell, collections::HashMap, rc::Rc};\n\nuse aria_parser::ast::So"
},
{
"path": "compiler-lib/src/module.rs",
"chars": 863,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse std::path::PathBuf;\n\nuse crate::constant_value::{CompiledCodeObject, Constant"
},
{
"path": "compiler-lib/src/scope.rs",
"chars": 18106,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse std::{cell::RefCell, collections::HashMap, rc::Rc};\n\nuse aria_parser::ast::So"
},
{
"path": "docker/release/Dockerfile",
"chars": 1580,
"preview": "# syntax=docker/dockerfile:1\nFROM ubuntu:24.04\n\n# Build arguments for Aria version and build timestamp\n# To build with a"
},
{
"path": "docs/index.html",
"chars": 436,
"preview": "<!DOCTYPE html>\n<html>\n\n<head>\n <meta http-equiv=\"refresh\" content=\"0; url=https://arialang.github.io/\">\n <link re"
},
{
"path": "examples/99bottles.aria",
"chars": 944,
"preview": "# SPDX-License-Identifier: Apache-2.0\nstruct Lyrics {\n type func new(n: Int) {\n assert n > 0;\n return a"
},
{
"path": "examples/add_license_marker.aria",
"chars": 1915,
"preview": "# SPDX-License-Identifier: Apache-2.0\nimport File from aria.io.file;\nimport Path from aria.io.path;\nimport aria.iterator"
},
{
"path": "examples/advent_of_code_2024_day1.aria",
"chars": 385,
"preview": "# SPDX-License-Identifier: Apache-2.0\n\nimport Zip from aria.iterator.zip;\n\nval list1 = [3,4,2,1,3,3];\nval list2 = [4,3,5"
},
{
"path": "examples/advent_of_code_2024_day2.aria",
"chars": 1832,
"preview": "# SPDX-License-Identifier: Apache-2.0\nimport Set from aria.structures.set;\nimport Range from aria.range.range;\n\nenum Dir"
},
{
"path": "examples/advent_of_code_2024_day3.aria",
"chars": 784,
"preview": "# SPDX-License-Identifier: Apache-2.0\nimport Regex from aria.string.regex;\n\nfunc find_all_mul_matches(str) {\n val r ="
},
{
"path": "examples/command_line_args.aria",
"chars": 119,
"preview": "# SPDX-License-Identifier: Apache-2.0\n\nfor arg in cmdline_arguments() {\n println(\"argument = '{0}'\".format(arg));\n}\n"
},
{
"path": "examples/currency.aria",
"chars": 2082,
"preview": "# SPDX-License-Identifier: Apache-2.0\nimport Request from aria.network.request;\nimport JsonValue from aria.json.parser;\n"
},
{
"path": "examples/dir.aria",
"chars": 2435,
"preview": "# SPDX-License-Identifier: Apache-2.0\nimport Instant from aria.date.instant;\nimport Path from aria.io.path;\n\nfunc pad(n)"
},
{
"path": "examples/fibonacci.aria",
"chars": 225,
"preview": "# SPDX-License-Identifier: Apache-2.0\nfunc fibonacci(n) {\n if n == 0 {\n return 0;\n } elsif n == 1 {\n "
},
{
"path": "examples/fibonacci_memoized.aria",
"chars": 591,
"preview": "# SPDX-License-Identifier: Apache-2.0\nimport Map from aria.structures.map;\n\nstruct Fibonacci {\n type func new() {\n "
},
{
"path": "examples/fizzbuzz.aria",
"chars": 627,
"preview": "# SPDX-License-Identifier: Apache-2.0\nimport Range from aria.range.range;\n\nextension Int {\n func is_divisible_by(n: I"
},
{
"path": "examples/github_user.aria",
"chars": 648,
"preview": "# SPDX-License-Identifier: Apache-2.0\n\nimport Request from aria.network.request;\nimport JsonValue from aria.json.parser;"
},
{
"path": "examples/hello.aria",
"chars": 64,
"preview": "# SPDX-License-Identifier: Apache-2.0\n\nprintln('Hello World!');\n"
},
{
"path": "examples/parser.aria",
"chars": 7743,
"preview": "# SPDX-License-Identifier: Apache-2.0\nimport Map from aria.structures.map;\nimport aria.string.classes;\n\nenum Token {\n "
},
{
"path": "examples/peano.aria",
"chars": 703,
"preview": "# SPDX-License-Identifier: Apache-2.0\n\nenum Peano {\n case Zero,\n case Succ(Peano),\n}\n\nextension Peano {\n func p"
},
{
"path": "examples/pi.aria",
"chars": 401,
"preview": "# SPDX-License-Identifier: Apache-2.0\nfunc calc_pi() {\n val lasts = 0;\n val t = 3.0f;\n val s = 3;\n val n = 1"
},
{
"path": "examples/sieve.aria",
"chars": 2453,
"preview": "# SPDX-License-Identifier: Apache-2.0\n\n# Based on https://github.com/PlummersSoftwareLLC/Primes/blob/drag-race/PrimeWren"
},
{
"path": "examples/string_escapes.aria",
"chars": 722,
"preview": "# SPDX-License-Identifier: Apache-2.0\nimport Color, ColorScheme from aria.system.coloring;\n\nprintln(\"Hello {0}, this is "
},
{
"path": "lib/aria/core/arity.aria",
"chars": 1226,
"preview": "# SPDX-License-Identifier: Apache-2.0\nflag: no_std;\n\nstruct Arity {\n enum UpperBound {\n case Bounded(Int),\n "
},
{
"path": "lib/aria/core/bool.aria",
"chars": 131,
"preview": "# SPDX-License-Identifier: Apache-2.0\nflag: no_std;\n\nextension Bool {\n func hash() {\n return this ? 4093 : 787"
},
{
"path": "lib/aria/core/box.aria",
"chars": 109,
"preview": "# SPDX-License-Identifier: Apache-2.0\nflag: no_std;\n\nfunc Box() {\n struct Box {}\n return alloc(Box);\n}\n"
},
{
"path": "lib/aria/core/builtin.aria",
"chars": 412,
"preview": "# SPDX-License-Identifier: Apache-2.0\nflag: no_std;\n\nimport aria.core.runtime_error;\n\nimport aria.core.arity;\n\nimport ar"
},
{
"path": "lib/aria/core/float.aria",
"chars": 4025,
"preview": "# SPDX-License-Identifier: Apache-2.0\nflag: no_std;\n\nfunc char_to_int(c: String) {\n match c {\n == \"0\" => { ret"
},
{
"path": "lib/aria/core/int.aria",
"chars": 3149,
"preview": "# SPDX-License-Identifier: Apache-2.0\nflag: no_std;\n\nextension Int {\n func hash() {\n return this;\n }\n\n f"
},
{
"path": "lib/aria/core/list.aria",
"chars": 3832,
"preview": "# SPDX-License-Identifier: Apache-2.0\nflag: no_std;\n\nimport Box from aria.core.box;\n\nextension List {\n func repeat(n:"
},
{
"path": "lib/aria/core/maybe.aria",
"chars": 1222,
"preview": "# SPDX-License-Identifier: Apache-2.0\nflag: no_std;\n\nextension Maybe {\n func apply(f) {\n match this {\n "
},
{
"path": "lib/aria/core/nothing.aria",
"chars": 69,
"preview": "# SPDX-License-Identifier: Apache-2.0\nflag: no_std;\n\nenum Nothing {}\n"
},
{
"path": "lib/aria/core/result.aria",
"chars": 3390,
"preview": "# SPDX-License-Identifier: Apache-2.0\nflag: no_std;\n\nfunc ok(v) { return Result::Ok(v); }\nfunc err(e) { return Result::"
},
{
"path": "lib/aria/core/runtime_error.aria",
"chars": 3554,
"preview": "# SPDX-License-Identifier: Apache-2.0\nflag: no_std;\n\nextension RuntimeError.ArgcMismatch {\n func prettyprint() = \"arg"
},
{
"path": "lib/aria/core/string.aria",
"chars": 6400,
"preview": "# SPDX-License-Identifier: Apache-2.0\nflag: no_std;\n\n# this is conceptually the same as what's in aria.string.classes\n# "
},
{
"path": "lib/aria/core/unimplemented.aria",
"chars": 170,
"preview": "# SPDX-License-Identifier: Apache-2.0\nflag: no_std;\n\nextension Unimplemented {\n func prettyprint() = \"unimplemented\";"
},
{
"path": "lib/aria/core/unit.aria",
"chars": 315,
"preview": "# SPDX-License-Identifier: Apache-2.0\nflag: no_std;\n\nextension Unit {\n type func new() = Unit::unit;\n\n func pretty"
},
{
"path": "lib/aria/date/instant.aria",
"chars": 6613,
"preview": "# SPDX-License-Identifier: Apache-2.0\nimport Range from aria.range.range;\nimport tz_info from aria.date.timezone;\nimport"
},
{
"path": "lib/aria/date/timezone.aria",
"chars": 73,
"preview": "# SPDX-License-Identifier: Apache-2.0\nflag: uses_dylib(\"aria_timezone\");\n"
},
{
"path": "lib/aria/io/file.aria",
"chars": 3845,
"preview": "# SPDX-License-Identifier: Apache-2.0\nflag: uses_dylib(\"aria_file\");\n\nimport guard from aria.utils.guard;\nimport aria.io"
},
{
"path": "lib/aria/io/path.aria",
"chars": 2278,
"preview": "# SPDX-License-Identifier: Apache-2.0\nflag: uses_dylib(\"aria_path\");\nimport aria.date.instant;\nimport Iterator from aria"
},
{
"path": "lib/aria/iterator/enumerate.aria",
"chars": 743,
"preview": "# SPDX-License-Identifier: Apache-2.0\nstruct Enumerate {\n type func new(iter) {\n if hasattr(iter, \"iterator\") "
},
{
"path": "lib/aria/iterator/mixin.aria",
"chars": 5460,
"preview": "# SPDX-License-Identifier: Apache-2.0\nimport ok, err from aria.core.result;\n\nstruct FilteringIterator {\n type func ne"
},
{
"path": "lib/aria/iterator/zip.aria",
"chars": 579,
"preview": "# SPDX-License-Identifier: Apache-2.0\nimport aria.iterator.mixin;\n\nfunc iter_or_self(i) {\n return hasattr(i, \"iterato"
},
{
"path": "lib/aria/json/parser.aria",
"chars": 5418,
"preview": "# SPDX-License-Identifier: Apache-2.0\n\nimport Map from aria.structures.map;\nimport aria.string.classes;\nimport JsonValue"
},
{
"path": "lib/aria/json/value.aria",
"chars": 1979,
"preview": "# SPDX-License-Identifier: Apache-2.0\n\nimport aria.structures.map;\n\nstruct JsonNull {}\n\nenum JsonValue {\n case Object"
},
{
"path": "lib/aria/json/writer.aria",
"chars": 3763,
"preview": "# SPDX-License-Identifier: Apache-2.0\n\nimport Map from aria.structures.map;\nimport JsonValue from aria.json.value;\nimpor"
},
{
"path": "lib/aria/network/request.aria",
"chars": 2069,
"preview": "# SPDX-License-Identifier: Apache-2.0\nflag: uses_dylib(\"aria_http\");\n\nimport Map from aria.structures.map;\nimport JsonVa"
},
{
"path": "lib/aria/network/retry.aria",
"chars": 1931,
"preview": "# SPDX-License-Identifier: Apache-2.0\nenum RetryResult {\n case Pass(Any),\n case Fail(Maybe), # last value if any\n "
},
{
"path": "lib/aria/numerics/complex.aria",
"chars": 3666,
"preview": "# SPDX-License-Identifier: Apache-2.0\nstruct Complex {\n type func new(r: Int|Float, i: Int|Float = 0) {\n retur"
},
{
"path": "lib/aria/numerics/decimal.aria",
"chars": 7731,
"preview": "# SPDX-License-Identifier: Apache-2.0\nimport CompareResult, TotalOrdering from aria.ordering.compare;\nimport aria.numeri"
},
{
"path": "lib/aria/numerics/float/exp.aria",
"chars": 2872,
"preview": "# SPDX-License-Identifier: Apache-2.0\nextension Float {\n func ln() {\n if this <= 0 {\n throw Float.D"
},
{
"path": "lib/aria/numerics/float/trig.aria",
"chars": 2421,
"preview": "# SPDX-License-Identifier: Apache-2.0\nextension Float {\n func sin() {\n val τ = Float.π*2;\n val ε = 0.00"
},
{
"path": "lib/aria/numerics/int/pow.aria",
"chars": 536,
"preview": "# SPDX-License-Identifier: Apache-2.0\nextension Int {\n func pow(y: Int) {\n if y < 0 {\n throw Int.Do"
},
{
"path": "lib/aria/numerics/matrix.aria",
"chars": 6621,
"preview": "# SPDX-License-Identifier: Apache-2.0\nimport CompareResult, TotalOrdering from aria.ordering.compare;\nimport Map from ar"
},
{
"path": "lib/aria/ordering/compare.aria",
"chars": 1391,
"preview": "# SPDX-License-Identifier: Apache-2.0\nenum CompareResult {\n case lt,\n case eq,\n case gt,\n}\n\nmixin TotalOrdering"
},
{
"path": "lib/aria/ordering/utils.aria",
"chars": 1262,
"preview": "# SPDX-License-Identifier: Apache-2.0\nimport CompareResult from aria.ordering.compare;\n\nfunc min(l: List) {\n val min "
},
{
"path": "lib/aria/range/int_extension.aria",
"chars": 242,
"preview": "# SPDX-License-Identifier: Apache-2.0\nimport Range from aria.range.range;\n\nextension Int {\n func to(n: Int) {\n "
},
{
"path": "lib/aria/range/range.aria",
"chars": 3082,
"preview": "# SPDX-License-Identifier: Apache-2.0\nimport Iterator,Iterable from aria.iterator.mixin;\n\nstruct InvalidRangeError {\n "
},
{
"path": "lib/aria/rng/mixin.aria",
"chars": 534,
"preview": "# SPDX-License-Identifier: Apache-2.0\nmixin RngRange {\n # assume the Rng has instance func next()\n\n func in_range("
},
{
"path": "lib/aria/rng/msws.aria",
"chars": 509,
"preview": "# SPDX-License-Identifier: Apache-2.0\nimport aria.rng.mixin;\n\nstruct MiddleSquareRng {\n type func new() {\n ret"
},
{
"path": "lib/aria/rng/xorshift.aria",
"chars": 438,
"preview": "# SPDX-License-Identifier: Apache-2.0\nimport aria.rng.mixin;\n\nstruct XorshiftRng {\n type func new() {\n return "
},
{
"path": "lib/aria/string/classes.aria",
"chars": 242,
"preview": "# SPDX-License-Identifier: Apache-2.0\nflag: uses_dylib(\"aria_unicode\");\n\nextension String {\n func is_letter() = this."
},
{
"path": "lib/aria/string/regex.aria",
"chars": 548,
"preview": "# SPDX-License-Identifier: Apache-2.0\nflag: uses_dylib(\"aria_regex\");\n\nstruct Regex {\n struct Match {\n func pr"
},
{
"path": "lib/aria/structures/hash/algo/sip.aria",
"chars": 2715,
"preview": "# SPDX-License-Identifier: Apache-2.0\nfunc rotl64(x,r) = ((x << r) | (x >> (64 - r)));\n\nfunc load_le_u64(p) = p[0]\n |"
},
{
"path": "lib/aria/structures/hash/list.aria",
"chars": 379,
"preview": "# SPDX-License-Identifier: Apache-2.0\nimport SipHasher from aria.structures.hash.algo.sip;\n\nextension List {\n func ha"
},
{
"path": "lib/aria/structures/map.aria",
"chars": 6023,
"preview": "# SPDX-License-Identifier: Apache-2.0\nimport Iterator,Iterable from aria.iterator.mixin;\n\nstruct Map {\n type val DEFA"
},
{
"path": "lib/aria/structures/queue.aria",
"chars": 1805,
"preview": "# SPDX-License-Identifier: Apache-2.0\nstruct PriorityQueue {\n type func new() = This.new_with_comparator(|x,y| => x <"
},
{
"path": "lib/aria/structures/set.aria",
"chars": 1498,
"preview": "# SPDX-License-Identifier: Apache-2.0\nimport Map from aria.structures.map;\n\nstruct Set {\n type func new() = alloc(Thi"
},
{
"path": "lib/aria/structures/stack.aria",
"chars": 986,
"preview": "# SPDX-License-Identifier: Apache-2.0\n\nstruct Stack {\n type func new() = alloc(This) {\n .store = [],\n ."
},
{
"path": "lib/aria/system/coloring.aria",
"chars": 8396,
"preview": "# SPDX-License-Identifier: Apache-2.0\nenum Color {\n case Black,\n case Red,\n case Green,\n case Yellow,\n ca"
},
{
"path": "lib/aria/system/platform.aria",
"chars": 1756,
"preview": "# SPDX-License-Identifier: Apache-2.0\nflag: uses_dylib(\"aria_platform\");\n\nenum Platform {\n struct LinuxPlatform {\n "
},
{
"path": "lib/aria/test/test.aria",
"chars": 3415,
"preview": "# SPDX-License-Identifier: Apache-2.0\nenum TestResult {\n case Pass,\n case Fail(String)\n}\n\nextension TestResult {\n "
},
{
"path": "lib/aria/utils/guard.aria",
"chars": 1127,
"preview": "# SPDX-License-Identifier: Apache-2.0\nimport ok,err from aria.core.result;\n\nfunc guard(x) = GuardImpl.new(x);\n\nstruct Gu"
},
{
"path": "lib-test/README.md",
"chars": 189,
"preview": "# lib/test\n\nlib/test contains modules to test Aria's import subsystem\n\nThese modules should not be used in production Ar"
},
{
"path": "lib-test/all/source.aria",
"chars": 358,
"preview": "# SPDX-License-Identifier: Apache-2.0\nfunc something(x,y) {\n return x + y - 1;\n}\n\nfunc something_else(x,y,z) {\n re"
},
{
"path": "lib-test/attributes/things.aria",
"chars": 235,
"preview": "# SPDX-License-Identifier: Apache-2.0\nfunc foo(x,y) {\n return x + y;\n}\n\nstruct Bar {\n type func new() {\n re"
},
{
"path": "lib-test/base_module/nested_module/content.aria",
"chars": 98,
"preview": "# SPDX-License-Identifier: Apache-2.0\nstruct Foo {\n func answer() {\n return 42;\n }\n}\n"
},
{
"path": "lib-test/circular/one.aria",
"chars": 59,
"preview": "# SPDX-License-Identifier: Apache-2.0\nimport circular.two;\n"
},
{
"path": "lib-test/circular/two.aria",
"chars": 60,
"preview": "# SPDX-License-Identifier: Apache-2.0\nimport circular.zero;\n"
},
{
"path": "lib-test/circular/zero.aria",
"chars": 59,
"preview": "# SPDX-License-Identifier: Apache-2.0\nimport circular.one;\n"
},
{
"path": "lib-test/cool_widget/buzz.aria",
"chars": 123,
"preview": "# SPDX-License-Identifier: Apache-2.0\nstruct Buzz {\n func prettyprint() {\n return \"Buzz is 25 years old\";\n "
},
{
"path": "lib-test/cool_widget/lib.aria",
"chars": 550,
"preview": "# SPDX-License-Identifier: Apache-2.0\nimport Buzz from widget.buzz;\nimport A from other_widget.a;\nimport B from other_wi"
},
{
"path": "lib-test/cool_widget/widget.json",
"chars": 3,
"preview": "{}\n"
},
{
"path": "lib-test/example/pair/Pair.aria",
"chars": 383,
"preview": "# SPDX-License-Identifier: Apache-2.0\nstruct Pair {\n type func new(x,y) {\n return alloc(This){\n .x "
},
{
"path": "lib-test/example/two/things.aria",
"chars": 366,
"preview": "# SPDX-License-Identifier: Apache-2.0\nstruct One {\n type func new(x) {\n return alloc(This) {\n .x = "
},
{
"path": "lib-test/exported_var/source.aria",
"chars": 128,
"preview": "# SPDX-License-Identifier: Apache-2.0\nval foo = 123;\n\nfunc change_foo(x) {\n foo = x;\n}\n\nfunc fetch_foo() {\n return"
},
{
"path": "lib-test/ext/string.aria",
"chars": 121,
"preview": "# SPDX-License-Identifier: Apache-2.0\nextension String {\n func test_method() {\n return this.len() + 1;\n }\n}"
},
{
"path": "lib-test/extensible/base.aria",
"chars": 230,
"preview": "# SPDX-License-Identifier: Apache-2.0\nstruct Base {\n type func new(x,y) {\n return alloc(This){\n .x "
},
{
"path": "lib-test/extensible/ext.aria",
"chars": 440,
"preview": "# SPDX-License-Identifier: Apache-2.0\nimport extensible.base;\nimport Base from extensible.base;\n\nextension extensible.ba"
},
{
"path": "lib-test/multiple/module.aria",
"chars": 111,
"preview": "# SPDX-License-Identifier: Apache-2.0\nfunc one(x,y) {\n return x + y;\n}\n\nfunc two(x,y) {\n return x * y;\n}\n"
},
{
"path": "lib-test/other_widget/a.aria",
"chars": 356,
"preview": "# SPDX-License-Identifier: Apache-2.0\nimport InnerB from widget.mod.b;\n\nstruct A {\n type func new() {\n return "
},
{
"path": "lib-test/other_widget/mod/b.aria",
"chars": 112,
"preview": "# SPDX-License-Identifier: Apache-2.0\nstruct InnerB {\n func prettyprint() {\n return \"InnerB\";\n }\n}"
},
{
"path": "lib-test/other_widget/widget.json",
"chars": 3,
"preview": "{}\n"
},
{
"path": "lib-test/same_root/part1/file1.aria",
"chars": 223,
"preview": "# SPDX-License-Identifier: Apache-2.0\nimport same_root.part1.file2;\n\nstruct Foo {\n include same_root.part1.file2.Some"
},
{
"path": "lib-test/same_root/part1/file2.aria",
"chars": 116,
"preview": "# SPDX-License-Identifier: Apache-2.0\nmixin Something {\n func answer() {\n return 42 + this.value;\n }\n}\n"
},
{
"path": "lib-test/same_root/part1/file3.aria",
"chars": 227,
"preview": "# SPDX-License-Identifier: Apache-2.0\nimport same_root.part1.file2;\n\nstruct MeFirst {\n include same_root.part1.file2."
},
{
"path": "lib-test/test_things.aria",
"chars": 121,
"preview": "# SPDX-License-Identifier: Apache-2.0\nval x = 1;\n\nfunc foo(x,y) {\n return x + y;\n}\n\nfunc bar(y) {\n return x + y;\n}"
},
{
"path": "lib-test/with_err/error.aria",
"chars": 53,
"preview": "# SPDX-License-Identifier: Apache-2.0\nstruct 123 {};\n"
},
{
"path": "lsp/Cargo.toml",
"chars": 271,
"preview": "[package]\nname = \"lsp\"\nversion = \"0.1.0\"\nedition = \"2024\"\n\n[dependencies]\nlogos = \"0.16.1\"\nrowan = \"0.16.1\"\nline-index ="
},
{
"path": "lsp/src/document.rs",
"chars": 7608,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse std::collections::HashMap;\nuse std::sync::Arc;\n\nuse crate::parser::{self, Par"
},
{
"path": "lsp/src/lexer.rs",
"chars": 13653,
"preview": "// SPDX-License-Identifier: Apache-2.0\nuse logos::Logos;\n\n#[derive(Logos, Debug, Clone, PartialEq, Hash, Eq, PartialOrd,"
}
]
// ... and 700 more files (download for full content)
About this extraction
This page contains the full source code of the egranata/aria GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 900 files (1.9 MB), approximately 549.1k tokens, and a symbol index with 2072 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.