From 36cfcd0c4020841c433564706cc119ae36817eb2 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 9 Apr 2026 19:11:03 +0000 Subject: [PATCH] feat: migrate file extension from .as to .affine for GitHub Linguist recognition The .as extension conflicts with ActionScript in GitHub Linguist, causing all AffineScript source files to be misclassified as ActionScript/JavaScript. This migration to .affine resolves the conflict and enables proper language detection. Changes: - Rename all 153 .as source files to .affine across conformance/, examples/, stdlib/, test/, and tests/ directories - Add linguist-language=AffineScript directive to .gitattributes for .affine - Update tree-sitter grammar file-types from "as" to "affine" - Update VSCode extension to register .affine instead of .as - Update all documentation references (28+ files) to use .affine - Update test fixture references in test_e2e.ml https://claude.ai/code/session_015S2ndRbwuJPpjkv54BpVDw --- .gitattributes | 3 + .machine_readable/6a2/STATE.a2ml | 2 +- ALPHA-1-RELEASE-NOTES.md | 8 +- COMPILER-CAPABILITIES.md | 2 +- FIXES_2026-01-23.md | 8 +- MODULE-SYSTEM-PROGRESS.md | 26 +++--- PHASE3-ASSESSMENT.md | 36 ++++---- PHASE3-COMPLETE.md | 28 +++--- PHASE3-SESSION-SUMMARY.md | 48 +++++----- README.adoc | 12 +-- SESSION-2026-01-23.md | 6 +- SESSION-COMPLETE.md | 42 ++++----- TRAIT_SYSTEM_STATUS.md | 4 +- ...sed_brace.as => 001_unclosed_brace.affine} | 0 ...d_string.as => 002_unclosed_string.affine} | 0 ...03_bad_number.as => 003_bad_number.affine} | 0 ...d_token.as => 004_unexpected_token.affine} | 0 ...sing_arrow.as => 005_missing_arrow.affine} | 0 ...ad_operator.as => 006_bad_operator.affine} | 0 ...effect.as => 007_incomplete_effect.affine} | 0 ...parens.as => 008_mismatched_parens.affine} | 0 ...keyword.as => 009_reserved_keyword.affine} | 0 ..._empty_match.as => 010_empty_match.affine} | 0 ...11_bad_escape.as => 011_bad_escape.affine} | 0 ...ing_comma.as => 012_trailing_comma.affine} | 0 .../valid/{001_empty.as => 001_empty.affine} | 0 .../{002_comments.as => 002_comments.affine} | 0 ...et_bindings.as => 003_let_bindings.affine} | 0 .../{004_literals.as => 004_literals.affine} | 0 ...{005_functions.as => 005_functions.affine} | 0 ...06_type_alias.as => 006_type_alias.affine} | 0 ...07_struct_def.as => 007_struct_def.affine} | 0 .../{008_enum_def.as => 008_enum_def.affine} | 0 ...09_effect_def.as => 009_effect_def.affine} | 0 ...tern_match.as => 010_pattern_match.affine} | 0 .../valid/{011_rows.as => 011_rows.affine} | 0 ...{012_ownership.as => 012_ownership.affine} | 0 docs/ALIB-INTEGRATION.md | 26 +++--- docs/TYPECHECKER-COMPLETION.md | 4 +- docs/alib/README.md | 8 +- docs/guides/TESTING-REPORT.adoc | 10 +- docs/guides/TESTING-REPORT.scm | 20 ++-- docs/guides/lessons/README.md | 4 +- docs/spec.md | 18 ++-- docs/standards/RELEASE.md | 20 ++-- docs/tutorial/lesson-10-building.md | 14 +-- editors/tree-sitter-affinescript/package.json | 2 +- editors/vscode/package.json | 2 +- editors/vscode/src/extension.ts | 4 +- ...sive_test.as => comprehensive_test.affine} | 0 ...endent_types.as => dependent_types.affine} | 0 examples/{effects.as => effects.affine} | 0 ...xception_test.as => exception_test.affine} | 0 examples/{hello.as => hello.affine} | 0 .../lessons/{01_hello.as => 01_hello.affine} | 0 examples/{ownership.as => ownership.affine} | 0 .../{refinements.as => refinements.affine} | 0 examples/{rows.as => rows.affine} | 0 .../{simple_test.as => simple_test.affine} | 0 examples/{traits.as => traits.affine} | 0 ...test.as => typecheck_complete_test.affine} | 0 ...test.as => typecheck_features_test.affine} | 0 examples/{vectors.as => vectors.affine} | 0 lib/json_output.ml | 4 +- lib/module_loader.ml | 14 +-- stdlib/{Core.as => Core.affine} | 0 stdlib/{Math.as => Math.affine} | 0 stdlib/{Option.as => Option.affine} | 0 stdlib/README.md | 8 +- stdlib/{Result.as => Result.affine} | 0 stdlib/{collections.as => collections.affine} | 0 stdlib/{effects.as => effects.affine} | 0 stdlib/{io.as => io.affine} | 0 stdlib/{math.as => math.affine} | 0 stdlib/{option.as => option.affine} | 0 stdlib/{prelude.as => prelude.affine} | 0 stdlib/{result.as => result.affine} | 0 stdlib/{string.as => string.affine} | 0 stdlib/{testing.as => testing.affine} | 0 stdlib/{traits.as => traits.affine} | 0 .../{affine_basic.as => affine_basic.affine} | 0 ...e_violation.as => affine_violation.affine} | 0 .../{arithmetic.as => arithmetic.affine} | 0 ...endent_types.as => dependent_types.affine} | 0 .../fixtures/{effects.as => effects.affine} | 0 ...d_violation.as => erased_violation.affine} | 0 ...{full_pipeline.as => full_pipeline.affine} | 0 ...{interp_simple.as => interp_simple.affine} | 0 .../{julia_simple.as => julia_simple.affine} | 0 .../e2e/fixtures/{lambda.as => lambda.affine} | 0 .../{ownership.as => ownership.affine} | 0 ...{pattern_match.as => pattern_match.affine} | 0 ...ement_types.as => refinement_types.affine} | 0 ...olymorphism.as => row_polymorphism.affine} | 0 .../e2e/fixtures/{traits.as => traits.affine} | 0 .../{type_decls.as => type_decls.affine} | 0 .../{wasm_simple.as => wasm_simple.affine} | 0 .../{binary_ops.as => binary_ops.affine} | 0 test/golden/{effects.as => effects.affine} | 0 .../golden/{functions.as => functions.affine} | 0 test/golden/{hello.as => hello.affine} | 0 test/golden/{imports.as => imports.affine} | 0 test/golden/{lambda.as => lambda.affine} | 0 test/golden/{literals.as => literals.affine} | 0 .../golden/{ownership.as => ownership.affine} | 0 test/golden/{patterns.as => patterns.affine} | 0 test/golden/{rows.as => rows.affine} | 0 test/golden/{traits.as => traits.affine} | 0 test/golden/{types.as => types.affine} | 0 test/test_e2e.ml | 90 +++++++++--------- test/test_golden.ml | 8 +- test_if.as => test_if.affine | 0 test_min.as => test_min.affine | 0 test_simple.as => test_simple.affine | 0 test_spread.as => test_spread.affine | 0 test_spread2.as => test_spread2.affine | 0 test_spread3.as => test_spread3.affine | 0 tests/borrow/{minimal.as => minimal.affine} | 0 .../borrow/{move_test.as => move_test.affine} | 0 tests/borrow/{simple.as => simple.affine} | 0 ...e_move_test.as => simple_move_test.affine} | 0 .../{simple_own.as => simple_own.affine} | 0 ....as => test_immutable_assign_error.affine} | 0 .../borrow/{test_move.as => test_move.affine} | 0 ...fter_use.as => test_move_after_use.affine} | 0 ...e_borrow.as => test_mutable_borrow.affine} | 0 ...t_ref_borrow.as => test_ref_borrow.affine} | 0 ...se_after_move.as => use_after_move.affine} | 0 .../{valid_move.as => valid_move.affine} | 0 ...arithmetic.as => simple_arithmetic.affine} | 0 ...ray_bounds.as => test_array_bounds.affine} | 0 ...array_empty.as => test_array_empty.affine} | 0 ...ray_simple.as => test_array_simple.affine} | 0 ...ray_single.as => test_array_single.affine} | 0 ...est_array_sum.as => test_array_sum.affine} | 0 ...ompound.as => test_assign_compound.affine} | 0 ...gn_simple.as => test_assign_simple.affine} | 0 ...capture.as => test_closure_capture.affine} | 0 ...ure_debug.as => test_closure_debug.affine} | 0 ...e.as => test_closure_multi_capture.affine} | 0 ...um_pattern.as => test_enum_pattern.affine} | 0 ...{test_for_loop.as => test_for_loop.affine} | 0 ...tion_call.as => test_function_call.affine} | 0 ...lambda_call.as => test_lambda_call.affine} | 0 ...aram.as => test_lambda_multi_param.affine} | 0 ...h_literal.as => test_match_literal.affine} | 0 ...match_mixed.as => test_match_mixed.affine} | 0 ...tch_simple.as => test_match_simple.affine} | 0 ...le_calls.as => test_multiple_calls.affine} | 0 ...ambdas.as => test_multiple_lambdas.affine} | 0 ..._fold.as => test_opt_constant_fold.affine} | 0 ...opt_if_fold.as => test_opt_if_fold.affine} | 0 ...t_pattern_as.as => test_pattern_as.affine} | 0 ...t_pattern_or.as => test_pattern_or.affine} | 0 ...n_record.as => test_pattern_record.affine} | 0 ...ern_tuple.as => test_pattern_tuple.affine} | 0 ...ield.as => test_record_multi_field.affine} | 0 ...ultiple.as => test_record_multiple.affine} | 0 ...rd_simple.as => test_record_simple.affine} | 0 ...ive_call.as => test_recursive_call.affine} | 0 ...f_chain.as => test_ref_deref_chain.affine} | 0 ...simple.as => test_ref_deref_simple.affine} | 0 ...le_lambda.as => test_simple_lambda.affine} | 0 ...string_diff.as => test_string_diff.affine} | 0 ...est_string_eq.as => test_string_eq.affine} | 0 ...ring_multi.as => test_string_multi.affine} | 0 ...t_string_ptr.as => test_string_ptr.affine} | 0 ...ng_simple.as => test_string_simple.affine} | 0 ...t_tuple_five.as => test_tuple_five.affine} | 0 ...ple_nested.as => test_tuple_nested.affine} | 0 ...t_tuple_pair.as => test_tuple_pair.affine} | 0 ...rray.as => test_tuple_record_array.affine} | 0 ...ple_simple.as => test_tuple_simple.affine} | 0 ...t_as_int.as => test_variant_as_int.affine} | 0 ...h_arg.as => test_variant_match_arg.affine} | 0 ...none.as => test_variant_match_none.affine} | 0 ...i_arg.as => test_variant_multi_arg.affine} | 0 ...th_arg.as => test_variant_with_arg.affine} | 0 ...t_while_loop.as => test_while_loop.affine} | 0 tests/conformance/README.md | 18 ++-- .../arithmetic/{add.as => add.affine} | 0 .../arithmetic/{divide.as => divide.affine} | 0 .../arithmetic/{modulo.as => modulo.affine} | 0 .../{multiply.as => multiply.affine} | 0 .../{subtract.as => subtract.affine} | 0 .../{contains.as => contains.affine} | 0 .../collection/{filter.as => filter.affine} | 0 .../collection/{fold.as => fold.affine} | 0 .../collection/{map.as => map.affine} | 0 .../comparison/{equal.as => equal.affine} | 0 ...{greater_equal.as => greater_equal.affine} | 0 .../{greater_than.as => greater_than.affine} | 0 .../{less_equal.as => less_equal.affine} | 0 .../{less_than.as => less_than.affine} | 0 .../{not_equal.as => not_equal.affine} | 0 .../{if_then_else.as => if_then_else.affine} | 0 .../logical/{and.as => and.affine} | 0 .../logical/{not.as => not.affine} | 0 .../conformance/logical/{or.as => or.affine} | 0 .../{run_all.as => run_all.affine} | 0 .../string/{concat.as => concat.affine} | 0 .../string/{length.as => length.affine} | 0 .../string/{substring.as => substring.affine} | 0 .../{basic_effect.as => basic_effect.affine} | 0 .../{test_const.as => test_const.affine} | 0 .../{test_import.as => test_import.affine} | 0 ...import_only.as => test_import_only.affine} | 0 ...unctions.as => test_math_functions.affine} | 0 ...est_no_import.as => test_no_import.affine} | 0 ...le_import.as => test_simple_import.affine} | 0 ...aseline_block.as => baseline_block.affine} | 0 ...{baseline_stmt.as => baseline_stmt.affine} | 0 .../{unsafe_all.as => unsafe_all.affine} | 0 .../{unsafe_empty.as => unsafe_empty.affine} | 0 .../{unsafe_ops.as => unsafe_ops.affine} | 0 .../{unsafe_read.as => unsafe_read.affine} | 0 ...{unsafe_simple.as => unsafe_simple.affine} | 0 .../{unsafe_stmt.as => unsafe_stmt.affine} | 0 ...ndent_e2e.as => test_dependent_e2e.affine} | 0 ...rsing.as => test_dependent_parsing.affine} | 0 ...erence.as => test_effect_inference.affine} | 0 ...ct_lambda.as => test_effect_lambda.affine} | 0 ...ism.as => test_effect_polymorphism.affine} | 0 ...ing.as => test_generic_programming.affine} | 0 ...hkt_parsing.as => test_hkt_parsing.affine} | 0 ..._checking.as => test_kind_checking.affine} | 0 ...pe_fix.as => test_lambda_scope_fix.affine} | 0 ...ple.as => test_lambda_scope_simple.affine} | 0 ...row_type.as => test_parse_row_type.affine} | 0 ...rphism.as => test_row_polymorphism.affine} | 0 ...t_row_simple.as => test_row_simple.affine} | 0 .../{test_traits.as => test_traits.affine} | 0 tools/affinescript-lsp/src/handlers.rs | 12 +-- tools/affinescript-lsp/src/main.rs | 2 +- tools/alib_conformance_gen.jl | 2 +- tools/run_codegen_wasm_tests.sh | 4 +- wiki/compiler/architecture.md | 2 +- wiki/language-reference/dependent-types.md | 2 +- wiki/language-reference/lexical.md | 6 +- wiki/language-reference/modules.md | 68 +++++++------- wiki/stdlib/overview.md | 92 +++++++++---------- wiki/testing/guide.md | 24 ++--- wiki/tooling/cli.md | 52 +++++------ wiki/tooling/repl.md | 8 +- wiki/tutorials/quickstart.md | 4 +- 245 files changed, 390 insertions(+), 387 deletions(-) rename conformance/invalid/{001_unclosed_brace.as => 001_unclosed_brace.affine} (100%) rename conformance/invalid/{002_unclosed_string.as => 002_unclosed_string.affine} (100%) rename conformance/invalid/{003_bad_number.as => 003_bad_number.affine} (100%) rename conformance/invalid/{004_unexpected_token.as => 004_unexpected_token.affine} (100%) rename conformance/invalid/{005_missing_arrow.as => 005_missing_arrow.affine} (100%) rename conformance/invalid/{006_bad_operator.as => 006_bad_operator.affine} (100%) rename conformance/invalid/{007_incomplete_effect.as => 007_incomplete_effect.affine} (100%) rename conformance/invalid/{008_mismatched_parens.as => 008_mismatched_parens.affine} (100%) rename conformance/invalid/{009_reserved_keyword.as => 009_reserved_keyword.affine} (100%) rename conformance/invalid/{010_empty_match.as => 010_empty_match.affine} (100%) rename conformance/invalid/{011_bad_escape.as => 011_bad_escape.affine} (100%) rename conformance/invalid/{012_trailing_comma.as => 012_trailing_comma.affine} (100%) rename conformance/valid/{001_empty.as => 001_empty.affine} (100%) rename conformance/valid/{002_comments.as => 002_comments.affine} (100%) rename conformance/valid/{003_let_bindings.as => 003_let_bindings.affine} (100%) rename conformance/valid/{004_literals.as => 004_literals.affine} (100%) rename conformance/valid/{005_functions.as => 005_functions.affine} (100%) rename conformance/valid/{006_type_alias.as => 006_type_alias.affine} (100%) rename conformance/valid/{007_struct_def.as => 007_struct_def.affine} (100%) rename conformance/valid/{008_enum_def.as => 008_enum_def.affine} (100%) rename conformance/valid/{009_effect_def.as => 009_effect_def.affine} (100%) rename conformance/valid/{010_pattern_match.as => 010_pattern_match.affine} (100%) rename conformance/valid/{011_rows.as => 011_rows.affine} (100%) rename conformance/valid/{012_ownership.as => 012_ownership.affine} (100%) rename examples/{comprehensive_test.as => comprehensive_test.affine} (100%) rename examples/{dependent_types.as => dependent_types.affine} (100%) rename examples/{effects.as => effects.affine} (100%) rename examples/{exception_test.as => exception_test.affine} (100%) rename examples/{hello.as => hello.affine} (100%) rename examples/lessons/{01_hello.as => 01_hello.affine} (100%) rename examples/{ownership.as => ownership.affine} (100%) rename examples/{refinements.as => refinements.affine} (100%) rename examples/{rows.as => rows.affine} (100%) rename examples/{simple_test.as => simple_test.affine} (100%) rename examples/{traits.as => traits.affine} (100%) rename examples/{typecheck_complete_test.as => typecheck_complete_test.affine} (100%) rename examples/{typecheck_features_test.as => typecheck_features_test.affine} (100%) rename examples/{vectors.as => vectors.affine} (100%) rename stdlib/{Core.as => Core.affine} (100%) rename stdlib/{Math.as => Math.affine} (100%) rename stdlib/{Option.as => Option.affine} (100%) rename stdlib/{Result.as => Result.affine} (100%) rename stdlib/{collections.as => collections.affine} (100%) rename stdlib/{effects.as => effects.affine} (100%) rename stdlib/{io.as => io.affine} (100%) rename stdlib/{math.as => math.affine} (100%) rename stdlib/{option.as => option.affine} (100%) rename stdlib/{prelude.as => prelude.affine} (100%) rename stdlib/{result.as => result.affine} (100%) rename stdlib/{string.as => string.affine} (100%) rename stdlib/{testing.as => testing.affine} (100%) rename stdlib/{traits.as => traits.affine} (100%) rename test/e2e/fixtures/{affine_basic.as => affine_basic.affine} (100%) rename test/e2e/fixtures/{affine_violation.as => affine_violation.affine} (100%) rename test/e2e/fixtures/{arithmetic.as => arithmetic.affine} (100%) rename test/e2e/fixtures/{dependent_types.as => dependent_types.affine} (100%) rename test/e2e/fixtures/{effects.as => effects.affine} (100%) rename test/e2e/fixtures/{erased_violation.as => erased_violation.affine} (100%) rename test/e2e/fixtures/{full_pipeline.as => full_pipeline.affine} (100%) rename test/e2e/fixtures/{interp_simple.as => interp_simple.affine} (100%) rename test/e2e/fixtures/{julia_simple.as => julia_simple.affine} (100%) rename test/e2e/fixtures/{lambda.as => lambda.affine} (100%) rename test/e2e/fixtures/{ownership.as => ownership.affine} (100%) rename test/e2e/fixtures/{pattern_match.as => pattern_match.affine} (100%) rename test/e2e/fixtures/{refinement_types.as => refinement_types.affine} (100%) rename test/e2e/fixtures/{row_polymorphism.as => row_polymorphism.affine} (100%) rename test/e2e/fixtures/{traits.as => traits.affine} (100%) rename test/e2e/fixtures/{type_decls.as => type_decls.affine} (100%) rename test/e2e/fixtures/{wasm_simple.as => wasm_simple.affine} (100%) rename test/golden/{binary_ops.as => binary_ops.affine} (100%) rename test/golden/{effects.as => effects.affine} (100%) rename test/golden/{functions.as => functions.affine} (100%) rename test/golden/{hello.as => hello.affine} (100%) rename test/golden/{imports.as => imports.affine} (100%) rename test/golden/{lambda.as => lambda.affine} (100%) rename test/golden/{literals.as => literals.affine} (100%) rename test/golden/{ownership.as => ownership.affine} (100%) rename test/golden/{patterns.as => patterns.affine} (100%) rename test/golden/{rows.as => rows.affine} (100%) rename test/golden/{traits.as => traits.affine} (100%) rename test/golden/{types.as => types.affine} (100%) rename test_if.as => test_if.affine (100%) rename test_min.as => test_min.affine (100%) rename test_simple.as => test_simple.affine (100%) rename test_spread.as => test_spread.affine (100%) rename test_spread2.as => test_spread2.affine (100%) rename test_spread3.as => test_spread3.affine (100%) rename tests/borrow/{minimal.as => minimal.affine} (100%) rename tests/borrow/{move_test.as => move_test.affine} (100%) rename tests/borrow/{simple.as => simple.affine} (100%) rename tests/borrow/{simple_move_test.as => simple_move_test.affine} (100%) rename tests/borrow/{simple_own.as => simple_own.affine} (100%) rename tests/borrow/{test_immutable_assign_error.as => test_immutable_assign_error.affine} (100%) rename tests/borrow/{test_move.as => test_move.affine} (100%) rename tests/borrow/{test_move_after_use.as => test_move_after_use.affine} (100%) rename tests/borrow/{test_mutable_borrow.as => test_mutable_borrow.affine} (100%) rename tests/borrow/{test_ref_borrow.as => test_ref_borrow.affine} (100%) rename tests/borrow/{use_after_move.as => use_after_move.affine} (100%) rename tests/borrow/{valid_move.as => valid_move.affine} (100%) rename tests/codegen/{simple_arithmetic.as => simple_arithmetic.affine} (100%) rename tests/codegen/{test_array_bounds.as => test_array_bounds.affine} (100%) rename tests/codegen/{test_array_empty.as => test_array_empty.affine} (100%) rename tests/codegen/{test_array_simple.as => test_array_simple.affine} (100%) rename tests/codegen/{test_array_single.as => test_array_single.affine} (100%) rename tests/codegen/{test_array_sum.as => test_array_sum.affine} (100%) rename tests/codegen/{test_assign_compound.as => test_assign_compound.affine} (100%) rename tests/codegen/{test_assign_simple.as => test_assign_simple.affine} (100%) rename tests/codegen/{test_closure_capture.as => test_closure_capture.affine} (100%) rename tests/codegen/{test_closure_debug.as => test_closure_debug.affine} (100%) rename tests/codegen/{test_closure_multi_capture.as => test_closure_multi_capture.affine} (100%) rename tests/codegen/{test_enum_pattern.as => test_enum_pattern.affine} (100%) rename tests/codegen/{test_for_loop.as => test_for_loop.affine} (100%) rename tests/codegen/{test_function_call.as => test_function_call.affine} (100%) rename tests/codegen/{test_lambda_call.as => test_lambda_call.affine} (100%) rename tests/codegen/{test_lambda_multi_param.as => test_lambda_multi_param.affine} (100%) rename tests/codegen/{test_match_literal.as => test_match_literal.affine} (100%) rename tests/codegen/{test_match_mixed.as => test_match_mixed.affine} (100%) rename tests/codegen/{test_match_simple.as => test_match_simple.affine} (100%) rename tests/codegen/{test_multiple_calls.as => test_multiple_calls.affine} (100%) rename tests/codegen/{test_multiple_lambdas.as => test_multiple_lambdas.affine} (100%) rename tests/codegen/{test_opt_constant_fold.as => test_opt_constant_fold.affine} (100%) rename tests/codegen/{test_opt_if_fold.as => test_opt_if_fold.affine} (100%) rename tests/codegen/{test_pattern_as.as => test_pattern_as.affine} (100%) rename tests/codegen/{test_pattern_or.as => test_pattern_or.affine} (100%) rename tests/codegen/{test_pattern_record.as => test_pattern_record.affine} (100%) rename tests/codegen/{test_pattern_tuple.as => test_pattern_tuple.affine} (100%) rename tests/codegen/{test_record_multi_field.as => test_record_multi_field.affine} (100%) rename tests/codegen/{test_record_multiple.as => test_record_multiple.affine} (100%) rename tests/codegen/{test_record_simple.as => test_record_simple.affine} (100%) rename tests/codegen/{test_recursive_call.as => test_recursive_call.affine} (100%) rename tests/codegen/{test_ref_deref_chain.as => test_ref_deref_chain.affine} (100%) rename tests/codegen/{test_ref_deref_simple.as => test_ref_deref_simple.affine} (100%) rename tests/codegen/{test_simple_lambda.as => test_simple_lambda.affine} (100%) rename tests/codegen/{test_string_diff.as => test_string_diff.affine} (100%) rename tests/codegen/{test_string_eq.as => test_string_eq.affine} (100%) rename tests/codegen/{test_string_multi.as => test_string_multi.affine} (100%) rename tests/codegen/{test_string_ptr.as => test_string_ptr.affine} (100%) rename tests/codegen/{test_string_simple.as => test_string_simple.affine} (100%) rename tests/codegen/{test_tuple_five.as => test_tuple_five.affine} (100%) rename tests/codegen/{test_tuple_nested.as => test_tuple_nested.affine} (100%) rename tests/codegen/{test_tuple_pair.as => test_tuple_pair.affine} (100%) rename tests/codegen/{test_tuple_record_array.as => test_tuple_record_array.affine} (100%) rename tests/codegen/{test_tuple_simple.as => test_tuple_simple.affine} (100%) rename tests/codegen/{test_variant_as_int.as => test_variant_as_int.affine} (100%) rename tests/codegen/{test_variant_match_arg.as => test_variant_match_arg.affine} (100%) rename tests/codegen/{test_variant_match_none.as => test_variant_match_none.affine} (100%) rename tests/codegen/{test_variant_multi_arg.as => test_variant_multi_arg.affine} (100%) rename tests/codegen/{test_variant_with_arg.as => test_variant_with_arg.affine} (100%) rename tests/codegen/{test_while_loop.as => test_while_loop.affine} (100%) rename tests/conformance/arithmetic/{add.as => add.affine} (100%) rename tests/conformance/arithmetic/{divide.as => divide.affine} (100%) rename tests/conformance/arithmetic/{modulo.as => modulo.affine} (100%) rename tests/conformance/arithmetic/{multiply.as => multiply.affine} (100%) rename tests/conformance/arithmetic/{subtract.as => subtract.affine} (100%) rename tests/conformance/collection/{contains.as => contains.affine} (100%) rename tests/conformance/collection/{filter.as => filter.affine} (100%) rename tests/conformance/collection/{fold.as => fold.affine} (100%) rename tests/conformance/collection/{map.as => map.affine} (100%) rename tests/conformance/comparison/{equal.as => equal.affine} (100%) rename tests/conformance/comparison/{greater_equal.as => greater_equal.affine} (100%) rename tests/conformance/comparison/{greater_than.as => greater_than.affine} (100%) rename tests/conformance/comparison/{less_equal.as => less_equal.affine} (100%) rename tests/conformance/comparison/{less_than.as => less_than.affine} (100%) rename tests/conformance/comparison/{not_equal.as => not_equal.affine} (100%) rename tests/conformance/conditional/{if_then_else.as => if_then_else.affine} (100%) rename tests/conformance/logical/{and.as => and.affine} (100%) rename tests/conformance/logical/{not.as => not.affine} (100%) rename tests/conformance/logical/{or.as => or.affine} (100%) rename tests/conformance/{run_all.as => run_all.affine} (100%) rename tests/conformance/string/{concat.as => concat.affine} (100%) rename tests/conformance/string/{length.as => length.affine} (100%) rename tests/conformance/string/{substring.as => substring.affine} (100%) rename tests/effects/{basic_effect.as => basic_effect.affine} (100%) rename tests/modules/{test_const.as => test_const.affine} (100%) rename tests/modules/{test_import.as => test_import.affine} (100%) rename tests/modules/{test_import_only.as => test_import_only.affine} (100%) rename tests/modules/{test_math_functions.as => test_math_functions.affine} (100%) rename tests/modules/{test_no_import.as => test_no_import.affine} (100%) rename tests/modules/{test_simple_import.as => test_simple_import.affine} (100%) rename tests/parser/{baseline_block.as => baseline_block.affine} (100%) rename tests/parser/{baseline_stmt.as => baseline_stmt.affine} (100%) rename tests/parser/{unsafe_all.as => unsafe_all.affine} (100%) rename tests/parser/{unsafe_empty.as => unsafe_empty.affine} (100%) rename tests/parser/{unsafe_ops.as => unsafe_ops.affine} (100%) rename tests/parser/{unsafe_read.as => unsafe_read.affine} (100%) rename tests/parser/{unsafe_simple.as => unsafe_simple.affine} (100%) rename tests/parser/{unsafe_stmt.as => unsafe_stmt.affine} (100%) rename tests/types/{test_dependent_e2e.as => test_dependent_e2e.affine} (100%) rename tests/types/{test_dependent_parsing.as => test_dependent_parsing.affine} (100%) rename tests/types/{test_effect_inference.as => test_effect_inference.affine} (100%) rename tests/types/{test_effect_lambda.as => test_effect_lambda.affine} (100%) rename tests/types/{test_effect_polymorphism.as => test_effect_polymorphism.affine} (100%) rename tests/types/{test_generic_programming.as => test_generic_programming.affine} (100%) rename tests/types/{test_hkt_parsing.as => test_hkt_parsing.affine} (100%) rename tests/types/{test_kind_checking.as => test_kind_checking.affine} (100%) rename tests/types/{test_lambda_scope_fix.as => test_lambda_scope_fix.affine} (100%) rename tests/types/{test_lambda_scope_simple.as => test_lambda_scope_simple.affine} (100%) rename tests/types/{test_parse_row_type.as => test_parse_row_type.affine} (100%) rename tests/types/{test_row_polymorphism.as => test_row_polymorphism.affine} (100%) rename tests/types/{test_row_simple.as => test_row_simple.affine} (100%) rename tests/types/{test_traits.as => test_traits.affine} (100%) diff --git a/.gitattributes b/.gitattributes index 7bbe6d5..523fe27 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,6 +3,9 @@ * text=auto eol=lf +# AffineScript source +*.affine text eol=lf linguist-language=AffineScript + # Source *.rs text eol=lf diff=rust *.ex text eol=lf diff=elixir diff --git a/.machine_readable/6a2/STATE.a2ml b/.machine_readable/6a2/STATE.a2ml index 487f828..5f87278 100644 --- a/.machine_readable/6a2/STATE.a2ml +++ b/.machine_readable/6a2/STATE.a2ml @@ -19,7 +19,7 @@ parser = "complete (1245 conflicts; block_terminator rule added for self-delimit type-checker = "99% (Never/bottom type handling fixed; block divergence propagation added)" borrow-checker = "95%" interpreter = "95%" -wasm-codegen = "92% (real-world game compiles: airborne-submarine-squadron/src/main.as → 8KB WASM)" +wasm-codegen = "92% (real-world game compiles: airborne-submarine-squadron/src/main.affine → 8KB WASM)" wasm-gc-codegen = "70% (WasmGC proposal target: struct.new/struct.get/array.new_fixed/array.get; --wasm-gc CLI flag)" julia-codegen = "exists" lsp-phase-a = "complete" diff --git a/ALPHA-1-RELEASE-NOTES.md b/ALPHA-1-RELEASE-NOTES.md index 444da95..c69c80e 100644 --- a/ALPHA-1-RELEASE-NOTES.md +++ b/ALPHA-1-RELEASE-NOTES.md @@ -95,13 +95,13 @@ dune build ### Try the Examples ```bash # Type check a game example -dune exec affinescript -- check examples/hello.as +dune exec affinescript -- check examples/hello.affine # Run with interpreter -dune exec affinescript -- eval examples/hello.as +dune exec affinescript -- eval examples/hello.affine # Compile to WebAssembly -dune exec affinescript -- compile examples/hello.as -o hello.wasm +dune exec affinescript -- compile examples/hello.affine -o hello.wasm ``` --- @@ -217,7 +217,7 @@ git clone --branch v0.1.0-alpha.1 https://github.com/hyperpolymath/affinescript # Build and run dune build -dune exec affinescript -- eval examples/hello.as +dune exec affinescript -- eval examples/hello.affine # Start building your bug-free game! ``` diff --git a/COMPILER-CAPABILITIES.md b/COMPILER-CAPABILITIES.md index c00aa90..6447995 100644 --- a/COMPILER-CAPABILITIES.md +++ b/COMPILER-CAPABILITIES.md @@ -206,7 +206,7 @@ WebAssembly.instantiate(wasmBuffer).then(wasmModule => { ### Native Deployment (Future) ```bash # Future: Compile to native binary -affinescript compile --target native --arch arm64 program.as +affinescript compile --target native --arch arm64 program.affine ./program ``` diff --git a/FIXES_2026-01-23.md b/FIXES_2026-01-23.md index ba9664e..475a3bc 100644 --- a/FIXES_2026-01-23.md +++ b/FIXES_2026-01-23.md @@ -189,7 +189,7 @@ and check_block (ctx : context) (blk : block) (expected : ty) : eff result = ### Created Tests -**tests/borrow/use_after_move.as** - Should fail: +**tests/borrow/use_after_move.affine** - Should fail: ```affinescript fn consume(own x: Int) -> Int { return x; } fn test_use_after_move() -> Int { @@ -200,7 +200,7 @@ fn test_use_after_move() -> Int { } ``` -**tests/borrow/valid_move.as** - Should pass: +**tests/borrow/valid_move.affine** - Should pass: ```affinescript fn consume(own x: Int) -> Int { return x; } fn test_valid_move() -> Int { @@ -257,8 +257,8 @@ fn test_valid_move() -> Int { - `STATE.scm` - Updated completion %, blockers, accomplishments ### Tests Created -- `tests/borrow/use_after_move.as` - Negative test -- `tests/borrow/valid_move.as` - Positive test +- `tests/borrow/use_after_move.affine` - Negative test +- `tests/borrow/valid_move.affine` - Positive test ## Next Steps diff --git a/MODULE-SYSTEM-PROGRESS.md b/MODULE-SYSTEM-PROGRESS.md index 067314b..35700d7 100644 --- a/MODULE-SYSTEM-PROGRESS.md +++ b/MODULE-SYSTEM-PROGRESS.md @@ -29,9 +29,9 @@ - bin/main.ml (integrated module loader) **Tests Passing:** -- ✅ test_simple_import.as - Single function import -- ✅ test_import.as - Multiple imports (Core + Math) -- ✅ test_math_functions.as - Complex math operations +- ✅ test_simple_import.affine - Single function import +- ✅ test_import.affine - Multiple imports (Core + Math) +- ✅ test_math_functions.affine - Complex math operations **Commit:** `a1b2c3d` "fix: Transfer type information during module imports" @@ -53,9 +53,9 @@ - lib/codegen.ml (~30 lines added) **Tests Passing:** -- ✅ test_function_call.as - Simple helper function (returns 42) -- ✅ test_recursive_call.as - Factorial recursion (returns 120) -- ✅ test_multiple_calls.as - Multiple functions + composition (returns 135) +- ✅ test_function_call.affine - Simple helper function (returns 42) +- ✅ test_recursive_call.affine - Factorial recursion (returns 120) +- ✅ test_multiple_calls.affine - Multiple functions + composition (returns 135) - All tests verified with Node.js WASM execution **Commit:** `31a60c5` "feat: Implement function calls in WASM codegen (Phase 2 complete)" @@ -110,7 +110,7 @@ **File:** `lib/module_loader.ml` (272 lines) **Features:** -- Module path to file path resolution (`Math.Geometry` → `stdlib/Math/Geometry.as`) +- Module path to file path resolution (`Math.Geometry` → `stdlib/Math/Geometry.affine`) - Configurable search paths (stdlib, current dir, additional paths) - Module file parsing and caching - Circular dependency detection @@ -139,13 +139,13 @@ ### 3. Standard Library Fixed ✅ -**Core.as:** +**Core.affine:** - Removed underscore-prefixed parameters - Removed lambdas (parser limitation) - Added explicit `return` statements - Status: ✅ Working -**Math.as:** +**Math.affine:** - Converted `const` to functions - Removed float operations (type checker limitation) - Added explicit `return` statements @@ -194,9 +194,9 @@ type context = { | Test | Feature | Expected | Result | |------|---------|----------|--------| -| test_function_call.as | Simple call | 42 | ✅ PASS | -| test_recursive_call.as | Recursion | 120 | ✅ PASS | -| test_multiple_calls.as | Composition | 135 | ✅ PASS | +| test_function_call.affine | Simple call | 42 | ✅ PASS | +| test_recursive_call.affine | Recursion | 120 | ✅ PASS | +| test_multiple_calls.affine | Composition | 135 | ✅ PASS | ## Module System Features Status @@ -308,7 +308,7 @@ type context = { 3. Integrate effects with borrow checker ### Short-term -1. Fix Option.as and Result.as (explicit returns) +1. Fix Option.affine and Result.affine (explicit returns) 2. Add more stdlib modules 3. Improve error messages diff --git a/PHASE3-ASSESSMENT.md b/PHASE3-ASSESSMENT.md index 088f512..31ce977 100644 --- a/PHASE3-ASSESSMENT.md +++ b/PHASE3-ASSESSMENT.md @@ -60,9 +60,9 @@ Phase 3 infrastructure is **surprisingly complete**! The type system (lib/types. **Test Cases Passing:** ```bash -✓ tests/types/test_row_simple.as # Basic row polymorphism -✓ tests/types/test_parse_row_type.as # Parser validation -✓ tests/types/test_row_polymorphism.as # Complex multi-call test +✓ tests/types/test_row_simple.affine # Basic row polymorphism +✓ tests/types/test_parse_row_type.affine # Parser validation +✓ tests/types/test_row_polymorphism.affine # Complex multi-call test ``` **Example Working Code:** @@ -246,7 +246,7 @@ fn apply[F: Type -> Type, G: Type -> Type, A](f: F[A], g: G[A]) -> F[A] { } ``` -**Test File:** tests/types/test_hkt_parsing.as ✅ PASSES +**Test File:** tests/types/test_hkt_parsing.affine ✅ PASSES **What's Needed:** 1. ❌ Integrate kind checking into type definitions @@ -368,9 +368,9 @@ fn apply[F: Type -> Type, G: Type -> Type, A](f: F[A], g: G[A]) -> F[A] { **Test Cases Passing:** ```bash -✓ tests/types/test_effect_inference.as # Pure function composition -✓ tests/types/test_row_polymorphism.as # Still works with effect changes -✓ tests/types/test_row_simple.as # Still works +✓ tests/types/test_effect_inference.affine # Pure function composition +✓ tests/types/test_row_polymorphism.affine # Still works with effect changes +✓ tests/types/test_row_simple.affine # Still works ``` **Known Limitation:** @@ -438,31 +438,31 @@ fn take_positive(x: Int where (x > 0)) -> Int { return x; } fn dep_with_eff(f: (x: Int) -{IO}-> Int) -> Int { return 0; } ``` -**Test File:** tests/types/test_dependent_parsing.as ✅ PASSES +**Test File:** tests/types/test_dependent_parsing.affine ✅ PASSES ## Testing Strategy ### ✅ Row Polymorphism Tests (COMPLETE) -- ✅ tests/types/test_row_simple.as - Basic usage -- ✅ tests/types/test_parse_row_type.as - Parser validation -- ✅ tests/types/test_row_polymorphism.as - Complex scenarios +- ✅ tests/types/test_row_simple.affine - Basic usage +- ✅ tests/types/test_parse_row_type.affine - Parser validation +- ✅ tests/types/test_row_polymorphism.affine - Complex scenarios ### ✅ Effect System Tests (COMPLETE) -- ✅ tests/types/test_effect_inference.as - Pure function composition +- ✅ tests/types/test_effect_inference.affine - Pure function composition ### ✅ Dependent Types Tests (PARSING COMPLETE) -- ✅ tests/types/test_dependent_parsing.as - Parser validation for dependent arrows and refinements +- ✅ tests/types/test_dependent_parsing.affine - Parser validation for dependent arrows and refinements ### ✅ Higher-Kinded Types Tests (COMPLETE) -- ✅ tests/types/test_hkt_parsing.as - Parser validation for kind annotations and type applications -- ✅ tests/types/test_kind_checking.as - Kind checking integration +- ✅ tests/types/test_hkt_parsing.affine - Parser validation for kind annotations and type applications +- ✅ tests/types/test_kind_checking.affine - Kind checking integration ### ✅ Generic Programming Tests (COMPLETE) -- ✅ tests/types/test_traits.as - Trait definitions with higher-kinded types -- ✅ tests/types/test_generic_programming.as - Functor, Applicative, Monad traits +- ✅ tests/types/test_traits.affine - Trait definitions with higher-kinded types +- ✅ tests/types/test_generic_programming.affine - Functor, Applicative, Monad traits ### ✅ End-to-End Tests (COMPLETE) -- ✅ tests/types/test_dependent_e2e.as - Dependent types with refinements in practice +- ✅ tests/types/test_dependent_e2e.affine - Dependent types with refinements in practice ## Conclusion diff --git a/PHASE3-COMPLETE.md b/PHASE3-COMPLETE.md index 804cdc9..8a6e18c 100644 --- a/PHASE3-COMPLETE.md +++ b/PHASE3-COMPLETE.md @@ -32,7 +32,7 @@ Implemented save-restore pattern for variable bindings: - Modified ExprLambda handling in `synth` function (lib/typecheck.ml:626-646) - Modified ExprLambda handling in `check` function (lib/typecheck.ml:982-997) -**Test:** tests/types/test_lambda_scope_simple.as ✓ Passes +**Test:** tests/types/test_lambda_scope_simple.affine ✓ Passes ### 1. Row Polymorphism (100%) **Implementation:** Extensible record types with row variables @@ -208,19 +208,19 @@ fn fmap_twice[F: Type -> Type, A, B, C]( | Generic Programming | 2 | ✅ | **Test Files:** -1. ✅ test_lambda_scope_simple.as (Lambda scope fix) -2. ✅ test_row_simple.as -3. ✅ test_parse_row_type.as -4. ✅ test_row_polymorphism.as -5. ✅ test_effect_inference.as -6. ✅ test_effect_lambda.as -7. ✅ test_effect_polymorphism.as -8. ✅ test_dependent_parsing.as -9. ✅ test_dependent_e2e.as -10. ✅ test_hkt_parsing.as -11. ✅ test_kind_checking.as -12. ✅ test_traits.as -13. ✅ test_generic_programming.as +1. ✅ test_lambda_scope_simple.affine (Lambda scope fix) +2. ✅ test_row_simple.affine +3. ✅ test_parse_row_type.affine +4. ✅ test_row_polymorphism.affine +5. ✅ test_effect_inference.affine +6. ✅ test_effect_lambda.affine +7. ✅ test_effect_polymorphism.affine +8. ✅ test_dependent_parsing.affine +9. ✅ test_dependent_e2e.affine +10. ✅ test_hkt_parsing.affine +11. ✅ test_kind_checking.affine +12. ✅ test_traits.affine +13. ✅ test_generic_programming.affine ## 📈 Progress Timeline diff --git a/PHASE3-SESSION-SUMMARY.md b/PHASE3-SESSION-SUMMARY.md index b597c85..133211e 100644 --- a/PHASE3-SESSION-SUMMARY.md +++ b/PHASE3-SESSION-SUMMARY.md @@ -21,9 +21,9 @@ **Time:** 3.5 hours **Tests:** -- ✓ tests/types/test_row_simple.as -- ✓ tests/types/test_parse_row_type.as -- ✓ tests/types/test_row_polymorphism.as +- ✓ tests/types/test_row_simple.affine +- ✓ tests/types/test_parse_row_type.affine +- ✓ tests/types/test_row_polymorphism.affine ### 2. ✅ Effect Inference (85% Complete) @@ -40,9 +40,9 @@ **Time:** 2 hours **Tests:** -- ✓ tests/types/test_effect_inference.as -- ✓ tests/types/test_effect_lambda.as -- ✓ tests/types/test_effect_polymorphism.as +- ✓ tests/types/test_effect_inference.affine +- ✓ tests/types/test_effect_lambda.affine +- ✓ tests/types/test_effect_polymorphism.affine **Known Limitation:** Lambda parameter scope bug (pre-existing, separate issue) @@ -81,7 +81,7 @@ Works with both pure and effectful functions! - Type checker integration ✓ **Tests:** -- ✓ tests/types/test_dependent_parsing.as +- ✓ tests/types/test_dependent_parsing.affine **Example:** ```affinescript @@ -114,7 +114,7 @@ fn take_positive(x: Int where (x > 0)) -> Int { return x; } **Time:** 0.5 hours **Tests:** -- ✓ tests/types/test_hkt_parsing.as +- ✓ tests/types/test_hkt_parsing.affine **Example:** ```affinescript @@ -155,14 +155,14 @@ Much of Phase 3 infrastructure was **already implemented** but not integrated: **All 8 Phase 3 tests passing:** ``` -✓ tests/types/test_row_simple.as -✓ tests/types/test_parse_row_type.as -✓ tests/types/test_row_polymorphism.as -✓ tests/types/test_effect_inference.as -✓ tests/types/test_effect_lambda.as -✓ tests/types/test_effect_polymorphism.as -✓ tests/types/test_dependent_parsing.as -✓ tests/types/test_hkt_parsing.as +✓ tests/types/test_row_simple.affine +✓ tests/types/test_parse_row_type.affine +✓ tests/types/test_row_polymorphism.affine +✓ tests/types/test_effect_inference.affine +✓ tests/types/test_effect_lambda.affine +✓ tests/types/test_effect_polymorphism.affine +✓ tests/types/test_dependent_parsing.affine +✓ tests/types/test_hkt_parsing.affine ``` ## Phase 3 Status Breakdown @@ -250,14 +250,14 @@ Row types created 20 shift/reduce conflicts. Solution was to write explicit recu - `lib/unify.ml` - Already complete (no changes needed) ### Tests Created: -- `tests/types/test_row_simple.as` -- `tests/types/test_parse_row_type.as` -- `tests/types/test_row_polymorphism.as` -- `tests/types/test_effect_inference.as` -- `tests/types/test_effect_lambda.as` -- `tests/types/test_effect_polymorphism.as` -- `tests/types/test_dependent_parsing.as` -- `tests/types/test_hkt_parsing.as` +- `tests/types/test_row_simple.affine` +- `tests/types/test_parse_row_type.affine` +- `tests/types/test_row_polymorphism.affine` +- `tests/types/test_effect_inference.affine` +- `tests/types/test_effect_lambda.affine` +- `tests/types/test_effect_polymorphism.affine` +- `tests/types/test_dependent_parsing.affine` +- `tests/types/test_hkt_parsing.affine` ### Documentation: - `PHASE3-ASSESSMENT.md` - Comprehensive progress tracking diff --git a/README.adoc b/README.adoc index 9b8a3df..d4516e9 100644 --- a/README.adoc +++ b/README.adoc @@ -299,22 +299,22 @@ total fn append[n: Nat, m: Nat, T]( dune build # Type check a file -dune exec affinescript -- check examples/hello.as +dune exec affinescript -- check examples/hello.affine # Run with interpreter -dune exec affinescript -- eval examples/factorial.as +dune exec affinescript -- eval examples/factorial.affine # Compile to WebAssembly -dune exec affinescript -- compile examples/hello.as -o hello.wasm +dune exec affinescript -- compile examples/hello.affine -o hello.wasm # Format code -dune exec affinescript -- fmt examples/hello.as +dune exec affinescript -- fmt examples/hello.affine # Lint for code quality -dune exec affinescript -- lint examples/hello.as +dune exec affinescript -- lint examples/hello.affine # JSON diagnostics (for editors/CI) -dune exec affinescript -- check --json examples/hello.as +dune exec affinescript -- check --json examples/hello.affine ---- == Project Status diff --git a/SESSION-2026-01-23.md b/SESSION-2026-01-23.md index 12e66f1..4f435f4 100644 --- a/SESSION-2026-01-23.md +++ b/SESSION-2026-01-23.md @@ -101,7 +101,7 @@ fn main() -> Int { - Multiple sequential effects don't work correctly **Documentation:** `docs/EFFECTS-IMPLEMENTATION.md` -**Test:** `tests/effects/basic_effect.as` +**Test:** `tests/effects/basic_effect.affine` ### 3. WebAssembly Code Generation Infrastructure 🔄 @@ -168,7 +168,7 @@ Created complete WASM code generation infrastructure: - **Files added:** - `docs/EFFECTS-IMPLEMENTATION.md` - `docs/tutorial/lesson-{02-10}-*.md` (9 files) - - `tests/effects/basic_effect.as` + - `tests/effects/basic_effect.affine` - **Files modified:** - `lib/value.ml`: Add PerformEffect error type - `lib/interp.ml`: Implement effect handlers @@ -281,7 +281,7 @@ Created complete WASM code generation infrastructure: - `docs/tutorial/lesson-09-modules.md` - `docs/tutorial/lesson-10-building.md` - `docs/EFFECTS-IMPLEMENTATION.md` -- `tests/effects/basic_effect.as` +- `tests/effects/basic_effect.affine` - `lib/wasm.ml` - `lib/codegen.ml` - `SESSION-2026-01-23.md` (this file) diff --git a/SESSION-COMPLETE.md b/SESSION-COMPLETE.md index 31d5117..29c0782 100644 --- a/SESSION-COMPLETE.md +++ b/SESSION-COMPLETE.md @@ -46,7 +46,7 @@ This extended session completed all four priorities requested by the user: **Example:** ```bash -affinescript eval program.as +affinescript eval program.affine ``` ## Priority 2: WebAssembly Codegen ✅ WORKING @@ -91,7 +91,7 @@ affinescript eval program.as **End-to-End Pipeline:** ``` -AffineScript source (.as) +AffineScript source (.affine) ↓ parse AST ↓ resolve names @@ -106,7 +106,7 @@ Result ### Verified Working -**Test Program:** `simple_arithmetic.as` +**Test Program:** `simple_arithmetic.affine` ```affinescript fn main() -> Int { let a = 10; @@ -118,7 +118,7 @@ fn main() -> Int { **Compilation:** ```bash -affinescript compile simple_arithmetic.as -o test.wasm +affinescript compile simple_arithmetic.affine -o test.wasm ``` **Execution with Node.js:** @@ -151,7 +151,7 @@ Still TODO for complete WASM support: ### Modules Created -**1. Core.as** - Basic utilities (~100 lines) +**1. Core.affine** - Basic utilities (~100 lines) ```affinescript pub fn min(a: Int, b: Int) -> Int pub fn max(a: Int, b: Int) -> Int @@ -161,7 +161,7 @@ pub fn compose[A, B, C](f, g) // Function composition pub fn flip[A, B, C](f) // Flip arguments ``` -**2. Result.as** - Error handling (~120 lines) +**2. Result.affine** - Error handling (~120 lines) ```affinescript pub fn unwrap[T, E](own r: Result[T, E]) -> T pub fn unwrap_or[T, E](own r: Result[T, E], default: T) -> T @@ -169,7 +169,7 @@ pub fn map[T, U, E](own r: Result[T, E], f: fn(T) -> U) -> Result[U, E] pub fn and_then[T, U, E](own r: Result[T, E], f: fn(T) -> Result[U, E]) -> Result[U, E] ``` -**3. Option.as** - Optional values (~150 lines) +**3. Option.affine** - Optional values (~150 lines) ```affinescript pub fn unwrap[T](own opt: Option[T]) -> T pub fn unwrap_or[T](own opt: Option[T], default: T) -> T @@ -178,7 +178,7 @@ pub fn and_then[T, U](own opt: Option[T], f: fn(T) -> Option[U]) -> Option[U] pub fn filter[T](own opt: Option[T], pred: fn(ref T) -> Bool) -> Option[T] ``` -**4. Math.as** - Mathematical functions (~150 lines) +**4. Math.affine** - Mathematical functions (~150 lines) ```affinescript pub const PI: Float = 3.141592653589793; pub const E: Float = 2.718281828459045; @@ -318,14 +318,14 @@ pub fn area(radius: Float) -> Float { - `lib/wasm.ml` - WASM IR definitions - `lib/codegen.ml` - Code generator - `lib/wasm_encode.ml` - Binary encoder -- `stdlib/Core.as` - Core utilities -- `stdlib/Result.as` - Result error handling -- `stdlib/Option.as` - Option optional values -- `stdlib/Math.as` - Mathematical functions +- `stdlib/Core.affine` - Core utilities +- `stdlib/Result.affine` - Result error handling +- `stdlib/Option.affine` - Option optional values +- `stdlib/Math.affine` - Mathematical functions ### Tests -- `tests/effects/basic_effect.as` - Effect handler test -- `tests/codegen/simple_arithmetic.as` - WASM codegen test +- `tests/effects/basic_effect.affine` - Effect handler test +- `tests/codegen/simple_arithmetic.affine` - WASM codegen test ## Working Examples @@ -348,7 +348,7 @@ fn main() -> Int { **Run:** ```bash -affinescript eval effect_test.as +affinescript eval effect_test.affine # Output: Program executed successfully ``` @@ -366,8 +366,8 @@ fn main() -> Int { **Compile:** ```bash -affinescript compile arithmetic.as -o output.wasm -# Output: Compiled arithmetic.as -> output.wasm +affinescript compile arithmetic.affine -o output.wasm +# Output: Compiled arithmetic.affine -> output.wasm ``` **Execute:** @@ -424,14 +424,14 @@ let local_count = ctx_final.next_local - param_count in ### Interpreter Tests ```bash -affinescript eval tests/effects/basic_effect.as -affinescript eval tests/borrow/valid_move.as -affinescript eval tests/borrow/use_after_move.as # Should fail +affinescript eval tests/effects/basic_effect.affine +affinescript eval tests/borrow/valid_move.affine +affinescript eval tests/borrow/use_after_move.affine # Should fail ``` ### Codegen Tests ```bash -affinescript compile tests/codegen/simple_arithmetic.as -o test.wasm +affinescript compile tests/codegen/simple_arithmetic.affine -o test.wasm file test.wasm # Should show: WebAssembly (wasm) binary module node run_wasm.js # Should output: 42 ``` diff --git a/TRAIT_SYSTEM_STATUS.md b/TRAIT_SYSTEM_STATUS.md index 06b17f5..b8afc19 100644 --- a/TRAIT_SYSTEM_STATUS.md +++ b/TRAIT_SYSTEM_STATUS.md @@ -191,7 +191,7 @@ Known failures/limitations: **Example Output:** ``` -/tmp/test_type_mismatch.as:9:26: Type mismatch +/tmp/test_type_mismatch.affine:9:26: Type mismatch Expected: Bool Actual: Int Cannot mix Int and Bool types. @@ -331,7 +331,7 @@ The effect system core is **substantially complete** (95%). Effects: 4. Mark builtin operations with appropriate effects **Testing:** -- ✅ Basic trait method calls compile correctly (/tmp/test_effects.as) +- ✅ Basic trait method calls compile correctly (/tmp/test_effects.affine) - ⚠️ Need tests for effect violations (pure calling impure) - ⚠️ Need tests with explicit effect annotations diff --git a/conformance/invalid/001_unclosed_brace.as b/conformance/invalid/001_unclosed_brace.affine similarity index 100% rename from conformance/invalid/001_unclosed_brace.as rename to conformance/invalid/001_unclosed_brace.affine diff --git a/conformance/invalid/002_unclosed_string.as b/conformance/invalid/002_unclosed_string.affine similarity index 100% rename from conformance/invalid/002_unclosed_string.as rename to conformance/invalid/002_unclosed_string.affine diff --git a/conformance/invalid/003_bad_number.as b/conformance/invalid/003_bad_number.affine similarity index 100% rename from conformance/invalid/003_bad_number.as rename to conformance/invalid/003_bad_number.affine diff --git a/conformance/invalid/004_unexpected_token.as b/conformance/invalid/004_unexpected_token.affine similarity index 100% rename from conformance/invalid/004_unexpected_token.as rename to conformance/invalid/004_unexpected_token.affine diff --git a/conformance/invalid/005_missing_arrow.as b/conformance/invalid/005_missing_arrow.affine similarity index 100% rename from conformance/invalid/005_missing_arrow.as rename to conformance/invalid/005_missing_arrow.affine diff --git a/conformance/invalid/006_bad_operator.as b/conformance/invalid/006_bad_operator.affine similarity index 100% rename from conformance/invalid/006_bad_operator.as rename to conformance/invalid/006_bad_operator.affine diff --git a/conformance/invalid/007_incomplete_effect.as b/conformance/invalid/007_incomplete_effect.affine similarity index 100% rename from conformance/invalid/007_incomplete_effect.as rename to conformance/invalid/007_incomplete_effect.affine diff --git a/conformance/invalid/008_mismatched_parens.as b/conformance/invalid/008_mismatched_parens.affine similarity index 100% rename from conformance/invalid/008_mismatched_parens.as rename to conformance/invalid/008_mismatched_parens.affine diff --git a/conformance/invalid/009_reserved_keyword.as b/conformance/invalid/009_reserved_keyword.affine similarity index 100% rename from conformance/invalid/009_reserved_keyword.as rename to conformance/invalid/009_reserved_keyword.affine diff --git a/conformance/invalid/010_empty_match.as b/conformance/invalid/010_empty_match.affine similarity index 100% rename from conformance/invalid/010_empty_match.as rename to conformance/invalid/010_empty_match.affine diff --git a/conformance/invalid/011_bad_escape.as b/conformance/invalid/011_bad_escape.affine similarity index 100% rename from conformance/invalid/011_bad_escape.as rename to conformance/invalid/011_bad_escape.affine diff --git a/conformance/invalid/012_trailing_comma.as b/conformance/invalid/012_trailing_comma.affine similarity index 100% rename from conformance/invalid/012_trailing_comma.as rename to conformance/invalid/012_trailing_comma.affine diff --git a/conformance/valid/001_empty.as b/conformance/valid/001_empty.affine similarity index 100% rename from conformance/valid/001_empty.as rename to conformance/valid/001_empty.affine diff --git a/conformance/valid/002_comments.as b/conformance/valid/002_comments.affine similarity index 100% rename from conformance/valid/002_comments.as rename to conformance/valid/002_comments.affine diff --git a/conformance/valid/003_let_bindings.as b/conformance/valid/003_let_bindings.affine similarity index 100% rename from conformance/valid/003_let_bindings.as rename to conformance/valid/003_let_bindings.affine diff --git a/conformance/valid/004_literals.as b/conformance/valid/004_literals.affine similarity index 100% rename from conformance/valid/004_literals.as rename to conformance/valid/004_literals.affine diff --git a/conformance/valid/005_functions.as b/conformance/valid/005_functions.affine similarity index 100% rename from conformance/valid/005_functions.as rename to conformance/valid/005_functions.affine diff --git a/conformance/valid/006_type_alias.as b/conformance/valid/006_type_alias.affine similarity index 100% rename from conformance/valid/006_type_alias.as rename to conformance/valid/006_type_alias.affine diff --git a/conformance/valid/007_struct_def.as b/conformance/valid/007_struct_def.affine similarity index 100% rename from conformance/valid/007_struct_def.as rename to conformance/valid/007_struct_def.affine diff --git a/conformance/valid/008_enum_def.as b/conformance/valid/008_enum_def.affine similarity index 100% rename from conformance/valid/008_enum_def.as rename to conformance/valid/008_enum_def.affine diff --git a/conformance/valid/009_effect_def.as b/conformance/valid/009_effect_def.affine similarity index 100% rename from conformance/valid/009_effect_def.as rename to conformance/valid/009_effect_def.affine diff --git a/conformance/valid/010_pattern_match.as b/conformance/valid/010_pattern_match.affine similarity index 100% rename from conformance/valid/010_pattern_match.as rename to conformance/valid/010_pattern_match.affine diff --git a/conformance/valid/011_rows.as b/conformance/valid/011_rows.affine similarity index 100% rename from conformance/valid/011_rows.as rename to conformance/valid/011_rows.affine diff --git a/conformance/valid/012_ownership.as b/conformance/valid/012_ownership.affine similarity index 100% rename from conformance/valid/012_ownership.as rename to conformance/valid/012_ownership.affine diff --git a/docs/ALIB-INTEGRATION.md b/docs/ALIB-INTEGRATION.md index 2262e5a..aca1b87 100644 --- a/docs/ALIB-INTEGRATION.md +++ b/docs/ALIB-INTEGRATION.md @@ -43,7 +43,7 @@ From `aggregate-library/`: **Action:** Implement aLib conformance test runner for AffineScript ```affinescript -// stdlib/alib_conformance.as +// stdlib/alib_conformance.affine fn run_collection_map_tests() -> TestResult { // Load test vectors from aggregate-library/specs/collection/map.md // Execute against AffineScript stdlib implementation @@ -137,14 +137,14 @@ benchmarks: ``` alib-for-affinescript/ ├── src/ -│ ├── arithmetic.as # Conformant arithmetic operations -│ ├── collection.as # Conformant collection operations -│ ├── comparison.as # Conformant comparison operations -│ ├── string.as # Conformant string operations +│ ├── arithmetic.affine # Conformant arithmetic operations +│ ├── collection.affine # Conformant collection operations +│ ├── comparison.affine # Conformant comparison operations +│ ├── string.affine # Conformant string operations │ └── ... ├── tests/ │ └── conformance/ # aLib test vectors -│ ├── runner.as +│ ├── runner.affine │ └── vectors/ # Imported from aggregate-library ├── docs/ │ └── affine-semantics.md # AffineScript-specific notes @@ -187,10 +187,10 @@ alib-for-affinescript/ | AffineScript Module | aLib Spec | Conformance Status | |---------------------|-----------|-------------------| -| `stdlib/prelude.as` | collection/{map,filter,fold} | Partial (needs testing) | -| `stdlib/math.as` | arithmetic/* | Good (basic ops) | -| `stdlib/string.as` | string/* | Partial (missing ops) | -| `stdlib/collections.as` | collection/* | Good (comprehensive) | +| `stdlib/prelude.affine` | collection/{map,filter,fold} | Partial (needs testing) | +| `stdlib/math.affine` | arithmetic/* | Good (basic ops) | +| `stdlib/string.affine` | string/* | Partial (missing ops) | +| `stdlib/collections.affine` | collection/* | Good (comprehensive) | **Actions:** 1. Add conformance attributes to stdlib functions: @@ -252,7 +252,7 @@ All elements consumed exactly once. **Add to AffineScript test suite:** ```affinescript -// tests/alib_conformance_test.as +// tests/alib_conformance_test.affine // Auto-generated from aggregate-library/specs/collection/map.md fn test_map_conformance() -> TestResult { @@ -314,7 +314,7 @@ Preserves order, only includes elements where predicate returns true ### 2. Implement in AffineScript (Affine Semantics) ```affinescript -// stdlib/collections.as +// stdlib/collections.affine /// Conforms to aLib collection/filter v1.0 /// Affine semantics: Predicate borrows, source moved @@ -333,7 +333,7 @@ fn filter(arr: [T], pred: &T -> Bool) -> [T] { ### 3. Run Conformance Tests ```affinescript -// tests/conformance/collection_filter.as +// tests/conformance/collection_filter.affine fn test_alib_filter_conformance() -> TestResult { // From aLib test vectors diff --git a/docs/TYPECHECKER-COMPLETION.md b/docs/TYPECHECKER-COMPLETION.md index 162ab3e..f10b096 100644 --- a/docs/TYPECHECKER-COMPLETION.md +++ b/docs/TYPECHECKER-COMPLETION.md @@ -308,8 +308,8 @@ Type checker completion tested via: ### Example Programs Created test files demonstrating new features: -- `examples/typecheck_complete_test.as` - Full feature demonstration -- `examples/typecheck_features_test.as` - Parseable subset +- `examples/typecheck_complete_test.affine` - Full feature demonstration +- `examples/typecheck_features_test.affine` - Parseable subset **Note:** Parser may not yet support all syntax (e.g., `unsafe` blocks), but type checker is ready when parser is completed. diff --git a/docs/alib/README.md b/docs/alib/README.md index db132fe..e3809b5 100644 --- a/docs/alib/README.md +++ b/docs/alib/README.md @@ -73,12 +73,12 @@ AffineScript stdlib aligns with these aLib categories: | aLib Category | AffineScript Module | Status | |---------------|---------------------|--------| -| `arithmetic` | `stdlib/math.as` | ✓ Good | -| `collection` | `stdlib/collections.as` + `prelude.as` | ⚠ Needs affine semantics docs | -| `comparison` | `stdlib/prelude.as` | ✓ Good | +| `arithmetic` | `stdlib/math.affine` | ✓ Good | +| `collection` | `stdlib/collections.affine` + `prelude.affine` | ⚠ Needs affine semantics docs | +| `comparison` | `stdlib/prelude.affine` | ✓ Good | | `conditional` | Built-in (if/match) | ✓ Good | | `logical` | Built-in (&&, \|\|, !) | ✓ Good | -| `string` | `stdlib/string.as` | ⚠ Partial | +| `string` | `stdlib/string.affine` | ⚠ Partial | ## Affine Semantics Examples diff --git a/docs/guides/TESTING-REPORT.adoc b/docs/guides/TESTING-REPORT.adoc index f898a6a..382dafd 100644 --- a/docs/guides/TESTING-REPORT.adoc +++ b/docs/guides/TESTING-REPORT.adoc @@ -210,7 +210,7 @@ Menhir resolves by preferring shift (continue parsing statement), which breaks t == Example Files -=== hello.as +=== hello.affine Fixed syntax for effect annotations: @@ -221,7 +221,7 @@ The parser uses `-{Eff}->` syntax, not `-> T / Eff`. === Other Examples -The example files (`effects.as`, `ownership.as`, `traits.as`, etc.) use aspirational syntax that is not yet supported: +The example files (`effects.affine`, `ownership.affine`, `traits.affine`, etc.) use aspirational syntax that is not yet supported: * `-> T / Eff` effect syntax (parser uses `-{Eff}-> T`) * GADT-style enum variants (`| Nil : Vec[0, T]`) @@ -237,10 +237,10 @@ The compiler CLI works correctly: $ affinescript --help # Shows help for: check, compile, lex, parse commands -$ affinescript lex examples/hello.as +$ affinescript lex examples/hello.affine # Successfully tokenizes the file -$ affinescript parse examples/hello.as +$ affinescript parse examples/hello.affine # Successfully parses (after syntax fix) ---- @@ -274,4 +274,4 @@ $ affinescript parse examples/hello.as * `lib/ast.ml` - Added trd_where field * `lib/parse.ml` - Removed WITH token * `test/test_parser.ml` - Fixed pattern matching -* `examples/hello.as` - Fixed effect syntax +* `examples/hello.affine` - Fixed effect syntax diff --git a/docs/guides/TESTING-REPORT.scm b/docs/guides/TESTING-REPORT.scm index 7b05e84..d291eec 100644 --- a/docs/guides/TESTING-REPORT.scm +++ b/docs/guides/TESTING-REPORT.scm @@ -205,49 +205,49 @@ (cli-testing (command "affinescript --help" (status pass)) - (command "affinescript lex examples/hello.as" (status pass)) - (command "affinescript parse examples/hello.as" (status pass) + (command "affinescript lex examples/hello.affine" (status pass)) + (command "affinescript parse examples/hello.affine" (status pass) (note "After fixing effect syntax"))) (example-files (file - (name "hello.as") + (name "hello.affine") (status fixed) (issue "Effect syntax mismatch") (fix "Changed `-> () / IO` to `-{IO}-> ()`")) (file - (name "effects.as") + (name "effects.affine") (status needs-update) (issues "Uses aspirational syntax not yet implemented")) (file - (name "ownership.as") + (name "ownership.affine") (status needs-update) (issues "Uses aspirational syntax not yet implemented")) (file - (name "traits.as") + (name "traits.affine") (status needs-update) (issues "Uses aspirational syntax not yet implemented")) (file - (name "refinements.as") + (name "refinements.affine") (status needs-update) (issues "Uses aspirational syntax not yet implemented")) (file - (name "rows.as") + (name "rows.affine") (status needs-update) (issues "Uses aspirational syntax not yet implemented")) (file - (name "vectors.as") + (name "vectors.affine") (status needs-update) (issues "Uses aspirational syntax not yet implemented"))) @@ -283,5 +283,5 @@ (changes "Removed WITH token mapping")) (file "test/test_parser.ml" (changes "Fixed pattern matching issues")) - (file "examples/hello.as" + (file "examples/hello.affine" (changes "Fixed effect annotation syntax")))) diff --git a/docs/guides/lessons/README.md b/docs/guides/lessons/README.md index 13d796b..513db14 100644 --- a/docs/guides/lessons/README.md +++ b/docs/guides/lessons/README.md @@ -40,14 +40,14 @@ Each lesson is a markdown file you can read on GitHub. ### Option 2: Interactive Playground 1. Open the [Playground](../../../playground/test.html) -2. Load the lesson example (e.g., `examples/lessons/01_hello.as`) +2. Load the lesson example (e.g., `examples/lessons/01_hello.affine`) 3. Follow along by running code as you read ### Option 3: Clone and Experiment ```bash git clone https://github.com/hyperpolymath/affinescript cd affinescript -./affinescript examples/lessons/01_hello.as +./affinescript examples/lessons/01_hello.affine ``` --- diff --git a/docs/spec.md b/docs/spec.md index 7939a62..b2456e9 100644 --- a/docs/spec.md +++ b/docs/spec.md @@ -1644,7 +1644,7 @@ tests/ ``` error[E0501]: cannot use `file` after move - --> src/main.as:10:5 + --> src/main.affine:10:5 | 8 | close(file); | ---- value moved here @@ -1657,7 +1657,7 @@ error[E0501]: cannot use `file` after move ``` error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable - --> src/main.as:5:10 + --> src/main.affine:5:10 | 4 | let r = ref x; | ----- immutable borrow occurs here @@ -1671,7 +1671,7 @@ error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immuta ``` error[E0308]: mismatched types - --> src/main.as:5:12 + --> src/main.affine:5:12 | 5 | head(empty) | ^^^^^ expected `Vec[n + 1, T]`, found `Vec[0, T]` @@ -1682,7 +1682,7 @@ error[E0308]: mismatched types ``` error[E0309]: refinement predicate not satisfied - --> src/main.as:8:15 + --> src/main.affine:8:15 | 8 | safeGet(arr, 10) | ^^ cannot prove `10 < 5` @@ -1694,7 +1694,7 @@ error[E0309]: refinement predicate not satisfied ``` error[E0601]: effect not handled - --> src/main.as:3:5 + --> src/main.affine:3:5 | 3 | println("hello") | ^^^^^^^^^^^^^^^^ this has effect `IO` @@ -1705,7 +1705,7 @@ error[E0601]: effect not handled ``` warning[W0602]: owned resource may leak on exception - --> src/main.as:8:5 + --> src/main.affine:8:5 | 7 | let file = open(path)?; | ---- owned resource acquired here @@ -1722,7 +1722,7 @@ warning[W0602]: owned resource may leak on exception ``` error[E0401]: no implementation of trait `Show` for type `MyType` - --> src/main.as:5:5 + --> src/main.affine:5:5 | 5 | println(x.show()) | ^^^^^^^^ `Show` is not implemented for `MyType` @@ -1740,7 +1740,7 @@ error[E0401]: no implementation of trait `Show` for type `MyType` ``` error[E0701]: cannot find `Vec` in this scope - --> src/main.as:3:10 + --> src/main.affine:3:10 | 3 | let v: Vec[3, Int] = Nil; | ^^^ not found in this scope @@ -1750,7 +1750,7 @@ error[E0701]: cannot find `Vec` in this scope ``` error[E0702]: function `helper` is private - --> src/main.as:5:5 + --> src/main.affine:5:5 | 5 | Utils.helper() | ^^^^^^^^^^^^^^ private function diff --git a/docs/standards/RELEASE.md b/docs/standards/RELEASE.md index 43c4a51..390aaf3 100644 --- a/docs/standards/RELEASE.md +++ b/docs/standards/RELEASE.md @@ -15,13 +15,13 @@ This is the first public release of AffineScript, featuring a complete specifica - **Error Handling** - Structured diagnostics with source locations ### Examples -- `examples/hello.as` - Hello World with effects -- `examples/vectors.as` - Dependent types with length-indexed vectors -- `examples/ownership.as` - Ownership and borrowing patterns -- `examples/rows.as` - Row polymorphism -- `examples/effects.as` - Effect handling and state -- `examples/traits.as` - Traits and type classes -- `examples/refinements.as` - Refinement types +- `examples/hello.affine` - Hello World with effects +- `examples/vectors.affine` - Dependent types with length-indexed vectors +- `examples/ownership.affine` - Ownership and borrowing patterns +- `examples/rows.affine` - Row polymorphism +- `examples/effects.affine` - Effect handling and state +- `examples/traits.affine` - Traits and type classes +- `examples/refinements.affine` - Refinement types ## Building from Source @@ -70,7 +70,7 @@ dune build ### Lex a File ```bash -dune exec affinescript -- lex examples/hello.as +dune exec affinescript -- lex examples/hello.affine ``` Output: @@ -85,7 +85,7 @@ FN @ 2:3-2:5 ### Parse a File ```bash -dune exec affinescript -- parse examples/hello.as +dune exec affinescript -- parse examples/hello.affine ``` Output: @@ -100,7 +100,7 @@ Output: ### Check a File (WIP) ```bash -dune exec affinescript -- check examples/hello.as +dune exec affinescript -- check examples/hello.affine ``` Note: Type checking is not yet implemented in this release. diff --git a/docs/tutorial/lesson-10-building.md b/docs/tutorial/lesson-10-building.md index f71816d..345d86f 100644 --- a/docs/tutorial/lesson-10-building.md +++ b/docs/tutorial/lesson-10-building.md @@ -5,11 +5,11 @@ ``` my-project/ ├── src/ -│ ├── main.as -│ ├── lib.as -│ └── util.as +│ ├── main.affine +│ ├── lib.affine +│ └── util.affine ├── tests/ -│ └── test_main.as +│ └── test_main.affine └── affinescript.toml ``` @@ -27,13 +27,13 @@ fn test_addition() -> TestResult { ```bash # Check types and borrow checker -affinescript check src/main.as +affinescript check src/main.affine # Compile to WebAssembly -affinescript compile src/main.as -o output.wasm +affinescript compile src/main.affine -o output.wasm # Run with interpreter -affinescript eval src/main.as +affinescript eval src/main.affine ``` ## Next Steps diff --git a/editors/tree-sitter-affinescript/package.json b/editors/tree-sitter-affinescript/package.json index 19c5c03..bf0146f 100644 --- a/editors/tree-sitter-affinescript/package.json +++ b/editors/tree-sitter-affinescript/package.json @@ -23,7 +23,7 @@ "tree-sitter": [ { "scope": "source.affinescript", - "file-types": ["as"], + "file-types": ["affine"], "highlights": "queries/highlights.scm" } ] diff --git a/editors/vscode/package.json b/editors/vscode/package.json index afe2589..33d0082 100644 --- a/editors/vscode/package.json +++ b/editors/vscode/package.json @@ -38,7 +38,7 @@ "affinescript" ], "extensions": [ - ".as" + ".affine" ], "configuration": "./language-configuration.json", "icon": { diff --git a/editors/vscode/src/extension.ts b/editors/vscode/src/extension.ts index 2a9e5f7..816c2bd 100644 --- a/editors/vscode/src/extension.ts +++ b/editors/vscode/src/extension.ts @@ -64,7 +64,7 @@ async function startLsp(context: vscode.ExtensionContext) { const clientOptions: LanguageClientOptions = { documentSelector: [{ scheme: 'file', language: 'affinescript' }], synchronize: { - fileEvents: vscode.workspace.createFileSystemWatcher('**/*.as') + fileEvents: vscode.workspace.createFileSystemWatcher('**/*.affine') } }; @@ -125,7 +125,7 @@ async function compileCurrentFile() { } const filePath = editor.document.uri.fsPath; - const outputPath = filePath.replace(/\.as$/, '.wasm'); + const outputPath = filePath.replace(/\.affine$/, '.wasm'); const terminal = vscode.window.createTerminal('AffineScript Compile'); terminal.show(); diff --git a/examples/comprehensive_test.as b/examples/comprehensive_test.affine similarity index 100% rename from examples/comprehensive_test.as rename to examples/comprehensive_test.affine diff --git a/examples/dependent_types.as b/examples/dependent_types.affine similarity index 100% rename from examples/dependent_types.as rename to examples/dependent_types.affine diff --git a/examples/effects.as b/examples/effects.affine similarity index 100% rename from examples/effects.as rename to examples/effects.affine diff --git a/examples/exception_test.as b/examples/exception_test.affine similarity index 100% rename from examples/exception_test.as rename to examples/exception_test.affine diff --git a/examples/hello.as b/examples/hello.affine similarity index 100% rename from examples/hello.as rename to examples/hello.affine diff --git a/examples/lessons/01_hello.as b/examples/lessons/01_hello.affine similarity index 100% rename from examples/lessons/01_hello.as rename to examples/lessons/01_hello.affine diff --git a/examples/ownership.as b/examples/ownership.affine similarity index 100% rename from examples/ownership.as rename to examples/ownership.affine diff --git a/examples/refinements.as b/examples/refinements.affine similarity index 100% rename from examples/refinements.as rename to examples/refinements.affine diff --git a/examples/rows.as b/examples/rows.affine similarity index 100% rename from examples/rows.as rename to examples/rows.affine diff --git a/examples/simple_test.as b/examples/simple_test.affine similarity index 100% rename from examples/simple_test.as rename to examples/simple_test.affine diff --git a/examples/traits.as b/examples/traits.affine similarity index 100% rename from examples/traits.as rename to examples/traits.affine diff --git a/examples/typecheck_complete_test.as b/examples/typecheck_complete_test.affine similarity index 100% rename from examples/typecheck_complete_test.as rename to examples/typecheck_complete_test.affine diff --git a/examples/typecheck_features_test.as b/examples/typecheck_features_test.affine similarity index 100% rename from examples/typecheck_features_test.as rename to examples/typecheck_features_test.affine diff --git a/examples/vectors.as b/examples/vectors.affine similarity index 100% rename from examples/vectors.as rename to examples/vectors.affine diff --git a/lib/json_output.ml b/lib/json_output.ml index ce35c03..1946c20 100644 --- a/lib/json_output.ml +++ b/lib/json_output.ml @@ -16,7 +16,7 @@ "severity": "error" | "warning" | "hint" | "info", "code": "E0001", "message": "...", - "file": "path/to/file.as", + "file": "path/to/file.affine", "start_line": 1, "start_col": 1, "end_line": 1, @@ -342,7 +342,7 @@ let of_lint_diagnostic (d : Linter.diagnostic) : diagnostic = "id": 0, "name": "foo", "kind": "function", - "file": "path/to/file.as", + "file": "path/to/file.affine", "start_line": 1, "start_col": 4, "end_line": 1, "end_col": 7, "type": "Int -> Int" | null, diff --git a/lib/module_loader.ml b/lib/module_loader.ml index d9fb292..b5f9559 100644 --- a/lib/module_loader.ml +++ b/lib/module_loader.ml @@ -63,19 +63,19 @@ let default_config () : config = (** Convert module path to file path candidates For module path ["Math", "Geometry"], try: - 1. Math/Geometry.as (nested module) - 2. Math.as (check if it exports Geometry) + 1. Math/Geometry.affine (nested module) + 2. Math.affine (check if it exports Geometry) *) let path_to_candidates (mod_path : string list) : string list = match mod_path with | [] -> [] - | [name] -> [name ^ ".as"] + | [name] -> [name ^ ".affine"] | _ -> - (* Try nested path: A/B/C.as *) - let nested = String.concat "/" mod_path ^ ".as" in - (* Try parent with submodule: A/B.as (if B declares module C) *) + (* Try nested path: A/B/C.affine *) + let nested = String.concat "/" mod_path ^ ".affine" in + (* Try parent with submodule: A/B.affine (if B declares module C) *) let parent_parts = List.rev mod_path |> List.tl |> List.rev in - let parent = String.concat "/" parent_parts ^ ".as" in + let parent = String.concat "/" parent_parts ^ ".affine" in [nested; parent] (** Search for a module file in search paths *) diff --git a/stdlib/Core.as b/stdlib/Core.affine similarity index 100% rename from stdlib/Core.as rename to stdlib/Core.affine diff --git a/stdlib/Math.as b/stdlib/Math.affine similarity index 100% rename from stdlib/Math.as rename to stdlib/Math.affine diff --git a/stdlib/Option.as b/stdlib/Option.affine similarity index 100% rename from stdlib/Option.as rename to stdlib/Option.affine diff --git a/stdlib/README.md b/stdlib/README.md index b8bc1d3..1ec68a9 100644 --- a/stdlib/README.md +++ b/stdlib/README.md @@ -166,8 +166,8 @@ To add new stdlib functions: Test standard library functions: ```bash -affinescript eval tests/stdlib/test_core.as -affinescript eval tests/stdlib/test_result.as -affinescript eval tests/stdlib/test_option.as -affinescript eval tests/stdlib/test_math.as +affinescript eval tests/stdlib/test_core.affine +affinescript eval tests/stdlib/test_result.affine +affinescript eval tests/stdlib/test_option.affine +affinescript eval tests/stdlib/test_math.affine ``` diff --git a/stdlib/Result.as b/stdlib/Result.affine similarity index 100% rename from stdlib/Result.as rename to stdlib/Result.affine diff --git a/stdlib/collections.as b/stdlib/collections.affine similarity index 100% rename from stdlib/collections.as rename to stdlib/collections.affine diff --git a/stdlib/effects.as b/stdlib/effects.affine similarity index 100% rename from stdlib/effects.as rename to stdlib/effects.affine diff --git a/stdlib/io.as b/stdlib/io.affine similarity index 100% rename from stdlib/io.as rename to stdlib/io.affine diff --git a/stdlib/math.as b/stdlib/math.affine similarity index 100% rename from stdlib/math.as rename to stdlib/math.affine diff --git a/stdlib/option.as b/stdlib/option.affine similarity index 100% rename from stdlib/option.as rename to stdlib/option.affine diff --git a/stdlib/prelude.as b/stdlib/prelude.affine similarity index 100% rename from stdlib/prelude.as rename to stdlib/prelude.affine diff --git a/stdlib/result.as b/stdlib/result.affine similarity index 100% rename from stdlib/result.as rename to stdlib/result.affine diff --git a/stdlib/string.as b/stdlib/string.affine similarity index 100% rename from stdlib/string.as rename to stdlib/string.affine diff --git a/stdlib/testing.as b/stdlib/testing.affine similarity index 100% rename from stdlib/testing.as rename to stdlib/testing.affine diff --git a/stdlib/traits.as b/stdlib/traits.affine similarity index 100% rename from stdlib/traits.as rename to stdlib/traits.affine diff --git a/test/e2e/fixtures/affine_basic.as b/test/e2e/fixtures/affine_basic.affine similarity index 100% rename from test/e2e/fixtures/affine_basic.as rename to test/e2e/fixtures/affine_basic.affine diff --git a/test/e2e/fixtures/affine_violation.as b/test/e2e/fixtures/affine_violation.affine similarity index 100% rename from test/e2e/fixtures/affine_violation.as rename to test/e2e/fixtures/affine_violation.affine diff --git a/test/e2e/fixtures/arithmetic.as b/test/e2e/fixtures/arithmetic.affine similarity index 100% rename from test/e2e/fixtures/arithmetic.as rename to test/e2e/fixtures/arithmetic.affine diff --git a/test/e2e/fixtures/dependent_types.as b/test/e2e/fixtures/dependent_types.affine similarity index 100% rename from test/e2e/fixtures/dependent_types.as rename to test/e2e/fixtures/dependent_types.affine diff --git a/test/e2e/fixtures/effects.as b/test/e2e/fixtures/effects.affine similarity index 100% rename from test/e2e/fixtures/effects.as rename to test/e2e/fixtures/effects.affine diff --git a/test/e2e/fixtures/erased_violation.as b/test/e2e/fixtures/erased_violation.affine similarity index 100% rename from test/e2e/fixtures/erased_violation.as rename to test/e2e/fixtures/erased_violation.affine diff --git a/test/e2e/fixtures/full_pipeline.as b/test/e2e/fixtures/full_pipeline.affine similarity index 100% rename from test/e2e/fixtures/full_pipeline.as rename to test/e2e/fixtures/full_pipeline.affine diff --git a/test/e2e/fixtures/interp_simple.as b/test/e2e/fixtures/interp_simple.affine similarity index 100% rename from test/e2e/fixtures/interp_simple.as rename to test/e2e/fixtures/interp_simple.affine diff --git a/test/e2e/fixtures/julia_simple.as b/test/e2e/fixtures/julia_simple.affine similarity index 100% rename from test/e2e/fixtures/julia_simple.as rename to test/e2e/fixtures/julia_simple.affine diff --git a/test/e2e/fixtures/lambda.as b/test/e2e/fixtures/lambda.affine similarity index 100% rename from test/e2e/fixtures/lambda.as rename to test/e2e/fixtures/lambda.affine diff --git a/test/e2e/fixtures/ownership.as b/test/e2e/fixtures/ownership.affine similarity index 100% rename from test/e2e/fixtures/ownership.as rename to test/e2e/fixtures/ownership.affine diff --git a/test/e2e/fixtures/pattern_match.as b/test/e2e/fixtures/pattern_match.affine similarity index 100% rename from test/e2e/fixtures/pattern_match.as rename to test/e2e/fixtures/pattern_match.affine diff --git a/test/e2e/fixtures/refinement_types.as b/test/e2e/fixtures/refinement_types.affine similarity index 100% rename from test/e2e/fixtures/refinement_types.as rename to test/e2e/fixtures/refinement_types.affine diff --git a/test/e2e/fixtures/row_polymorphism.as b/test/e2e/fixtures/row_polymorphism.affine similarity index 100% rename from test/e2e/fixtures/row_polymorphism.as rename to test/e2e/fixtures/row_polymorphism.affine diff --git a/test/e2e/fixtures/traits.as b/test/e2e/fixtures/traits.affine similarity index 100% rename from test/e2e/fixtures/traits.as rename to test/e2e/fixtures/traits.affine diff --git a/test/e2e/fixtures/type_decls.as b/test/e2e/fixtures/type_decls.affine similarity index 100% rename from test/e2e/fixtures/type_decls.as rename to test/e2e/fixtures/type_decls.affine diff --git a/test/e2e/fixtures/wasm_simple.as b/test/e2e/fixtures/wasm_simple.affine similarity index 100% rename from test/e2e/fixtures/wasm_simple.as rename to test/e2e/fixtures/wasm_simple.affine diff --git a/test/golden/binary_ops.as b/test/golden/binary_ops.affine similarity index 100% rename from test/golden/binary_ops.as rename to test/golden/binary_ops.affine diff --git a/test/golden/effects.as b/test/golden/effects.affine similarity index 100% rename from test/golden/effects.as rename to test/golden/effects.affine diff --git a/test/golden/functions.as b/test/golden/functions.affine similarity index 100% rename from test/golden/functions.as rename to test/golden/functions.affine diff --git a/test/golden/hello.as b/test/golden/hello.affine similarity index 100% rename from test/golden/hello.as rename to test/golden/hello.affine diff --git a/test/golden/imports.as b/test/golden/imports.affine similarity index 100% rename from test/golden/imports.as rename to test/golden/imports.affine diff --git a/test/golden/lambda.as b/test/golden/lambda.affine similarity index 100% rename from test/golden/lambda.as rename to test/golden/lambda.affine diff --git a/test/golden/literals.as b/test/golden/literals.affine similarity index 100% rename from test/golden/literals.as rename to test/golden/literals.affine diff --git a/test/golden/ownership.as b/test/golden/ownership.affine similarity index 100% rename from test/golden/ownership.as rename to test/golden/ownership.affine diff --git a/test/golden/patterns.as b/test/golden/patterns.affine similarity index 100% rename from test/golden/patterns.as rename to test/golden/patterns.affine diff --git a/test/golden/rows.as b/test/golden/rows.affine similarity index 100% rename from test/golden/rows.as rename to test/golden/rows.affine diff --git a/test/golden/traits.as b/test/golden/traits.affine similarity index 100% rename from test/golden/traits.as rename to test/golden/traits.affine diff --git a/test/golden/types.as b/test/golden/types.affine similarity index 100% rename from test/golden/types.as rename to test/golden/types.affine diff --git a/test/test_e2e.ml b/test/test_e2e.ml index 367c017..652a861 100644 --- a/test/test_e2e.ml +++ b/test/test_e2e.ml @@ -155,33 +155,33 @@ let run_interp_pipeline path = *) let test_parse_arithmetic () = - match parse_fixture (fixture "arithmetic.as") with + match parse_fixture (fixture "arithmetic.affine") with | Error msg -> Alcotest.fail msg | Ok prog -> Alcotest.(check int) "declaration count" 6 (List.length prog.prog_decls) let test_parse_affine_basic () = - match parse_fixture (fixture "affine_basic.as") with + match parse_fixture (fixture "affine_basic.affine") with | Error msg -> Alcotest.fail msg | Ok prog -> Alcotest.(check int) "declaration count" 4 (List.length prog.prog_decls) let test_parse_dependent_types () = - match parse_fixture (fixture "dependent_types.as") with + match parse_fixture (fixture "dependent_types.affine") with | Error msg -> Alcotest.fail msg | Ok prog -> (* 1 type decl + 3 functions *) Alcotest.(check int) "declaration count" 4 (List.length prog.prog_decls) let test_parse_refinement_types () = - match parse_fixture (fixture "refinement_types.as") with + match parse_fixture (fixture "refinement_types.affine") with | Error msg -> Alcotest.fail msg | Ok prog -> Alcotest.(check bool) "has declarations" true (List.length prog.prog_decls > 0) let test_parse_traits () = - match parse_fixture (fixture "traits.as") with + match parse_fixture (fixture "traits.affine") with | Error msg -> Alcotest.fail msg | Ok prog -> (* Count trait decls, impls, struct, enum, and functions *) @@ -195,7 +195,7 @@ let test_parse_traits () = Alcotest.(check bool) "has impls" true has_impl let test_parse_effects () = - match parse_fixture (fixture "effects.as") with + match parse_fixture (fixture "effects.affine") with | Error msg -> Alcotest.fail msg | Ok prog -> let has_effect = List.exists (fun d -> @@ -204,27 +204,27 @@ let test_parse_effects () = Alcotest.(check bool) "has effects" true has_effect let test_parse_ownership () = - match parse_fixture (fixture "ownership.as") with + match parse_fixture (fixture "ownership.affine") with | Error msg -> Alcotest.fail msg | Ok prog -> Alcotest.(check bool) "has declarations" true (List.length prog.prog_decls > 0) let test_parse_row_polymorphism () = - match parse_fixture (fixture "row_polymorphism.as") with + match parse_fixture (fixture "row_polymorphism.affine") with | Error msg -> Alcotest.fail msg | Ok prog -> Alcotest.(check int) "declaration count" 3 (List.length prog.prog_decls) let test_parse_pattern_match () = - match parse_fixture (fixture "pattern_match.as") with + match parse_fixture (fixture "pattern_match.affine") with | Error msg -> Alcotest.fail msg | Ok prog -> Alcotest.(check bool) "has declarations" true (List.length prog.prog_decls > 0) let test_parse_type_decls () = - match parse_fixture (fixture "type_decls.as") with + match parse_fixture (fixture "type_decls.affine") with | Error msg -> Alcotest.fail msg | Ok prog -> let has_type = List.exists (fun d -> @@ -233,14 +233,14 @@ let test_parse_type_decls () = Alcotest.(check bool) "has type decls" true has_type let test_parse_lambda () = - match parse_fixture (fixture "lambda.as") with + match parse_fixture (fixture "lambda.affine") with | Error msg -> Alcotest.fail msg | Ok prog -> Alcotest.(check bool) "has declarations" true (List.length prog.prog_decls > 0) let test_parse_full_pipeline () = - match parse_fixture (fixture "full_pipeline.as") with + match parse_fixture (fixture "full_pipeline.affine") with | Error msg -> Alcotest.fail msg | Ok prog -> (* struct Vec2, enum Shape, 4 functions + main *) @@ -271,7 +271,7 @@ let parse_tests = [ *) let test_resolve_arithmetic () = - match parse_fixture (fixture "arithmetic.as") with + match parse_fixture (fixture "arithmetic.affine") with | Error msg -> Alcotest.fail msg | Ok prog -> match resolve_program prog with @@ -282,7 +282,7 @@ let test_resolve_arithmetic () = (Symbol.lookup ctx.symbols "add" <> None) let test_resolve_traits () = - match parse_fixture (fixture "traits.as") with + match parse_fixture (fixture "traits.affine") with | Error msg -> Alcotest.fail msg | Ok prog -> match resolve_program prog with @@ -292,7 +292,7 @@ let test_resolve_traits () = () let test_resolve_effects () = - match parse_fixture (fixture "effects.as") with + match parse_fixture (fixture "effects.affine") with | Error msg -> Alcotest.fail msg | Ok prog -> match resolve_program prog with @@ -300,7 +300,7 @@ let test_resolve_effects () = | Ok (_ctx, _) -> () let test_resolve_ownership () = - match parse_fixture (fixture "ownership.as") with + match parse_fixture (fixture "ownership.affine") with | Error msg -> Alcotest.fail msg | Ok prog -> match resolve_program prog with @@ -308,7 +308,7 @@ let test_resolve_ownership () = | Ok (_ctx, _) -> () let test_resolve_type_decls () = - match parse_fixture (fixture "type_decls.as") with + match parse_fixture (fixture "type_decls.affine") with | Error msg -> Alcotest.fail msg | Ok prog -> match resolve_program prog with @@ -319,7 +319,7 @@ let test_resolve_type_decls () = (Symbol.lookup ctx.symbols "Point" <> None) let test_resolve_full_pipeline () = - match parse_fixture (fixture "full_pipeline.as") with + match parse_fixture (fixture "full_pipeline.affine") with | Error msg -> Alcotest.fail msg | Ok prog -> match resolve_program prog with @@ -350,27 +350,27 @@ let resolve_tests = [ *) let test_typecheck_arithmetic () = - match run_frontend (fixture "arithmetic.as") with + match run_frontend (fixture "arithmetic.affine") with | Error msg -> Alcotest.fail msg | Ok _ -> () let test_typecheck_traits () = - match run_frontend (fixture "traits.as") with + match run_frontend (fixture "traits.affine") with | Error msg -> Alcotest.fail msg | Ok _ -> () let test_typecheck_effects () = - match run_frontend (fixture "effects.as") with + match run_frontend (fixture "effects.affine") with | Error msg -> Alcotest.fail msg | Ok _ -> () let test_typecheck_ownership () = - match run_frontend (fixture "ownership.as") with + match run_frontend (fixture "ownership.affine") with | Error msg -> Alcotest.fail msg | Ok _ -> () let test_typecheck_full_pipeline () = - match run_frontend (fixture "full_pipeline.as") with + match run_frontend (fixture "full_pipeline.affine") with | Error msg -> Alcotest.fail msg | Ok _ -> () @@ -393,7 +393,7 @@ let typecheck_tests = [ *) let test_quantity_affine_valid () = - match parse_fixture (fixture "affine_basic.as") with + match parse_fixture (fixture "affine_basic.affine") with | Error msg -> Alcotest.fail msg | Ok prog -> match resolve_program prog with @@ -404,7 +404,7 @@ let test_quantity_affine_valid () = | Error msg -> Alcotest.fail msg let test_quantity_affine_violation () = - match parse_fixture (fixture "affine_violation.as") with + match parse_fixture (fixture "affine_violation.affine") with | Error msg -> Alcotest.fail msg | Ok prog -> match resolve_program prog with @@ -420,7 +420,7 @@ let test_quantity_affine_violation () = true (String.length msg > 0) let test_quantity_erased_violation () = - match parse_fixture (fixture "erased_violation.as") with + match parse_fixture (fixture "erased_violation.affine") with | Error msg -> Alcotest.fail msg | Ok prog -> match resolve_program prog with @@ -453,12 +453,12 @@ let quantity_tests = [ *) let test_wasm_arithmetic () = - match run_wasm_pipeline (fixture "arithmetic.as") with + match run_wasm_pipeline (fixture "arithmetic.affine") with | Error msg -> Alcotest.fail msg | Ok _wasm_mod -> () let test_wasm_simple () = - match run_wasm_pipeline (fixture "wasm_simple.as") with + match run_wasm_pipeline (fixture "wasm_simple.affine") with | Error msg -> Alcotest.fail msg | Ok wasm_mod -> (* Verify the module has functions *) @@ -469,7 +469,7 @@ let test_wasm_simple () = (List.length wasm_mod.Wasm.exports > 0) let test_wasm_write_binary () = - match run_wasm_pipeline (fixture "wasm_simple.as") with + match run_wasm_pipeline (fixture "wasm_simple.affine") with | Error msg -> Alcotest.fail msg | Ok wasm_mod -> with_temp_file ".wasm" (fun tmp_path -> @@ -489,7 +489,7 @@ let test_wasm_write_binary () = ) let test_wasm_full_pipeline () = - match run_wasm_pipeline (fixture "full_pipeline.as") with + match run_wasm_pipeline (fixture "full_pipeline.affine") with | Error msg -> Alcotest.fail msg | Ok wasm_mod -> Alcotest.(check bool) "has functions" true @@ -502,7 +502,7 @@ let test_wasm_full_pipeline () = ) let test_wasm_lambda () = - match run_wasm_pipeline (fixture "lambda.as") with + match run_wasm_pipeline (fixture "lambda.affine") with | Error msg -> Alcotest.fail msg | Ok _wasm_mod -> () @@ -525,7 +525,7 @@ let wasm_tests = [ *) let test_julia_arithmetic () = - match run_julia_pipeline (fixture "arithmetic.as") with + match run_julia_pipeline (fixture "arithmetic.affine") with | Error msg -> Alcotest.fail msg | Ok code -> (* Julia code should contain function definitions *) @@ -533,7 +533,7 @@ let test_julia_arithmetic () = (String.length code > 0) let test_julia_simple () = - match run_julia_pipeline (fixture "julia_simple.as") with + match run_julia_pipeline (fixture "julia_simple.affine") with | Error msg -> Alcotest.fail msg | Ok code -> Alcotest.(check bool) "non-empty output" true @@ -545,7 +545,7 @@ let test_julia_simple () = Alcotest.(check bool) "has function keyword" true has_function let test_julia_type_mapping () = - match run_julia_pipeline (fixture "julia_simple.as") with + match run_julia_pipeline (fixture "julia_simple.affine") with | Error msg -> Alcotest.fail msg | Ok code -> (* Check type mapping: Int -> Int64 *) @@ -555,7 +555,7 @@ let test_julia_type_mapping () = Alcotest.(check bool) "maps Int to Int64" true has_int64 let test_julia_write_output () = - match run_julia_pipeline (fixture "julia_simple.as") with + match run_julia_pipeline (fixture "julia_simple.affine") with | Error msg -> Alcotest.fail msg | Ok code -> with_temp_file ".jl" (fun tmp_path -> @@ -568,7 +568,7 @@ let test_julia_write_output () = ) let test_julia_full_pipeline () = - match run_julia_pipeline (fixture "full_pipeline.as") with + match run_julia_pipeline (fixture "full_pipeline.affine") with | Error msg -> Alcotest.fail msg | Ok code -> Alcotest.(check bool) "non-empty output" true @@ -592,22 +592,22 @@ let julia_tests = [ *) let test_interp_simple () = - match run_interp_pipeline (fixture "interp_simple.as") with + match run_interp_pipeline (fixture "interp_simple.affine") with | Error msg -> Alcotest.fail msg | Ok _env -> () let test_interp_arithmetic () = - match run_interp_pipeline (fixture "arithmetic.as") with + match run_interp_pipeline (fixture "arithmetic.affine") with | Error msg -> Alcotest.fail msg | Ok _env -> () let test_interp_lambda () = - match run_interp_pipeline (fixture "lambda.as") with + match run_interp_pipeline (fixture "lambda.affine") with | Error msg -> Alcotest.fail msg | Ok _env -> () let test_interp_full_pipeline () = - match run_interp_pipeline (fixture "full_pipeline.as") with + match run_interp_pipeline (fixture "full_pipeline.affine") with | Error msg -> Alcotest.fail msg | Ok _env -> () @@ -628,7 +628,7 @@ let interp_tests = [ *) let test_opt_constant_folding () = - match parse_fixture (fixture "arithmetic.as") with + match parse_fixture (fixture "arithmetic.affine") with | Error msg -> Alcotest.fail msg | Ok prog -> let optimized = Opt.fold_constants_program prog in @@ -638,7 +638,7 @@ let test_opt_constant_folding () = (List.length optimized.prog_decls) let test_opt_preserves_semantics () = - match parse_fixture (fixture "interp_simple.as") with + match parse_fixture (fixture "interp_simple.affine") with | Error msg -> Alcotest.fail msg | Ok prog -> let optimized = Opt.fold_constants_program prog in @@ -666,7 +666,7 @@ let optimizer_tests = [ *) let test_full_pipeline_all_stages () = - let path = fixture "full_pipeline.as" in + let path = fixture "full_pipeline.affine" in (* Stage 1: Parse *) let prog = match parse_fixture path with @@ -723,7 +723,7 @@ let test_full_pipeline_all_stages () = | Ok _env -> ()) let test_full_pipeline_wasm_roundtrip () = - let path = fixture "wasm_simple.as" in + let path = fixture "wasm_simple.affine" in match run_wasm_pipeline path with | Error msg -> Alcotest.fail msg | Ok wasm_mod -> @@ -737,7 +737,7 @@ let test_full_pipeline_wasm_roundtrip () = (size > 8 && size < 1_000_000)) let test_full_pipeline_julia_roundtrip () = - let path = fixture "julia_simple.as" in + let path = fixture "julia_simple.affine" in match run_julia_pipeline path with | Error msg -> Alcotest.fail msg | Ok code -> diff --git a/test/test_golden.ml b/test/test_golden.ml index 9997c04..36425b8 100644 --- a/test/test_golden.ml +++ b/test/test_golden.ml @@ -61,14 +61,14 @@ let run_golden_test ~source_path ~expected_path () = Alcotest.fail "AST output does not match expected" end -(** Create a test case from a .as file *) +(** Create a test case from a .affine file *) let test_case_of_file filename = let base = Filename.chop_extension filename in let source_path = Filename.concat golden_dir filename in let expected_path = Filename.concat golden_dir (base ^ ".expected") in Alcotest.test_case base `Quick (run_golden_test ~source_path ~expected_path) -(** Discover all .as files in golden directory *) +(** Discover all .affine files in golden directory *) let discover_tests () = if not (Sys.file_exists golden_dir) then [] @@ -76,7 +76,7 @@ let discover_tests () = let files = Sys.readdir golden_dir in files |> Array.to_list - |> List.filter (fun f -> Filename.check_suffix f ".as") + |> List.filter (fun f -> Filename.check_suffix f ".affine") |> List.sort String.compare |> List.map test_case_of_file @@ -100,7 +100,7 @@ let discover_example_tests () = let files = Sys.readdir examples_dir in files |> Array.to_list - |> List.filter (fun f -> Filename.check_suffix f ".as") + |> List.filter (fun f -> Filename.check_suffix f ".affine") |> List.sort String.compare |> List.map (fun f -> let base = Filename.chop_extension f in diff --git a/test_if.as b/test_if.affine similarity index 100% rename from test_if.as rename to test_if.affine diff --git a/test_min.as b/test_min.affine similarity index 100% rename from test_min.as rename to test_min.affine diff --git a/test_simple.as b/test_simple.affine similarity index 100% rename from test_simple.as rename to test_simple.affine diff --git a/test_spread.as b/test_spread.affine similarity index 100% rename from test_spread.as rename to test_spread.affine diff --git a/test_spread2.as b/test_spread2.affine similarity index 100% rename from test_spread2.as rename to test_spread2.affine diff --git a/test_spread3.as b/test_spread3.affine similarity index 100% rename from test_spread3.as rename to test_spread3.affine diff --git a/tests/borrow/minimal.as b/tests/borrow/minimal.affine similarity index 100% rename from tests/borrow/minimal.as rename to tests/borrow/minimal.affine diff --git a/tests/borrow/move_test.as b/tests/borrow/move_test.affine similarity index 100% rename from tests/borrow/move_test.as rename to tests/borrow/move_test.affine diff --git a/tests/borrow/simple.as b/tests/borrow/simple.affine similarity index 100% rename from tests/borrow/simple.as rename to tests/borrow/simple.affine diff --git a/tests/borrow/simple_move_test.as b/tests/borrow/simple_move_test.affine similarity index 100% rename from tests/borrow/simple_move_test.as rename to tests/borrow/simple_move_test.affine diff --git a/tests/borrow/simple_own.as b/tests/borrow/simple_own.affine similarity index 100% rename from tests/borrow/simple_own.as rename to tests/borrow/simple_own.affine diff --git a/tests/borrow/test_immutable_assign_error.as b/tests/borrow/test_immutable_assign_error.affine similarity index 100% rename from tests/borrow/test_immutable_assign_error.as rename to tests/borrow/test_immutable_assign_error.affine diff --git a/tests/borrow/test_move.as b/tests/borrow/test_move.affine similarity index 100% rename from tests/borrow/test_move.as rename to tests/borrow/test_move.affine diff --git a/tests/borrow/test_move_after_use.as b/tests/borrow/test_move_after_use.affine similarity index 100% rename from tests/borrow/test_move_after_use.as rename to tests/borrow/test_move_after_use.affine diff --git a/tests/borrow/test_mutable_borrow.as b/tests/borrow/test_mutable_borrow.affine similarity index 100% rename from tests/borrow/test_mutable_borrow.as rename to tests/borrow/test_mutable_borrow.affine diff --git a/tests/borrow/test_ref_borrow.as b/tests/borrow/test_ref_borrow.affine similarity index 100% rename from tests/borrow/test_ref_borrow.as rename to tests/borrow/test_ref_borrow.affine diff --git a/tests/borrow/use_after_move.as b/tests/borrow/use_after_move.affine similarity index 100% rename from tests/borrow/use_after_move.as rename to tests/borrow/use_after_move.affine diff --git a/tests/borrow/valid_move.as b/tests/borrow/valid_move.affine similarity index 100% rename from tests/borrow/valid_move.as rename to tests/borrow/valid_move.affine diff --git a/tests/codegen/simple_arithmetic.as b/tests/codegen/simple_arithmetic.affine similarity index 100% rename from tests/codegen/simple_arithmetic.as rename to tests/codegen/simple_arithmetic.affine diff --git a/tests/codegen/test_array_bounds.as b/tests/codegen/test_array_bounds.affine similarity index 100% rename from tests/codegen/test_array_bounds.as rename to tests/codegen/test_array_bounds.affine diff --git a/tests/codegen/test_array_empty.as b/tests/codegen/test_array_empty.affine similarity index 100% rename from tests/codegen/test_array_empty.as rename to tests/codegen/test_array_empty.affine diff --git a/tests/codegen/test_array_simple.as b/tests/codegen/test_array_simple.affine similarity index 100% rename from tests/codegen/test_array_simple.as rename to tests/codegen/test_array_simple.affine diff --git a/tests/codegen/test_array_single.as b/tests/codegen/test_array_single.affine similarity index 100% rename from tests/codegen/test_array_single.as rename to tests/codegen/test_array_single.affine diff --git a/tests/codegen/test_array_sum.as b/tests/codegen/test_array_sum.affine similarity index 100% rename from tests/codegen/test_array_sum.as rename to tests/codegen/test_array_sum.affine diff --git a/tests/codegen/test_assign_compound.as b/tests/codegen/test_assign_compound.affine similarity index 100% rename from tests/codegen/test_assign_compound.as rename to tests/codegen/test_assign_compound.affine diff --git a/tests/codegen/test_assign_simple.as b/tests/codegen/test_assign_simple.affine similarity index 100% rename from tests/codegen/test_assign_simple.as rename to tests/codegen/test_assign_simple.affine diff --git a/tests/codegen/test_closure_capture.as b/tests/codegen/test_closure_capture.affine similarity index 100% rename from tests/codegen/test_closure_capture.as rename to tests/codegen/test_closure_capture.affine diff --git a/tests/codegen/test_closure_debug.as b/tests/codegen/test_closure_debug.affine similarity index 100% rename from tests/codegen/test_closure_debug.as rename to tests/codegen/test_closure_debug.affine diff --git a/tests/codegen/test_closure_multi_capture.as b/tests/codegen/test_closure_multi_capture.affine similarity index 100% rename from tests/codegen/test_closure_multi_capture.as rename to tests/codegen/test_closure_multi_capture.affine diff --git a/tests/codegen/test_enum_pattern.as b/tests/codegen/test_enum_pattern.affine similarity index 100% rename from tests/codegen/test_enum_pattern.as rename to tests/codegen/test_enum_pattern.affine diff --git a/tests/codegen/test_for_loop.as b/tests/codegen/test_for_loop.affine similarity index 100% rename from tests/codegen/test_for_loop.as rename to tests/codegen/test_for_loop.affine diff --git a/tests/codegen/test_function_call.as b/tests/codegen/test_function_call.affine similarity index 100% rename from tests/codegen/test_function_call.as rename to tests/codegen/test_function_call.affine diff --git a/tests/codegen/test_lambda_call.as b/tests/codegen/test_lambda_call.affine similarity index 100% rename from tests/codegen/test_lambda_call.as rename to tests/codegen/test_lambda_call.affine diff --git a/tests/codegen/test_lambda_multi_param.as b/tests/codegen/test_lambda_multi_param.affine similarity index 100% rename from tests/codegen/test_lambda_multi_param.as rename to tests/codegen/test_lambda_multi_param.affine diff --git a/tests/codegen/test_match_literal.as b/tests/codegen/test_match_literal.affine similarity index 100% rename from tests/codegen/test_match_literal.as rename to tests/codegen/test_match_literal.affine diff --git a/tests/codegen/test_match_mixed.as b/tests/codegen/test_match_mixed.affine similarity index 100% rename from tests/codegen/test_match_mixed.as rename to tests/codegen/test_match_mixed.affine diff --git a/tests/codegen/test_match_simple.as b/tests/codegen/test_match_simple.affine similarity index 100% rename from tests/codegen/test_match_simple.as rename to tests/codegen/test_match_simple.affine diff --git a/tests/codegen/test_multiple_calls.as b/tests/codegen/test_multiple_calls.affine similarity index 100% rename from tests/codegen/test_multiple_calls.as rename to tests/codegen/test_multiple_calls.affine diff --git a/tests/codegen/test_multiple_lambdas.as b/tests/codegen/test_multiple_lambdas.affine similarity index 100% rename from tests/codegen/test_multiple_lambdas.as rename to tests/codegen/test_multiple_lambdas.affine diff --git a/tests/codegen/test_opt_constant_fold.as b/tests/codegen/test_opt_constant_fold.affine similarity index 100% rename from tests/codegen/test_opt_constant_fold.as rename to tests/codegen/test_opt_constant_fold.affine diff --git a/tests/codegen/test_opt_if_fold.as b/tests/codegen/test_opt_if_fold.affine similarity index 100% rename from tests/codegen/test_opt_if_fold.as rename to tests/codegen/test_opt_if_fold.affine diff --git a/tests/codegen/test_pattern_as.as b/tests/codegen/test_pattern_as.affine similarity index 100% rename from tests/codegen/test_pattern_as.as rename to tests/codegen/test_pattern_as.affine diff --git a/tests/codegen/test_pattern_or.as b/tests/codegen/test_pattern_or.affine similarity index 100% rename from tests/codegen/test_pattern_or.as rename to tests/codegen/test_pattern_or.affine diff --git a/tests/codegen/test_pattern_record.as b/tests/codegen/test_pattern_record.affine similarity index 100% rename from tests/codegen/test_pattern_record.as rename to tests/codegen/test_pattern_record.affine diff --git a/tests/codegen/test_pattern_tuple.as b/tests/codegen/test_pattern_tuple.affine similarity index 100% rename from tests/codegen/test_pattern_tuple.as rename to tests/codegen/test_pattern_tuple.affine diff --git a/tests/codegen/test_record_multi_field.as b/tests/codegen/test_record_multi_field.affine similarity index 100% rename from tests/codegen/test_record_multi_field.as rename to tests/codegen/test_record_multi_field.affine diff --git a/tests/codegen/test_record_multiple.as b/tests/codegen/test_record_multiple.affine similarity index 100% rename from tests/codegen/test_record_multiple.as rename to tests/codegen/test_record_multiple.affine diff --git a/tests/codegen/test_record_simple.as b/tests/codegen/test_record_simple.affine similarity index 100% rename from tests/codegen/test_record_simple.as rename to tests/codegen/test_record_simple.affine diff --git a/tests/codegen/test_recursive_call.as b/tests/codegen/test_recursive_call.affine similarity index 100% rename from tests/codegen/test_recursive_call.as rename to tests/codegen/test_recursive_call.affine diff --git a/tests/codegen/test_ref_deref_chain.as b/tests/codegen/test_ref_deref_chain.affine similarity index 100% rename from tests/codegen/test_ref_deref_chain.as rename to tests/codegen/test_ref_deref_chain.affine diff --git a/tests/codegen/test_ref_deref_simple.as b/tests/codegen/test_ref_deref_simple.affine similarity index 100% rename from tests/codegen/test_ref_deref_simple.as rename to tests/codegen/test_ref_deref_simple.affine diff --git a/tests/codegen/test_simple_lambda.as b/tests/codegen/test_simple_lambda.affine similarity index 100% rename from tests/codegen/test_simple_lambda.as rename to tests/codegen/test_simple_lambda.affine diff --git a/tests/codegen/test_string_diff.as b/tests/codegen/test_string_diff.affine similarity index 100% rename from tests/codegen/test_string_diff.as rename to tests/codegen/test_string_diff.affine diff --git a/tests/codegen/test_string_eq.as b/tests/codegen/test_string_eq.affine similarity index 100% rename from tests/codegen/test_string_eq.as rename to tests/codegen/test_string_eq.affine diff --git a/tests/codegen/test_string_multi.as b/tests/codegen/test_string_multi.affine similarity index 100% rename from tests/codegen/test_string_multi.as rename to tests/codegen/test_string_multi.affine diff --git a/tests/codegen/test_string_ptr.as b/tests/codegen/test_string_ptr.affine similarity index 100% rename from tests/codegen/test_string_ptr.as rename to tests/codegen/test_string_ptr.affine diff --git a/tests/codegen/test_string_simple.as b/tests/codegen/test_string_simple.affine similarity index 100% rename from tests/codegen/test_string_simple.as rename to tests/codegen/test_string_simple.affine diff --git a/tests/codegen/test_tuple_five.as b/tests/codegen/test_tuple_five.affine similarity index 100% rename from tests/codegen/test_tuple_five.as rename to tests/codegen/test_tuple_five.affine diff --git a/tests/codegen/test_tuple_nested.as b/tests/codegen/test_tuple_nested.affine similarity index 100% rename from tests/codegen/test_tuple_nested.as rename to tests/codegen/test_tuple_nested.affine diff --git a/tests/codegen/test_tuple_pair.as b/tests/codegen/test_tuple_pair.affine similarity index 100% rename from tests/codegen/test_tuple_pair.as rename to tests/codegen/test_tuple_pair.affine diff --git a/tests/codegen/test_tuple_record_array.as b/tests/codegen/test_tuple_record_array.affine similarity index 100% rename from tests/codegen/test_tuple_record_array.as rename to tests/codegen/test_tuple_record_array.affine diff --git a/tests/codegen/test_tuple_simple.as b/tests/codegen/test_tuple_simple.affine similarity index 100% rename from tests/codegen/test_tuple_simple.as rename to tests/codegen/test_tuple_simple.affine diff --git a/tests/codegen/test_variant_as_int.as b/tests/codegen/test_variant_as_int.affine similarity index 100% rename from tests/codegen/test_variant_as_int.as rename to tests/codegen/test_variant_as_int.affine diff --git a/tests/codegen/test_variant_match_arg.as b/tests/codegen/test_variant_match_arg.affine similarity index 100% rename from tests/codegen/test_variant_match_arg.as rename to tests/codegen/test_variant_match_arg.affine diff --git a/tests/codegen/test_variant_match_none.as b/tests/codegen/test_variant_match_none.affine similarity index 100% rename from tests/codegen/test_variant_match_none.as rename to tests/codegen/test_variant_match_none.affine diff --git a/tests/codegen/test_variant_multi_arg.as b/tests/codegen/test_variant_multi_arg.affine similarity index 100% rename from tests/codegen/test_variant_multi_arg.as rename to tests/codegen/test_variant_multi_arg.affine diff --git a/tests/codegen/test_variant_with_arg.as b/tests/codegen/test_variant_with_arg.affine similarity index 100% rename from tests/codegen/test_variant_with_arg.as rename to tests/codegen/test_variant_with_arg.affine diff --git a/tests/codegen/test_while_loop.as b/tests/codegen/test_while_loop.affine similarity index 100% rename from tests/codegen/test_while_loop.as rename to tests/codegen/test_while_loop.affine diff --git a/tests/conformance/README.md b/tests/conformance/README.md index c33b3bf..5b8179c 100644 --- a/tests/conformance/README.md +++ b/tests/conformance/README.md @@ -20,13 +20,13 @@ aLib is NOT a code library - it's a way to specify minimal overlap between diver ``` tests/conformance/ ├── arithmetic/ # Arithmetic operation tests -│ └── add.as +│ └── add.affine ├── collection/ # Collection operation tests -│ ├── map.as -│ ├── filter.as -│ ├── fold.as -│ └── contains.as -├── run_all.as # Master test runner +│ ├── map.affine +│ ├── filter.affine +│ ├── fold.affine +│ └── contains.affine +├── run_all.affine # Master test runner └── README.md # This file ``` @@ -34,12 +34,12 @@ tests/conformance/ ### Run all conformance tests: ```bash -affinescript tests/conformance/run_all.as +affinescript tests/conformance/run_all.affine ``` ### Run specific category: ```bash -affinescript tests/conformance/collection/map.as +affinescript tests/conformance/collection/map.affine ``` ### Expected Output: @@ -112,7 +112,7 @@ AffineScript's conformance tests respect affine type constraints: 2. Extract test vectors from YAML section 3. Create `tests/conformance//.as` 4. Translate aLib function expressions to AffineScript syntax -5. Add test to `run_all.as` +5. Add test to `run_all.affine` Example: ```affinescript diff --git a/tests/conformance/arithmetic/add.as b/tests/conformance/arithmetic/add.affine similarity index 100% rename from tests/conformance/arithmetic/add.as rename to tests/conformance/arithmetic/add.affine diff --git a/tests/conformance/arithmetic/divide.as b/tests/conformance/arithmetic/divide.affine similarity index 100% rename from tests/conformance/arithmetic/divide.as rename to tests/conformance/arithmetic/divide.affine diff --git a/tests/conformance/arithmetic/modulo.as b/tests/conformance/arithmetic/modulo.affine similarity index 100% rename from tests/conformance/arithmetic/modulo.as rename to tests/conformance/arithmetic/modulo.affine diff --git a/tests/conformance/arithmetic/multiply.as b/tests/conformance/arithmetic/multiply.affine similarity index 100% rename from tests/conformance/arithmetic/multiply.as rename to tests/conformance/arithmetic/multiply.affine diff --git a/tests/conformance/arithmetic/subtract.as b/tests/conformance/arithmetic/subtract.affine similarity index 100% rename from tests/conformance/arithmetic/subtract.as rename to tests/conformance/arithmetic/subtract.affine diff --git a/tests/conformance/collection/contains.as b/tests/conformance/collection/contains.affine similarity index 100% rename from tests/conformance/collection/contains.as rename to tests/conformance/collection/contains.affine diff --git a/tests/conformance/collection/filter.as b/tests/conformance/collection/filter.affine similarity index 100% rename from tests/conformance/collection/filter.as rename to tests/conformance/collection/filter.affine diff --git a/tests/conformance/collection/fold.as b/tests/conformance/collection/fold.affine similarity index 100% rename from tests/conformance/collection/fold.as rename to tests/conformance/collection/fold.affine diff --git a/tests/conformance/collection/map.as b/tests/conformance/collection/map.affine similarity index 100% rename from tests/conformance/collection/map.as rename to tests/conformance/collection/map.affine diff --git a/tests/conformance/comparison/equal.as b/tests/conformance/comparison/equal.affine similarity index 100% rename from tests/conformance/comparison/equal.as rename to tests/conformance/comparison/equal.affine diff --git a/tests/conformance/comparison/greater_equal.as b/tests/conformance/comparison/greater_equal.affine similarity index 100% rename from tests/conformance/comparison/greater_equal.as rename to tests/conformance/comparison/greater_equal.affine diff --git a/tests/conformance/comparison/greater_than.as b/tests/conformance/comparison/greater_than.affine similarity index 100% rename from tests/conformance/comparison/greater_than.as rename to tests/conformance/comparison/greater_than.affine diff --git a/tests/conformance/comparison/less_equal.as b/tests/conformance/comparison/less_equal.affine similarity index 100% rename from tests/conformance/comparison/less_equal.as rename to tests/conformance/comparison/less_equal.affine diff --git a/tests/conformance/comparison/less_than.as b/tests/conformance/comparison/less_than.affine similarity index 100% rename from tests/conformance/comparison/less_than.as rename to tests/conformance/comparison/less_than.affine diff --git a/tests/conformance/comparison/not_equal.as b/tests/conformance/comparison/not_equal.affine similarity index 100% rename from tests/conformance/comparison/not_equal.as rename to tests/conformance/comparison/not_equal.affine diff --git a/tests/conformance/conditional/if_then_else.as b/tests/conformance/conditional/if_then_else.affine similarity index 100% rename from tests/conformance/conditional/if_then_else.as rename to tests/conformance/conditional/if_then_else.affine diff --git a/tests/conformance/logical/and.as b/tests/conformance/logical/and.affine similarity index 100% rename from tests/conformance/logical/and.as rename to tests/conformance/logical/and.affine diff --git a/tests/conformance/logical/not.as b/tests/conformance/logical/not.affine similarity index 100% rename from tests/conformance/logical/not.as rename to tests/conformance/logical/not.affine diff --git a/tests/conformance/logical/or.as b/tests/conformance/logical/or.affine similarity index 100% rename from tests/conformance/logical/or.as rename to tests/conformance/logical/or.affine diff --git a/tests/conformance/run_all.as b/tests/conformance/run_all.affine similarity index 100% rename from tests/conformance/run_all.as rename to tests/conformance/run_all.affine diff --git a/tests/conformance/string/concat.as b/tests/conformance/string/concat.affine similarity index 100% rename from tests/conformance/string/concat.as rename to tests/conformance/string/concat.affine diff --git a/tests/conformance/string/length.as b/tests/conformance/string/length.affine similarity index 100% rename from tests/conformance/string/length.as rename to tests/conformance/string/length.affine diff --git a/tests/conformance/string/substring.as b/tests/conformance/string/substring.affine similarity index 100% rename from tests/conformance/string/substring.as rename to tests/conformance/string/substring.affine diff --git a/tests/effects/basic_effect.as b/tests/effects/basic_effect.affine similarity index 100% rename from tests/effects/basic_effect.as rename to tests/effects/basic_effect.affine diff --git a/tests/modules/test_const.as b/tests/modules/test_const.affine similarity index 100% rename from tests/modules/test_const.as rename to tests/modules/test_const.affine diff --git a/tests/modules/test_import.as b/tests/modules/test_import.affine similarity index 100% rename from tests/modules/test_import.as rename to tests/modules/test_import.affine diff --git a/tests/modules/test_import_only.as b/tests/modules/test_import_only.affine similarity index 100% rename from tests/modules/test_import_only.as rename to tests/modules/test_import_only.affine diff --git a/tests/modules/test_math_functions.as b/tests/modules/test_math_functions.affine similarity index 100% rename from tests/modules/test_math_functions.as rename to tests/modules/test_math_functions.affine diff --git a/tests/modules/test_no_import.as b/tests/modules/test_no_import.affine similarity index 100% rename from tests/modules/test_no_import.as rename to tests/modules/test_no_import.affine diff --git a/tests/modules/test_simple_import.as b/tests/modules/test_simple_import.affine similarity index 100% rename from tests/modules/test_simple_import.as rename to tests/modules/test_simple_import.affine diff --git a/tests/parser/baseline_block.as b/tests/parser/baseline_block.affine similarity index 100% rename from tests/parser/baseline_block.as rename to tests/parser/baseline_block.affine diff --git a/tests/parser/baseline_stmt.as b/tests/parser/baseline_stmt.affine similarity index 100% rename from tests/parser/baseline_stmt.as rename to tests/parser/baseline_stmt.affine diff --git a/tests/parser/unsafe_all.as b/tests/parser/unsafe_all.affine similarity index 100% rename from tests/parser/unsafe_all.as rename to tests/parser/unsafe_all.affine diff --git a/tests/parser/unsafe_empty.as b/tests/parser/unsafe_empty.affine similarity index 100% rename from tests/parser/unsafe_empty.as rename to tests/parser/unsafe_empty.affine diff --git a/tests/parser/unsafe_ops.as b/tests/parser/unsafe_ops.affine similarity index 100% rename from tests/parser/unsafe_ops.as rename to tests/parser/unsafe_ops.affine diff --git a/tests/parser/unsafe_read.as b/tests/parser/unsafe_read.affine similarity index 100% rename from tests/parser/unsafe_read.as rename to tests/parser/unsafe_read.affine diff --git a/tests/parser/unsafe_simple.as b/tests/parser/unsafe_simple.affine similarity index 100% rename from tests/parser/unsafe_simple.as rename to tests/parser/unsafe_simple.affine diff --git a/tests/parser/unsafe_stmt.as b/tests/parser/unsafe_stmt.affine similarity index 100% rename from tests/parser/unsafe_stmt.as rename to tests/parser/unsafe_stmt.affine diff --git a/tests/types/test_dependent_e2e.as b/tests/types/test_dependent_e2e.affine similarity index 100% rename from tests/types/test_dependent_e2e.as rename to tests/types/test_dependent_e2e.affine diff --git a/tests/types/test_dependent_parsing.as b/tests/types/test_dependent_parsing.affine similarity index 100% rename from tests/types/test_dependent_parsing.as rename to tests/types/test_dependent_parsing.affine diff --git a/tests/types/test_effect_inference.as b/tests/types/test_effect_inference.affine similarity index 100% rename from tests/types/test_effect_inference.as rename to tests/types/test_effect_inference.affine diff --git a/tests/types/test_effect_lambda.as b/tests/types/test_effect_lambda.affine similarity index 100% rename from tests/types/test_effect_lambda.as rename to tests/types/test_effect_lambda.affine diff --git a/tests/types/test_effect_polymorphism.as b/tests/types/test_effect_polymorphism.affine similarity index 100% rename from tests/types/test_effect_polymorphism.as rename to tests/types/test_effect_polymorphism.affine diff --git a/tests/types/test_generic_programming.as b/tests/types/test_generic_programming.affine similarity index 100% rename from tests/types/test_generic_programming.as rename to tests/types/test_generic_programming.affine diff --git a/tests/types/test_hkt_parsing.as b/tests/types/test_hkt_parsing.affine similarity index 100% rename from tests/types/test_hkt_parsing.as rename to tests/types/test_hkt_parsing.affine diff --git a/tests/types/test_kind_checking.as b/tests/types/test_kind_checking.affine similarity index 100% rename from tests/types/test_kind_checking.as rename to tests/types/test_kind_checking.affine diff --git a/tests/types/test_lambda_scope_fix.as b/tests/types/test_lambda_scope_fix.affine similarity index 100% rename from tests/types/test_lambda_scope_fix.as rename to tests/types/test_lambda_scope_fix.affine diff --git a/tests/types/test_lambda_scope_simple.as b/tests/types/test_lambda_scope_simple.affine similarity index 100% rename from tests/types/test_lambda_scope_simple.as rename to tests/types/test_lambda_scope_simple.affine diff --git a/tests/types/test_parse_row_type.as b/tests/types/test_parse_row_type.affine similarity index 100% rename from tests/types/test_parse_row_type.as rename to tests/types/test_parse_row_type.affine diff --git a/tests/types/test_row_polymorphism.as b/tests/types/test_row_polymorphism.affine similarity index 100% rename from tests/types/test_row_polymorphism.as rename to tests/types/test_row_polymorphism.affine diff --git a/tests/types/test_row_simple.as b/tests/types/test_row_simple.affine similarity index 100% rename from tests/types/test_row_simple.as rename to tests/types/test_row_simple.affine diff --git a/tests/types/test_traits.as b/tests/types/test_traits.affine similarity index 100% rename from tests/types/test_traits.as rename to tests/types/test_traits.affine diff --git a/tools/affinescript-lsp/src/handlers.rs b/tools/affinescript-lsp/src/handlers.rs index 0f98732..8b79a8c 100644 --- a/tools/affinescript-lsp/src/handlers.rs +++ b/tools/affinescript-lsp/src/handlers.rs @@ -605,7 +605,7 @@ mod tests { /// Helper: create a file URI from a dummy path. fn test_uri() -> Url { - Url::parse("file:///tmp/test.as").unwrap() + Url::parse("file:///tmp/test.affine").unwrap() } /// Helper: empty compiler output (simulates no v2 JSON available). @@ -759,7 +759,7 @@ mod tests { "id": 1, "name": "add", "kind": "function", - "file": "/tmp/test.as", + "file": "/tmp/test.affine", "start_line": 1, "start_col": 4, "end_line": 1, @@ -769,7 +769,7 @@ mod tests { ], "references": { "1": [ - {"file": "/tmp/test.as", "start_line": 5, "start_col": 10, "end_line": 5, "end_col": 13} + {"file": "/tmp/test.affine", "start_line": 5, "start_col": 10, "end_line": 5, "end_col": 13} ] } }"#; @@ -799,7 +799,7 @@ mod tests { "id": 1, "name": "add", "kind": "function", - "file": "/tmp/test.as", + "file": "/tmp/test.affine", "start_line": 1, "start_col": 4, "end_line": 1, @@ -808,8 +808,8 @@ mod tests { ], "references": { "1": [ - {"file": "/tmp/test.as", "start_line": 3, "start_col": 10, "end_line": 3, "end_col": 13}, - {"file": "/tmp/test.as", "start_line": 5, "start_col": 1, "end_line": 5, "end_col": 4} + {"file": "/tmp/test.affine", "start_line": 3, "start_col": 10, "end_line": 3, "end_col": 13}, + {"file": "/tmp/test.affine", "start_line": 5, "start_col": 1, "end_line": 5, "end_col": 4} ] } }"#; diff --git a/tools/affinescript-lsp/src/main.rs b/tools/affinescript-lsp/src/main.rs index c8d011a..777f798 100644 --- a/tools/affinescript-lsp/src/main.rs +++ b/tools/affinescript-lsp/src/main.rs @@ -73,7 +73,7 @@ impl Backend { use std::process::Stdio; // Write source to a temp file so the compiler can read it - let temp_path = std::env::temp_dir().join(format!("lsp_{}.as", uuid::Uuid::new_v4())); + let temp_path = std::env::temp_dir().join(format!("lsp_{}.affine", uuid::Uuid::new_v4())); if let Err(e) = tokio::fs::write(&temp_path, text).await { self.client .log_message(MessageType::ERROR, format!("Failed to write temp file: {}", e)) diff --git a/tools/alib_conformance_gen.jl b/tools/alib_conformance_gen.jl index dfa41e6..cb0b01f 100644 --- a/tools/alib_conformance_gen.jl +++ b/tools/alib_conformance_gen.jl @@ -115,7 +115,7 @@ fn test_alib_$(category)_$(op_name)() -> TestResult { """ # Write output file - output_file = joinpath(output_dir, "$(category)_$(op_name).as") + output_file = joinpath(output_dir, "$(category)_$(op_name).affine") mkpath(output_dir) write(output_file, test_code) diff --git a/tools/run_codegen_wasm_tests.sh b/tools/run_codegen_wasm_tests.sh index 7cccfc0..bf5afbc 100755 --- a/tools/run_codegen_wasm_tests.sh +++ b/tools/run_codegen_wasm_tests.sh @@ -17,8 +17,8 @@ fi echo "Using compiler: $COMPILER" -for src in "$TEST_DIR"/*.as; do - base="${src%.as}" +for src in "$TEST_DIR"/*.affine; do + base="${src%.affine}" wasm="$base.wasm" echo "Compiling $(basename "$src") -> $(basename "$wasm")" "${COMPILE_CMD[@]}" "$src" -o "$wasm" diff --git a/wiki/compiler/architecture.md b/wiki/compiler/architecture.md index 9725e58..9cd99a8 100644 --- a/wiki/compiler/architecture.md +++ b/wiki/compiler/architecture.md @@ -9,7 +9,7 @@ This document describes the architecture of the AffineScript compiler. │ AffineScript Compiler │ ├─────────────────────────────────────────────────────────────────────────┤ │ │ -│ Source Code (.as) │ +│ Source Code (.affine) │ │ │ │ │ ▼ │ │ ┌─────────┐ │ diff --git a/wiki/language-reference/dependent-types.md b/wiki/language-reference/dependent-types.md index d7940c6..aa19e36 100644 --- a/wiki/language-reference/dependent-types.md +++ b/wiki/language-reference/dependent-types.md @@ -452,4 +452,4 @@ Type checking dependent types is more expensive: - [Types](types.md) - Basic type system - [Refinement Types](../design/type-system.md#refinements) - Theory -- [Vectors Example](../../examples/vectors.as) - Length-indexed vectors +- [Vectors Example](../../examples/vectors.affine) - Length-indexed vectors diff --git a/wiki/language-reference/lexical.md b/wiki/language-reference/lexical.md index 8be5a37..9db74d2 100644 --- a/wiki/language-reference/lexical.md +++ b/wiki/language-reference/lexical.md @@ -452,7 +452,7 @@ Common lexer errors: ``` error[E0001]: unexpected character - --> src/main.as:1:5 + --> src/main.affine:1:5 | 1 | let @x = 5 | ^ unexpected '@' @@ -460,7 +460,7 @@ error[E0001]: unexpected character = help: identifiers cannot contain '@' error[E0002]: unterminated string literal - --> src/main.as:1:9 + --> src/main.affine:1:9 | 1 | let s = "hello | ^^^^^^ string literal not closed @@ -468,7 +468,7 @@ error[E0002]: unterminated string literal = help: add closing `"` at end of string error[E0003]: invalid escape sequence - --> src/main.as:1:13 + --> src/main.affine:1:13 | 1 | let s = "hello\q" | ^^ unknown escape sequence diff --git a/wiki/language-reference/modules.md b/wiki/language-reference/modules.md index f46c9bd..07e6e4f 100644 --- a/wiki/language-reference/modules.md +++ b/wiki/language-reference/modules.md @@ -19,9 +19,9 @@ AffineScript's module system organizes code into logical units with controlled v ### Declaring Modules ```affine -// In main.as -mod math // Looks for math.as or math/mod.as -mod utils // Looks for utils.as or utils/mod.as +// In main.affine +mod math // Looks for math.affine or math/mod.affine +mod utils // Looks for utils.affine or utils/mod.affine mod internal // Inline module definition follows mod internal { @@ -70,23 +70,23 @@ mod geometry { ``` project/ -├── main.as -├── math.as # mod math -└── utils.as # mod utils +├── main.affine +├── math.affine # mod math +└── utils.affine # mod utils ``` ### Directory Modules ``` project/ -├── main.as +├── main.affine └── math/ - ├── mod.as # mod math entry point - ├── vectors.as # mod vectors (inside math) - └── matrices.as # mod matrices (inside math) + ├── mod.affine # mod math entry point + ├── vectors.affine # mod vectors (inside math) + └── matrices.affine # mod matrices (inside math) ``` -`math/mod.as`: +`math/mod.affine`: ```affine // Declare submodules pub mod vectors @@ -101,17 +101,17 @@ pub use matrices::Mat4 ``` project/ -├── main.as +├── main.affine └── graphics/ - ├── mod.as + ├── mod.affine ├── renderer/ - │ ├── mod.as - │ ├── opengl.as - │ └── vulkan.as + │ ├── mod.affine + │ ├── opengl.affine + │ └── vulkan.affine └── primitives/ - ├── mod.as - ├── shapes.as - └── colors.as + ├── mod.affine + ├── shapes.affine + └── colors.affine ``` --- @@ -127,7 +127,7 @@ mod internal { fn private_helper() -> Int { 42 } // Private to this module } -// main.as +// main.affine internal::private_helper() // ERROR: private function ``` @@ -142,7 +142,7 @@ mod math { fn internal_helper() -> Int { 0 } // Still private } -// main.as +// main.affine math::add(1, 2) // OK ``` @@ -260,7 +260,7 @@ HashMap // Direct ### Basic Re-export ```affine -// In lib.as +// In lib.affine mod internal pub use internal::PublicType @@ -283,7 +283,7 @@ pub use prelude::* ### Creating a Prelude ```affine -// prelude.as +// prelude.affine pub use crate::types::{Result, Option, Error} pub use crate::traits::{Show, Clone, Default} pub use crate::macros::* @@ -346,7 +346,7 @@ let world_pt: GeoPoint = GeoPoint { x: 1.0, y: 2.0 } ### Facade Pattern ```affine -// lib.as - expose clean public API +// lib.affine - expose clean public API pub mod types pub mod traits pub mod error @@ -421,15 +421,15 @@ mod core { mylib/ ├── affine.toml └── src/ - ├── lib.as # Crate root - ├── types.as - ├── traits.as + ├── lib.affine # Crate root + ├── types.affine + ├── traits.affine └── utils/ - ├── mod.as - └── helpers.as + ├── mod.affine + └── helpers.affine ``` -`lib.as`: +`lib.affine`: ```affine pub mod types pub mod traits @@ -445,8 +445,8 @@ pub use traits::MainTrait myapp/ ├── affine.toml └── src/ - ├── main.as # Binary entry point - └── lib.as # Optional library part + ├── main.affine # Binary entry point + └── lib.affine # Optional library part ``` ### Mixed Crate @@ -455,8 +455,8 @@ myapp/ myproject/ ├── affine.toml └── src/ - ├── main.as # Uses lib - ├── lib.as # Library code + ├── main.affine # Uses lib + ├── lib.affine # Library code └── modules/ ``` diff --git a/wiki/stdlib/overview.md b/wiki/stdlib/overview.md index 66ac3ae..381701f 100644 --- a/wiki/stdlib/overview.md +++ b/wiki/stdlib/overview.md @@ -6,62 +6,62 @@ The AffineScript standard library provides essential types, traits, and function ``` std/ -├── prelude.as # Auto-imported basics +├── prelude.affine # Auto-imported basics ├── primitives/ # Primitive types -│ ├── int.as -│ ├── float.as -│ ├── bool.as -│ ├── char.as -│ └── string.as +│ ├── int.affine +│ ├── float.affine +│ ├── bool.affine +│ ├── char.affine +│ └── string.affine ├── collections/ # Data structures -│ ├── vec.as -│ ├── array.as -│ ├── list.as -│ ├── map.as -│ ├── set.as -│ └── deque.as +│ ├── vec.affine +│ ├── array.affine +│ ├── list.affine +│ ├── map.affine +│ ├── set.affine +│ └── deque.affine ├── core/ # Core types -│ ├── option.as -│ ├── result.as -│ ├── tuple.as -│ └── unit.as +│ ├── option.affine +│ ├── result.affine +│ ├── tuple.affine +│ └── unit.affine ├── memory/ # Memory management -│ ├── box.as -│ ├── rc.as -│ ├── arc.as -│ └── ptr.as +│ ├── box.affine +│ ├── rc.affine +│ ├── arc.affine +│ └── ptr.affine ├── traits/ # Standard traits -│ ├── eq.as -│ ├── ord.as -│ ├── hash.as -│ ├── show.as -│ ├── clone.as -│ ├── default.as -│ └── iter.as +│ ├── eq.affine +│ ├── ord.affine +│ ├── hash.affine +│ ├── show.affine +│ ├── clone.affine +│ ├── default.affine +│ └── iter.affine ├── effects/ # Standard effects -│ ├── io.as -│ ├── exn.as -│ ├── async.as -│ ├── state.as -│ └── random.as +│ ├── io.affine +│ ├── exn.affine +│ ├── async.affine +│ ├── state.affine +│ └── random.affine ├── io/ # Input/Output -│ ├── read.as -│ ├── write.as -│ ├── fs.as -│ └── net.as +│ ├── read.affine +│ ├── write.affine +│ ├── fs.affine +│ └── net.affine ├── concurrency/ # Threading -│ ├── thread.as -│ ├── sync.as -│ ├── channel.as -│ └── atomic.as +│ ├── thread.affine +│ ├── sync.affine +│ ├── channel.affine +│ └── atomic.affine ├── text/ # Text processing -│ ├── fmt.as -│ ├── regex.as -│ └── unicode.as +│ ├── fmt.affine +│ ├── regex.affine +│ └── unicode.affine └── utils/ # Utilities - ├── time.as - ├── env.as - └── debug.as + ├── time.affine + ├── env.affine + └── debug.affine ``` ## Prelude diff --git a/wiki/testing/guide.md b/wiki/testing/guide.md index 4459bf1..cdb54b4 100644 --- a/wiki/testing/guide.md +++ b/wiki/testing/guide.md @@ -41,7 +41,7 @@ fn test_string_concat() { aspm test # Run specific test file -aspm test tests/math_test.as +aspm test tests/math_test.affine # Run tests matching pattern aspm test --filter "test_add" @@ -154,7 +154,7 @@ mod tests { ### Test Modules ```affine -// In lib.as +// In lib.affine pub fn add(x: Int, y: Int) -> Int { x + y } @@ -189,22 +189,22 @@ mod tests { ``` project/ ├── src/ -│ ├── lib.as +│ ├── lib.affine │ └── math/ -│ └── mod.as +│ └── mod.affine ├── tests/ -│ ├── integration_test.as # Integration tests -│ ├── math_test.as # Module tests +│ ├── integration_test.affine # Integration tests +│ ├── math_test.affine # Module tests │ └── fixtures/ │ └── test_data.json └── benches/ - └── performance_bench.as # Benchmarks + └── performance_bench.affine # Benchmarks ``` ### Unit vs Integration Tests ```affine -// tests/unit_test.as - Unit tests for internal modules +// tests/unit_test.affine - Unit tests for internal modules use mylib::internal::parse_number #[test] @@ -212,7 +212,7 @@ fn test_parse_number() { assert_eq(parse_number("42"), Ok(42)) } -// tests/integration_test.as - Integration tests for public API +// tests/integration_test.affine - Integration tests for public API use mylib #[test] @@ -470,7 +470,7 @@ Compare output against expected files: ```ocaml let test_golden name = - let input = read_file (sprintf "tests/golden/%s.as" name) in + let input = read_file (sprintf "tests/golden/%s.affine" name) in let expected = read_file (sprintf "tests/golden/%s.expected" name) in let actual = compile_and_run input in check string name expected actual @@ -489,14 +489,14 @@ let golden_tests = [ ### End-to-End Tests ```affine -// tests/e2e_test.as +// tests/e2e_test.affine use std::process::Command #[test] fn test_compile_and_run() { // Compile let compile_result = Command::new("aspm") - .args(["build", "examples/hello.as"]) + .args(["build", "examples/hello.affine"]) .output() assert!(compile_result.status.success()) diff --git a/wiki/tooling/cli.md b/wiki/tooling/cli.md index 4fbf332..0613631 100644 --- a/wiki/tooling/cli.md +++ b/wiki/tooling/cli.md @@ -22,19 +22,19 @@ The main compiler executable: ```bash # Lex a file (output tokens) -affinescript lex +affinescript lex # Parse a file (output AST) -affinescript parse +affinescript parse # Type-check a file -affinescript check +affinescript check # Compile to WASM -affinescript compile -o output.wasm +affinescript compile -o output.wasm # Run directly -affinescript run +affinescript run ``` ### Common Options @@ -52,11 +52,11 @@ affinescript run Lexical analysis - tokenize source file: ```bash -affinescript lex src/main.as +affinescript lex src/main.affine # Output format -affinescript lex --format json src/main.as -affinescript lex --format pretty src/main.as +affinescript lex --format json src/main.affine +affinescript lex --format pretty src/main.affine ``` Example output: @@ -76,12 +76,12 @@ LBRACE @ 1:19-1:20 Parse source file to AST: ```bash -affinescript parse src/main.as +affinescript parse src/main.affine # Output options -affinescript parse --format sexp src/main.as -affinescript parse --format json src/main.as -affinescript parse --format pretty src/main.as +affinescript parse --format sexp src/main.affine +affinescript parse --format json src/main.affine +affinescript parse --format pretty src/main.affine ``` ### check @@ -89,13 +89,13 @@ affinescript parse --format pretty src/main.as Type-check without compiling: ```bash -affinescript check src/main.as +affinescript check src/main.affine # Check entire project affinescript check . # Show inferred types -affinescript check --show-types src/main.as +affinescript check --show-types src/main.affine ``` ### compile @@ -104,19 +104,19 @@ Compile to WebAssembly: ```bash # Basic compilation -affinescript compile src/main.as -o output.wasm +affinescript compile src/main.affine -o output.wasm # With optimizations -affinescript compile --release src/main.as -o output.wasm +affinescript compile --release src/main.affine -o output.wasm # Emit text format -affinescript compile --emit wat src/main.as -o output.wat +affinescript compile --emit wat src/main.affine -o output.wat # Debug info -affinescript compile --debug src/main.as -o output.wasm +affinescript compile --debug src/main.affine -o output.wasm # Target options -affinescript compile --target wasm32 src/main.as +affinescript compile --target wasm32 src/main.affine ``` ### run @@ -125,13 +125,13 @@ Compile and run: ```bash # Run with default WASM runtime -affinescript run src/main.as +affinescript run src/main.affine # Pass arguments -affinescript run src/main.as -- arg1 arg2 +affinescript run src/main.affine -- arg1 arg2 # With specific runtime -affinescript run --runtime wasmtime src/main.as +affinescript run --runtime wasmtime src/main.affine ``` ## aspm (Package Manager) @@ -234,19 +234,19 @@ Code formatter (planned): ```bash # Format file -asfmt src/main.as +asfmt src/main.affine # Format in place -asfmt --write src/main.as +asfmt --write src/main.affine # Format all files asfmt --write . # Check formatting -asfmt --check src/main.as +asfmt --check src/main.affine # Diff mode -asfmt --diff src/main.as +asfmt --diff src/main.affine ``` Configuration (`.asfmt.toml`): diff --git a/wiki/tooling/repl.md b/wiki/tooling/repl.md index 637c245..bcfeeb4 100644 --- a/wiki/tooling/repl.md +++ b/wiki/tooling/repl.md @@ -9,7 +9,7 @@ The AffineScript REPL (Read-Eval-Print Loop) provides an interactive environment affinescript repl # With a prelude file -affinescript repl --prelude mylib.as +affinescript repl --prelude mylib.affine # With specific options affinescript repl --no-color --history-file ~/.as_history @@ -88,14 +88,14 @@ pure ### Loading Files ``` -> :load examples/math.as -Loaded examples/math.as +> :load examples/math.affine +Loaded examples/math.affine > add(1, 2) 3 : Int > :reload -Reloaded examples/math.as +Reloaded examples/math.affine ``` ## Multi-line Input diff --git a/wiki/tutorials/quickstart.md b/wiki/tutorials/quickstart.md index 4780e39..bfa9ab2 100644 --- a/wiki/tutorials/quickstart.md +++ b/wiki/tutorials/quickstart.md @@ -31,7 +31,7 @@ dune exec affinescript -- --version ## Your First Program -Create a file `hello.as`: +Create a file `hello.affine`: ```affine fn main() -{IO}-> Unit { @@ -42,7 +42,7 @@ fn main() -{IO}-> Unit { Run it: ```bash -dune exec affinescript -- run hello.as +dune exec affinescript -- run hello.affine ``` Output: