freelang-editor 11.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.config/jest.config.js +47 -0
- package/.config/jest.fast.config.js +9 -0
- package/.config/openapi.yaml +457 -0
- package/.config/tsconfig.json +30 -0
- package/.github/CODE_OF_CONDUCT.md +176 -0
- package/.github/CONTRIBUTING.md +296 -0
- package/.github/DISCUSSIONS.md +179 -0
- package/.github/ISSUE_TEMPLATE/bug-report.md +44 -0
- package/.github/ISSUE_TEMPLATE/feature-request.md +39 -0
- package/.github/pull_request_template.md +87 -0
- package/.github/workflows/phase-3c-l2-proof.yml +101 -0
- package/.github/workflows/phase-c-full-slack.yml +409 -0
- package/.github/workflows/phase-c-full.yml +241 -0
- package/.github/workflows/phase-c-scan.yml +64 -0
- package/.gitmodules +3 -0
- package/.tmp.js +3 -0
- package/CHANGELOG.md +1182 -0
- package/CLAUDE.md +633 -0
- package/Dockerfile +3 -0
- package/LICENSE +21 -0
- package/MISTAKES-COVERAGE.json +115 -0
- package/Makefile +95 -0
- package/PHASE-F-ROADMAP.md +554 -0
- package/README.md +459 -0
- package/SELF_HOSTING_CHECKLIST.md +155 -0
- package/benchmark-freelang.fl +47 -0
- package/benchmark-results.json +37 -0
- package/benchmark-simple.fl +38 -0
- package/bin/freelang-migrate +310 -0
- package/bin/freelang-smart +258 -0
- package/bootstrap.js +1134 -0
- package/docker-compose.yml +3 -0
- package/docs/AI_FRIENDLINESS.md +181 -0
- package/docs/AI_LEARNING_PATH.md +542 -0
- package/docs/AI_MAINTENANCE.md +153 -0
- package/docs/AI_QUICKSTART.md +380 -0
- package/docs/AI_REFERENCE.md +559 -0
- package/docs/AI_RELIABILITY_GUIDE.md +597 -0
- package/docs/AKL_ARCHITECTURE.md +228 -0
- package/docs/AKL_P0_KIMDB.md +215 -0
- package/docs/API.md +380 -0
- package/docs/ARCHITECTURE.md +208 -0
- package/docs/CHANGELOG.md +1014 -0
- package/docs/CLAUDE.md +991 -0
- package/docs/CLAUDE_AI.md +210 -0
- package/docs/CODEGEN_IMPROVEMENTS.md +158 -0
- package/docs/CODE_OF_CONDUCT.md +337 -0
- package/docs/CONTRIBUTING.md +437 -0
- package/docs/CRON_AUTOMATION.md +97 -0
- package/docs/DEPLOYMENT.md +357 -0
- package/docs/DETERMINISM_GUIDE.md +174 -0
- package/docs/HUMAN_GUIDE.md +599 -0
- package/docs/INDEX.md +199 -0
- package/docs/INLINE_TEST_GUIDE.md +231 -0
- package/docs/LANGUAGE-FAULTS.md +583 -0
- package/docs/LANGUAGE_IMPROVEMENT_REQUESTS.md +187 -0
- package/docs/LEARNING.md +257 -0
- package/docs/MISTAKES-100.md +52 -0
- package/docs/MISTAKES.md +131 -0
- package/docs/NAMING_CONVENTIONS.md +158 -0
- package/docs/NIGHTLY-MONITORING.md +222 -0
- package/docs/OFFICIAL_LANGUAGE.md +249 -0
- package/docs/ONBOARDING_1HOUR.md +210 -0
- package/docs/PERFORMANCE.md +329 -0
- package/docs/PHASE-3C-L2-PROOF-PLAN.md +282 -0
- package/docs/PHASE-3C-L2-RESULTS.md +183 -0
- package/docs/PHASE-3D-AI-LIBRARY.md +170 -0
- package/docs/PHASE-3E-VM-OPTIMIZATION.md +192 -0
- package/docs/PHASE-C-CI.md +242 -0
- package/docs/PHASE-C-PR-CHECKLIST.md +267 -0
- package/docs/PHASE-C-ROADMAP.md +141 -0
- package/docs/PHASE-C-SCAN.md +205 -0
- package/docs/PHASE-G-ROADMAP.md +228 -0
- package/docs/PHASE-X-V11.5-ROADMAP.md +267 -0
- package/docs/PHASE4_IMPLEMENTATION_PLAN.md +290 -0
- package/docs/PHASE5-COMPLETION.md +186 -0
- package/docs/PHASE5-SUMMARY.md +82 -0
- package/docs/PLUGIN_GUIDE.md +241 -0
- package/docs/PROJECT_OVERVIEW_KO.md +66 -0
- package/docs/QUICKSTART.md +160 -0
- package/docs/README.md +192 -0
- package/docs/RESERVED.md +125 -0
- package/docs/ROADMAP.md +191 -0
- package/docs/SECURITY.md +518 -0
- package/docs/SETUP.md +127 -0
- package/docs/SLACK-SETUP.md +190 -0
- package/docs/STATE_OF_V11.md +74 -0
- package/docs/STDLIB_NAMING_AUDIT.md +154 -0
- package/docs/STDLIB_REFERENCE.md +2722 -0
- package/docs/STYLE_GUIDE.md +559 -0
- package/docs/TASK5-MAP-DESTRUCTURE-DESIGN.md +136 -0
- package/docs/TOOLS.md +357 -0
- package/docs/TYPE_SYSTEM_GUIDE.md +201 -0
- package/docs/UI-PATTERN.md +265 -0
- package/docs/V11.5-RULES.md +416 -0
- package/docs/V11.6-HARNESS-RULES.md +222 -0
- package/docs/V11.6-MULTI-AGENT-PLAN.md +265 -0
- package/docs/V11.6-STABILIZATION-PLAN.md +290 -0
- package/docs/Y4-2B_DRY_RUN.md +142 -0
- package/docs/_classifications.json +882 -0
- package/docs/api/stdlib.md +134 -0
- package/docs/blog/2026-04-17-v11-ai-first-evolution.md +223 -0
- package/docs/blog/2026-04-20-self-hosting-fixedpoint.md +269 -0
- package/docs/blog/2026-05-04-mistakes-are-language-faults.md +267 -0
- package/docs/blog/2026-05-04-mistakes-coverage-honest.md +170 -0
- package/docs/blog/2026-05-04-phase-g-followup-smart-wrapper.md +188 -0
- package/docs/blog/2026-05-04-phase-g-mistakes-100.md +269 -0
- package/docs/blog/2026-05-04-phase-x-v11.5-launch.md +224 -0
- package/docs/blog/2026-05-04-v11.5.0-real-language-change.md +252 -0
- package/docs/blog-demo/README.md +44 -0
- package/docs/examples/index.md +78 -0
- package/docs/examples/todo-app.md +99 -0
- package/docs/guide/ai-blocks.md +335 -0
- package/docs/guide/basics.md +235 -0
- package/docs/guide/frameworks.md +319 -0
- package/docs/homepage/README.md +164 -0
- package/docs/index.md +183 -0
- package/docs/v12-DESIGN.md +214 -0
- package/examples/README.md +26 -0
- package/examples/browser-test.html +149 -0
- package/examples/csv-tool/analyze.fl +222 -0
- package/examples/csv-tool/employees.csv +16 -0
- package/examples/csv-tool/products.csv +21 -0
- package/examples/factorial.fl +9 -0
- package/examples/fib30.fl +4 -0
- package/examples/hello.fl +2 -0
- package/examples/hello.fl.js +3 -0
- package/examples/learning-session/01-grade-stats.fl +49 -0
- package/examples/learning-session/02-class-stats.fl +52 -0
- package/examples/learning-session/03-cart.fl +61 -0
- package/examples/learning-session/04-word-freq.fl +57 -0
- package/examples/learning-session/05-todo.fl +69 -0
- package/examples/learning-session/06-library.fl +76 -0
- package/examples/learning-session/07-currency.fl +99 -0
- package/examples/learning-session/08-csv-grades.fl +104 -0
- package/examples/learning-session/09-calc-repl.fl +92 -0
- package/examples/learning-session/10-contacts.fl +109 -0
- package/examples/learning-session/11-markdown.fl +107 -0
- package/examples/learning-session/12-calendar.fl +87 -0
- package/examples/learning-session/13-statistics.fl +123 -0
- package/examples/learning-session/14-primes.fl +107 -0
- package/examples/learning-session/15-statistics.fl +123 -0
- package/examples/learning-session/16-calendar.fl +87 -0
- package/examples/learning-session/17-markdown.fl +107 -0
- package/examples/learning-session/18-contacts.fl +109 -0
- package/examples/learning-session/19-json-serializer.fl +86 -0
- package/examples/learning-session/20-template.fl +201 -0
- package/examples/learning-session/21-calc-parser.fl +148 -0
- package/examples/learning-session/22-table.fl +96 -0
- package/examples/patterns/01-map-filter-reduce.fl +50 -0
- package/examples/patterns/02-error-handling.fl +51 -0
- package/examples/patterns/03-type-validation.fl +57 -0
- package/examples/patterns/04-state-management.fl +44 -0
- package/examples/patterns/05-api-integration.fl +95 -0
- package/examples/patterns/06-database-operations.fl +113 -0
- package/examples/patterns/07-string-processing.fl +86 -0
- package/examples/patterns/08-data-transformation.fl +92 -0
- package/examples/patterns/09-decision-logic.fl +122 -0
- package/examples/patterns/10-agent-orchestration.fl +184 -0
- package/examples/patterns/README.md +344 -0
- package/examples/simple-server.fl +29 -0
- package/examples/tables-app.fl +219 -0
- package/examples/test-libs.fl +272 -0
- package/jest.config.js +4 -0
- package/lib/datetime.fl +123 -0
- package/lib/http-client.fl +129 -0
- package/lib/pipeline.fl +150 -0
- package/lib/query.fl +160 -0
- package/lib/result.fl +124 -0
- package/lib/template.fl +161 -0
- package/lib/validate.fl +136 -0
- package/package.json +58 -0
- package/scripts/ai-eval.js +318 -0
- package/scripts/ai-self-verify.js +200 -0
- package/scripts/ai-validate.js +302 -0
- package/scripts/bench.sh +71 -0
- package/scripts/benchmark.js +258 -0
- package/scripts/benchmark.sh +99 -0
- package/scripts/build-binary.sh +68 -0
- package/scripts/build-runtime.sh +46 -0
- package/scripts/build-stage1-final.sh +58 -0
- package/scripts/build-stage1.sh +119 -0
- package/scripts/build-standalone.sh +17 -0
- package/scripts/build.js +130 -0
- package/scripts/check-let-regressions.js +95 -0
- package/scripts/check-parens.py +117 -0
- package/scripts/check-ports.sh +49 -0
- package/scripts/check-syntax.js +30 -0
- package/scripts/cli-extras.js +135 -0
- package/scripts/cron-daily-verify.sh +101 -0
- package/scripts/deploy.sh +91 -0
- package/scripts/dev.sh +37 -0
- package/scripts/extract-fl-examples.js +29 -0
- package/scripts/extract-runtime-helpers.js +122 -0
- package/scripts/fl-compile.sh +14 -0
- package/scripts/fl-fixpoint.sh +28 -0
- package/scripts/fl-repl.sh +21 -0
- package/scripts/fl-run.sh +41 -0
- package/scripts/fl-serve.sh +25 -0
- package/scripts/fuzz-compiler.js +92 -0
- package/scripts/gen-ai-prompt.js +340 -0
- package/scripts/gen-fixtures.js +166 -0
- package/scripts/gen-mistakes-split.js +199 -0
- package/scripts/gen-stdlib-docs.js +69 -0
- package/scripts/lint-stdlib-aliases.js +166 -0
- package/scripts/measure-baseline.sh +43 -0
- package/scripts/property-test.js +885 -0
- package/scripts/push-to-gogs.sh +60 -0
- package/scripts/regression-scan.js +132 -0
- package/scripts/run-jest-shard.sh +85 -0
- package/scripts/safe-push.sh +37 -0
- package/scripts/scan-fl-tokens.js +170 -0
- package/scripts/scan-for-fl-tokens.sh +17 -0
- package/scripts/self-diff.sh +95 -0
- package/scripts/snapshot-v0.sh +35 -0
- package/scripts/test-l2-fixpoint.sh +54 -0
- package/scripts/verify-all.sh +130 -0
- package/scripts/verify-build-deterministic.sh +110 -0
- package/scripts/verify-c7-bootstrap.sh +150 -0
- package/scripts/verify-c8-fixed-point-simple.sh +121 -0
- package/scripts/verify-c8-fixed-point.sh +133 -0
- package/scripts/verify-c9-fuzzing.sh +214 -0
- package/scripts/verify-fixed-point-deep.sh +133 -0
- package/scripts/verify-fixed-point.sh +65 -0
- package/scripts/verify-l2-proof.sh +153 -0
- package/scripts/verify-l3-proof.sh +40 -0
- package/scripts/verify-mistakes-coverage.js +120 -0
- package/scripts/verify-self-host.sh +509 -0
- package/self/CHANGELOG.md +964 -0
- package/self/COMPILER_REDESIGN_FAILURES.md +59 -0
- package/self/INTEGRATION-CHECKLIST.md +113 -0
- package/self/README.md +34 -0
- package/self/all.fl +1353 -0
- package/self/ast.fl +219 -0
- package/self/ast.self.js +47 -0
- package/self/bench/_bi_json-parse.js +46 -0
- package/self/bench/_bi_json-str.js +60 -0
- package/self/bench/_bi_list-distinct.js +37 -0
- package/self/bench/_bi_list-filter-even.js +56 -0
- package/self/bench/_bi_list-first.js +29 -0
- package/self/bench/_bi_list-last.js +28 -0
- package/self/bench/_bi_list-map-inc.js +41 -0
- package/self/bench/_bi_list-range.js +22 -0
- package/self/bench/_bi_list-reduce-sum.js +50 -0
- package/self/bench/_bi_list-reverse.js +28 -0
- package/self/bench/_bi_list-sort.js +35 -0
- package/self/bench/_bi_list-take.js +36 -0
- package/self/bench/_bi_m-abs.js +24 -0
- package/self/bench/_bi_m-floor.js +22 -0
- package/self/bench/_bi_m-max.js +26 -0
- package/self/bench/_bi_m-min.js +26 -0
- package/self/bench/_bi_m-mod.js +21 -0
- package/self/bench/_bi_map-has.js +50 -0
- package/self/bench/_bi_map-keys.js +50 -0
- package/self/bench/_bi_map-values.js +52 -0
- package/self/bench/_bi_str-concat.js +36 -0
- package/self/bench/_bi_str-contains.js +43 -0
- package/self/bench/_bi_str-ends.js +45 -0
- package/self/bench/_bi_str-index.js +34 -0
- package/self/bench/_bi_str-lower.js +23 -0
- package/self/bench/_bi_str-repeat.js +26 -0
- package/self/bench/_bi_str-split.js +41 -0
- package/self/bench/_bi_str-starts.js +47 -0
- package/self/bench/_bi_str-trim.js +26 -0
- package/self/bench/_bi_str-upper.js +23 -0
- package/self/bench/_bi_t-list.js +24 -0
- package/self/bench/_bi_t-null.js +23 -0
- package/self/bench/_bi_t-number.js +23 -0
- package/self/bench/_bi_t-string.js +25 -0
- package/self/bench/_bi_t-typeof.js +25 -0
- package/self/bench/_c_parse_probe.fl +426 -0
- package/self/bench/_c_parse_probe.js +67 -0
- package/self/bench/_codegen_nodrv.fl +751 -0
- package/self/bench/_combined2.fl +423 -0
- package/self/bench/_combined_arr.fl +422 -0
- package/self/bench/_combined_astprobe.fl +429 -0
- package/self/bench/_combined_astprobe.js +69 -0
- package/self/bench/_combined_cg.fl +424 -0
- package/self/bench/_combined_cg.js +64 -0
- package/self/bench/_combined_lex.fl +421 -0
- package/self/bench/_combined_trace.fl +435 -0
- package/self/bench/_combined_trace.js +75 -0
- package/self/bench/_ext_abs-neg.js +2 -0
- package/self/bench/_ext_and.js +2 -0
- package/self/bench/_ext_cond-1.js +2 -0
- package/self/bench/_ext_cond-2.js +2 -0
- package/self/bench/_ext_do-seq.js +2 -0
- package/self/bench/_ext_fact20.js +3 -0
- package/self/bench/_ext_fib25.js +3 -0
- package/self/bench/_ext_length.js +2 -0
- package/self/bench/_ext_let-1d.js +18 -0
- package/self/bench/_ext_let-2d.js +2 -0
- package/self/bench/_ext_list-sum.js +3 -0
- package/self/bench/_ext_math.js +2 -0
- package/self/bench/_ext_or.js +2 -0
- package/self/bench/_ext_str.js +2 -0
- package/self/bench/_fact15.js +2 -0
- package/self/bench/_fb_fact15.js +2 -0
- package/self/bench/_fb_func-fact.js +2 -0
- package/self/bench/_fb_func-multi.js +2 -0
- package/self/bench/_fb_func-mutual.js +3 -0
- package/self/bench/_fb_func-simple.js +21 -0
- package/self/bench/_fib.js +2 -0
- package/self/bench/_fn_async-await-seq.js +40 -0
- package/self/bench/_fn_async-await.js +3 -0
- package/self/bench/_fn_async-print.js +26 -0
- package/self/bench/_fn_async-result.js +1 -0
- package/self/bench/_fn_call-form.js +24 -0
- package/self/bench/_fn_compose.js +37 -0
- package/self/bench/_fn_pipe.js +34 -0
- package/self/bench/_fn_thread-first-sexpr.js +31 -0
- package/self/bench/_fn_thread-first.js +25 -0
- package/self/bench/_fn_thread-last.js +31 -0
- package/self/bench/_generated.js +35 -0
- package/self/bench/_mt_match-default.js +51 -0
- package/self/bench/_mt_match-num.js +58 -0
- package/self/bench/_mt_match-str.js +56 -0
- package/self/bench/_mt_match-var.js +32 -0
- package/self/bench/_mt_match-wild.js +36 -0
- package/self/bench/_mt_struct-make.js +81 -0
- package/self/bench/_mt_struct-tag.js +81 -0
- package/self/bench/_probe.fl +1 -0
- package/self/bench/_probe2.fl +1 -0
- package/self/bench/_probe3.fl +3 -0
- package/self/bench/_probe_apply.fl +1 -0
- package/self/bench/_probe_args.fl +7 -0
- package/self/bench/_probe_arr.fl +7 -0
- package/self/bench/_probe_arr2.fl +5 -0
- package/self/bench/_probe_block.fl +7 -0
- package/self/bench/_probe_call.fl +1 -0
- package/self/bench/_probe_cg.fl +27 -0
- package/self/bench/_probe_compose.fl +13 -0
- package/self/bench/_probe_define.fl +1 -0
- package/self/bench/_probe_keys.fl +5 -0
- package/self/bench/_probe_length.fl +5 -0
- package/self/bench/_probe_lexparse.fl +4 -0
- package/self/bench/_probe_loop.fl +12 -0
- package/self/bench/_probe_map.fl +8 -0
- package/self/bench/_probe_map2.fl +8 -0
- package/self/bench/_probe_map3.fl +5 -0
- package/self/bench/_probe_mapkeys.fl +5 -0
- package/self/bench/_probe_mapv12.fl +1 -0
- package/self/bench/_probe_mapv12.js +2 -0
- package/self/bench/_probe_match.fl +1 -0
- package/self/bench/_probe_match2.fl +1 -0
- package/self/bench/_probe_neg.fl +7 -0
- package/self/bench/_probe_neg2.fl +3 -0
- package/self/bench/_probe_protocol.fl +7 -0
- package/self/bench/_probe_self_parse.fl +6 -0
- package/self/bench/_probe_struct.fl +1 -0
- package/self/bench/_probe_true.fl +3 -0
- package/self/bench/_probe_true2.fl +6 -0
- package/self/bench/_probe_v12_cg.fl +7 -0
- package/self/bench/_probe_v12_extract.fl +8 -0
- package/self/bench/_probe_v12_extract.js +7 -0
- package/self/bench/_probe_v12_internal.fl +21 -0
- package/self/bench/_probe_v12_map_ast.fl +12 -0
- package/self/bench/_rs_combo.js +3 -0
- package/self/bench/_rs_gcd.js +36 -0
- package/self/bench/_rs_grade.js +2 -0
- package/self/bench/_rs_mutual-fib.js +2 -0
- package/self/bench/_rs_range-sum.js +2 -0
- package/self/bench/_rs_sum-10k.js +2 -0
- package/self/bench/_rs_sum-5k.js +2 -0
- package/self/bench/_sf_loop-fact-10.js +73 -0
- package/self/bench/_sf_loop-sum-10k.js +87 -0
- package/self/bench/_sf_set-x.js +40 -0
- package/self/bench/_sf_throw-catch.js +1 -0
- package/self/bench/_sf_while-5.js +62 -0
- package/self/bench/_v12_combined.fl +1184 -0
- package/self/bench/_v12_extract_test.fl +14 -0
- package/self/bench/_v12_extract_test.js +7 -0
- package/self/bench/_v12_inspect.js +26 -0
- package/self/bench/_v12_inspect_mod.js +137 -0
- package/self/bench/_v12_makevartest.fl +8 -0
- package/self/bench/_v12_makevartest.js +6 -0
- package/self/bench/_v12_parse_probe.fl +9 -0
- package/self/bench/_v12_parse_trace.fl +18 -0
- package/self/bench/_v12_simple_fn.fl +2 -0
- package/self/bench/_v12_simple_fn.js +3 -0
- package/self/bench/_v12_trace.fl +2 -0
- package/self/bench/_v12_trace.js +3 -0
- package/self/bench/collection.js +13 -0
- package/self/bench/fib30.fl +4 -0
- package/self/bench/final-test.fl +12 -0
- package/self/bench/final-test.js +2 -0
- package/self/bench/fp1-v12.js +4 -0
- package/self/bench/fp1.fl +3 -0
- package/self/bench/fp1.fp.js +4 -0
- package/self/bench/fp2-v12.js +4 -0
- package/self/bench/fp2.fl +3 -0
- package/self/bench/fp2.fp.js +4 -0
- package/self/bench/fp3-v12.js +8 -0
- package/self/bench/fp3.fl +11 -0
- package/self/bench/fp3.fp.js +8 -0
- package/self/bench/fp4-v12.js +6 -0
- package/self/bench/fp4.fl +9 -0
- package/self/bench/fp4.fp.js +6 -0
- package/self/bench/hello-sample.fl +3 -0
- package/self/bench/hello-sample.js +4 -0
- package/self/bench/hello.fl +1 -0
- package/self/bench/json.js +9 -0
- package/self/bench/json1mb.fl +3 -0
- package/self/bench/math.js +8 -0
- package/self/bench/realworld.fl +17 -0
- package/self/bench/realworld.js +8 -0
- package/self/bench/regex.js +10 -0
- package/self/bench/sample.json +1 -0
- package/self/bench/string.js +7 -0
- package/self/bench/test-ffi.fl +3 -0
- package/self/bench/test-ffi.js +2 -0
- package/self/bench/test-hof-advanced.fl +7 -0
- package/self/bench/test-hof-advanced.js +2 -0
- package/self/bench/test-hof.fl +5 -0
- package/self/bench/test-hof.js +2 -0
- package/self/bench/test-output.txt +1 -0
- package/self/bench/test-phase15-integration.fl +16 -0
- package/self/bench/test-phase15-integration.js +3 -0
- package/self/bench/test-phase19-complete.fl +24 -0
- package/self/bench/test-phase19-complete.js +2 -0
- package/self/bench/test-stdlib-codegen.fl +9 -0
- package/self/bench/test-stdlib-codegen.js +2 -0
- package/self/bench/test-time.fl +8 -0
- package/self/bench/test-time.js +2 -0
- package/self/bench/time.js +9 -0
- package/self/bench/tiny-v12.js +2 -0
- package/self/bench/tiny.fl +1 -0
- package/self/builtins/core.fl +150 -0
- package/self/char-class.fl +45 -0
- package/self/codegen-core.fl +733 -0
- package/self/codegen-final.fl +135 -0
- package/self/codegen.fl +379 -0
- package/self/codegen.fl.bak +856 -0
- package/self/codegen.self.js +75 -0
- package/self/examples/agent-loop.fl +32 -0
- package/self/examples/ci-cd-example.fl +114 -0
- package/self/examples/cloud-real.fl +134 -0
- package/self/examples/docker-example.fl +67 -0
- package/self/examples/fullstack-app.fl +330 -0
- package/self/examples/k8s-example.fl +91 -0
- package/self/examples/microservices.fl +448 -0
- package/self/examples/rest-api.fl +253 -0
- package/self/examples/style-example.fl +133 -0
- package/self/examples/workflow-orchestration.fl +44 -0
- package/self/fixtures/eval/add.fl +1 -0
- package/self/fixtures/eval/and-sc.fl +1 -0
- package/self/fixtures/eval/bool-false.fl +1 -0
- package/self/fixtures/eval/bool-true.fl +1 -0
- package/self/fixtures/eval/closure.fl +1 -0
- package/self/fixtures/eval/cmp-eq.fl +1 -0
- package/self/fixtures/eval/cmp-lt.fl +1 -0
- package/self/fixtures/eval/cond-first.fl +1 -0
- package/self/fixtures/eval/define-fn3.fl +1 -0
- package/self/fixtures/eval/define-var.fl +1 -0
- package/self/fixtures/eval/defn-bare.fl +1 -0
- package/self/fixtures/eval/defn-call.fl +1 -0
- package/self/fixtures/eval/div.fl +1 -0
- package/self/fixtures/eval/filter-hof.fl +1 -0
- package/self/fixtures/eval/floor.fl +1 -0
- package/self/fixtures/eval/fn-apply.fl +1 -0
- package/self/fixtures/eval/get-idx.fl +1 -0
- package/self/fixtures/eval/get-key.fl +1 -0
- package/self/fixtures/eval/higher-order.fl +1 -0
- package/self/fixtures/eval/let-bare.fl +1 -0
- package/self/fixtures/eval/let-flat.fl +1 -0
- package/self/fixtures/eval/let-use.fl +1 -0
- package/self/fixtures/eval/list-first.fl +1 -0
- package/self/fixtures/eval/list-last.fl +1 -0
- package/self/fixtures/eval/list-len.fl +1 -0
- package/self/fixtures/eval/map-hof.fl +1 -0
- package/self/fixtures/eval/mod.fl +1 -0
- package/self/fixtures/eval/mul-nested.fl +1 -0
- package/self/fixtures/eval/not.fl +1 -0
- package/self/fixtures/eval/null-p.fl +1 -0
- package/self/fixtures/eval/or-sc.fl +1 -0
- package/self/fixtures/eval/pow.fl +1 -0
- package/self/fixtures/eval/recursion.fl +1 -0
- package/self/fixtures/eval/reduce-hof.fl +1 -0
- package/self/fixtures/eval/replace.fl +1 -0
- package/self/fixtures/eval/sqrt.fl +1 -0
- package/self/fixtures/eval/str-concat.fl +1 -0
- package/self/fixtures/eval/str-num.fl +1 -0
- package/self/fixtures/eval/sub.fl +1 -0
- package/self/fixtures/eval/substring.fl +1 -0
- package/self/fixtures/lex/array.fl +1 -0
- package/self/fixtures/lex/at-atom.fl +1 -0
- package/self/fixtures/lex/block.fl +1 -0
- package/self/fixtures/lex/comment.fl +2 -0
- package/self/fixtures/lex/deep-array.fl +1 -0
- package/self/fixtures/lex/deep-map.fl +1 -0
- package/self/fixtures/lex/deep-nest.fl +1 -0
- package/self/fixtures/lex/dollar-dot.fl +1 -0
- package/self/fixtures/lex/empty-list.fl +1 -0
- package/self/fixtures/lex/empty-str.fl +1 -0
- package/self/fixtures/lex/empty.fl +1 -0
- package/self/fixtures/lex/float.fl +1 -0
- package/self/fixtures/lex/hex.fl +1 -0
- package/self/fixtures/lex/kebab-sym.fl +1 -0
- package/self/fixtures/lex/keyword.fl +1 -0
- package/self/fixtures/lex/leading-zero.fl +1 -0
- package/self/fixtures/lex/long-num.fl +1 -0
- package/self/fixtures/lex/many-args.fl +1 -0
- package/self/fixtures/lex/map.fl +1 -0
- package/self/fixtures/lex/mixed.fl +1 -0
- package/self/fixtures/lex/neg-float.fl +1 -0
- package/self/fixtures/lex/negative.fl +1 -0
- package/self/fixtures/lex/nested.fl +1 -0
- package/self/fixtures/lex/null.fl +1 -0
- package/self/fixtures/lex/pipe-op.fl +1 -0
- package/self/fixtures/lex/route-like.fl +1 -0
- package/self/fixtures/lex/scientific.fl +1 -0
- package/self/fixtures/lex/single-num.fl +1 -0
- package/self/fixtures/lex/small-sexpr.fl +1 -0
- package/self/fixtures/lex/spaces.fl +1 -0
- package/self/fixtures/lex/str-quote.fl +1 -0
- package/self/fixtures/lex/str-tab.fl +1 -0
- package/self/fixtures/lex/string-esc.fl +1 -0
- package/self/fixtures/lex/string.fl +1 -0
- package/self/fixtures/lex/symbol.fl +1 -0
- package/self/fixtures/lex/tabs-nl.fl +3 -0
- package/self/fixtures/lex/true-false.fl +1 -0
- package/self/fixtures/lex/unicode.fl +1 -0
- package/self/fixtures/lex/variable.fl +1 -0
- package/self/fixtures/lex/zero.fl +1 -0
- package/self/fixtures/parse/and-or.fl +1 -0
- package/self/fixtures/parse/array-lit.fl +1 -0
- package/self/fixtures/parse/block-func.fl +1 -0
- package/self/fixtures/parse/compose.fl +1 -0
- package/self/fixtures/parse/cond.fl +1 -0
- package/self/fixtures/parse/define-fn.fl +1 -0
- package/self/fixtures/parse/define-val.fl +1 -0
- package/self/fixtures/parse/defn.fl +1 -0
- package/self/fixtures/parse/do-begin.fl +1 -0
- package/self/fixtures/parse/dotted.fl +1 -0
- package/self/fixtures/parse/empty-fn.fl +1 -0
- package/self/fixtures/parse/empty-list.fl +1 -0
- package/self/fixtures/parse/fn.fl +1 -0
- package/self/fixtures/parse/if-else.fl +1 -0
- package/self/fixtures/parse/if-only.fl +1 -0
- package/self/fixtures/parse/keyword-arg.fl +1 -0
- package/self/fixtures/parse/kw.fl +1 -0
- package/self/fixtures/parse/let-1d.fl +1 -0
- package/self/fixtures/parse/let-2d.fl +1 -0
- package/self/fixtures/parse/let-bare.fl +1 -0
- package/self/fixtures/parse/literal-num.fl +1 -0
- package/self/fixtures/parse/literal-str.fl +1 -0
- package/self/fixtures/parse/loop-recur.fl +1 -0
- package/self/fixtures/parse/map-lit.fl +1 -0
- package/self/fixtures/parse/match-simple.fl +1 -0
- package/self/fixtures/parse/multi-body.fl +1 -0
- package/self/fixtures/parse/nested-arr.fl +1 -0
- package/self/fixtures/parse/nested-block.fl +1 -0
- package/self/fixtures/parse/nested-map.fl +1 -0
- package/self/fixtures/parse/nested.fl +1 -0
- package/self/fixtures/parse/pipe.fl +1 -0
- package/self/fixtures/parse/quote.fl +1 -0
- package/self/fixtures/parse/set-bang.fl +1 -0
- package/self/fixtures/parse/sexpr.fl +1 -0
- package/self/fixtures/parse/str-interp.fl +1 -0
- package/self/fixtures/parse/sym.fl +1 -0
- package/self/fixtures/parse/thread-first.fl +1 -0
- package/self/fixtures/parse/thread-last.fl +1 -0
- package/self/fixtures/parse/try-catch.fl +1 -0
- package/self/fixtures/parse/var.fl +1 -0
- package/self/full-compiler-fixed.fl +1308 -0
- package/self/full-compiler-v1-bloated.fl +1298 -0
- package/self/full-compiler.fl +1301 -0
- package/self/interpreter.fl +351 -0
- package/self/lexer.fl +200 -0
- package/self/lexer.self.js +30 -0
- package/self/main.fl +22 -0
- package/self/parser.fl +241 -0
- package/self/parser.self.js +33 -0
- package/self/runtime/http-server.js +642 -0
- package/self/runtime/interpreter.js +30787 -0
- package/self/runtime/repl.js +186 -0
- package/self/runtime-helpers.ts +282 -0
- package/self/scope.fl +80 -0
- package/self/scope.self.js +1 -0
- package/self/self/bench/_bi_list-distinct.js +2 -0
- package/self/self/bench/_bi_list-filter-even.js +2 -0
- package/self/self/bench/_bi_list-first.js +2 -0
- package/self/self/bench/_bi_list-last.js +2 -0
- package/self/self/bench/_bi_list-map-inc.js +2 -0
- package/self/self/bench/_bi_list-range.js +2 -0
- package/self/self/bench/_bi_list-reduce-sum.js +2 -0
- package/self/self/bench/_bi_list-reverse.js +2 -0
- package/self/self/bench/_bi_list-sort.js +2 -0
- package/self/self/bench/_bi_list-take.js +2 -0
- package/self/self/bench/_bi_map-has.js +2 -0
- package/self/self/bench/_bi_map-keys.js +2 -0
- package/self/self/bench/_bi_map-values.js +2 -0
- package/self/self/bench/_bi_str-concat.js +2 -0
- package/self/self/bench/_bi_str-contains.js +2 -0
- package/self/self/bench/_bi_str-ends.js +2 -0
- package/self/self/bench/_bi_str-index.js +2 -0
- package/self/self/bench/_bi_str-lower.js +2 -0
- package/self/self/bench/_bi_str-repeat.js +2 -0
- package/self/self/bench/_bi_str-split.js +2 -0
- package/self/self/bench/_bi_str-starts.js +2 -0
- package/self/self/bench/_bi_str-trim.js +2 -0
- package/self/self/bench/_bi_str-upper.js +2 -0
- package/self/self/bench/_ext_abs-neg.js +2 -0
- package/self/self/bench/_ext_and.js +2 -0
- package/self/self/bench/_ext_cond-1.js +2 -0
- package/self/self/bench/_ext_cond-2.js +2 -0
- package/self/self/bench/_ext_do-seq.js +2 -0
- package/self/self/bench/_ext_fact20.js +3 -0
- package/self/self/bench/_ext_fib25.js +3 -0
- package/self/self/bench/_ext_length.js +2 -0
- package/self/self/bench/_ext_let-1d.js +2 -0
- package/self/self/bench/_ext_let-2d.js +2 -0
- package/self/self/bench/_ext_list-sum.js +3 -0
- package/self/self/bench/_ext_math.js +2 -0
- package/self/self/bench/_ext_or.js +2 -0
- package/self/self/bench/_ext_str.js +2 -0
- package/self/self/bench/_fact15.js +2 -0
- package/self/self/bench/_fb_fact15.js +2 -0
- package/self/self/bench/_fb_func-fact.js +2 -0
- package/self/self/bench/_fb_func-multi.js +2 -0
- package/self/self/bench/_fb_func-mutual.js +3 -0
- package/self/self/bench/_fb_func-simple.js +2 -0
- package/self/self/bench/_fib.js +2 -0
- package/self/self/bench/_fn_async-await-seq.js +2 -0
- package/self/self/bench/_fn_async-print.js +2 -0
- package/self/self/bench/_fn_call-form.js +2 -0
- package/self/self/bench/_fn_compose.js +2 -0
- package/self/self/bench/_fn_pipe.js +2 -0
- package/self/self/bench/_fn_thread-first-sexpr.js +2 -0
- package/self/self/bench/_fn_thread-first.js +2 -0
- package/self/self/bench/_fn_thread-last.js +2 -0
- package/self/self/bench/_generated.js +2 -0
- package/self/self/bench/_mt_match-default.js +2 -0
- package/self/self/bench/_mt_match-num.js +2 -0
- package/self/self/bench/_mt_match-str.js +2 -0
- package/self/self/bench/_mt_match-var.js +2 -0
- package/self/self/bench/_mt_match-wild.js +2 -0
- package/self/self/bench/_mt_struct-make.js +4 -0
- package/self/self/bench/_mt_struct-tag.js +4 -0
- package/self/self/bench/_rs_combo.js +3 -0
- package/self/self/bench/_rs_gcd.js +2 -0
- package/self/self/bench/_rs_grade.js +2 -0
- package/self/self/bench/_rs_mutual-fib.js +2 -0
- package/self/self/bench/_rs_range-sum.js +2 -0
- package/self/self/bench/_rs_sum-5k.js +2 -0
- package/self/self/bench/_sf_loop-fact-10.js +1 -0
- package/self/self/bench/_sf_loop-sum-10k.js +1 -0
- package/self/self/bench/_sf_set-x.js +3 -0
- package/self/self/bench/_sf_throw-catch.js +1 -0
- package/self/self/bench/_sf_while-5.js +3 -0
- package/self/stdlib/ai.fl +73 -0
- package/self/stdlib/assert.fl +30 -0
- package/self/stdlib/async.fl +48 -0
- package/self/stdlib/base64.fl +22 -0
- package/self/stdlib/binary.fl +30 -0
- package/self/stdlib/build.fl +69 -0
- package/self/stdlib/collection.fl +37 -0
- package/self/stdlib/color.fl +35 -0
- package/self/stdlib/crypto-hash.fl +29 -0
- package/self/stdlib/crypto.fl +56 -0
- package/self/stdlib/data.fl +69 -0
- package/self/stdlib/db.fl +53 -0
- package/self/stdlib/encoding.fl +49 -0
- package/self/stdlib/error.fl +36 -0
- package/self/stdlib/feed.fl +86 -0
- package/self/stdlib/file.fl +53 -0
- package/self/stdlib/format.fl +34 -0
- package/self/stdlib/graph.fl +72 -0
- package/self/stdlib/hash.fl +32 -0
- package/self/stdlib/heap.fl +76 -0
- package/self/stdlib/http.fl +47 -0
- package/self/stdlib/image.fl +45 -0
- package/self/stdlib/json.fl +11 -0
- package/self/stdlib/list-extra.fl +32 -0
- package/self/stdlib/markdown.fl +59 -0
- package/self/stdlib/math-extra.fl +34 -0
- package/self/stdlib/math.fl +13 -0
- package/self/stdlib/metadata.fl +66 -0
- package/self/stdlib/mongodb/bson.fl +21 -0
- package/self/stdlib/mongodb/schema.fl +95 -0
- package/self/stdlib/mongodb/wire.fl +54 -0
- package/self/stdlib/mongodb.fl +172 -0
- package/self/stdlib/path.fl +72 -0
- package/self/stdlib/plot.fl +56 -0
- package/self/stdlib/process.fl +50 -0
- package/self/stdlib/queue.fl +65 -0
- package/self/stdlib/regex.fl +11 -0
- package/self/stdlib/resource.fl +61 -0
- package/self/stdlib/search.fl +54 -0
- package/self/stdlib/set-extra.fl +35 -0
- package/self/stdlib/sort.fl +61 -0
- package/self/stdlib/stack.fl +54 -0
- package/self/stdlib/stats.fl +110 -0
- package/self/stdlib/stream.fl +56 -0
- package/self/stdlib/string-extended.fl +25 -0
- package/self/stdlib/string-extra.fl +40 -0
- package/self/stdlib/string.fl +21 -0
- package/self/stdlib/test-helpers.fl +51 -0
- package/self/stdlib/test-runner.fl +76 -0
- package/self/stdlib/time-extra.fl +27 -0
- package/self/stdlib/time.fl +31 -0
- package/self/stdlib/tree.fl +57 -0
- package/self/stdlib/types.fl +85 -0
- package/self/stdlib/url.fl +33 -0
- package/self/stdlib/uuid.fl +28 -0
- package/self/stdlib/validation.fl +42 -0
- package/self/stdlib/vector-math.fl +52 -0
- package/self/stdlib/ws.fl +52 -0
- package/self/tests/mongodb-phase3.fl +75 -0
- package/self/tests/mongodb-wire-phase2.fl +45 -0
- package/self/tests/test-ast.fl +36 -0
- package/self/tests/test-builtins.fl +340 -0
- package/self/tests/test-char-class.fl +29 -0
- package/self/tests/test-codegen-builtins.fl +240 -0
- package/self/tests/test-codegen-ext.fl +380 -0
- package/self/tests/test-codegen-ffi.fl +295 -0
- package/self/tests/test-codegen-fn.fl +177 -0
- package/self/tests/test-codegen-match.fl +161 -0
- package/self/tests/test-codegen-run.fl +252 -0
- package/self/tests/test-codegen-sf.fl +262 -0
- package/self/tests/test-codegen.fl +260 -0
- package/self/tests/test-core-fl.fl +63 -0
- package/self/tests/test-forward-decl.fl +5 -0
- package/self/tests/test-func-block.fl +4 -0
- package/self/tests/test-interp-user-fn.fl +296 -0
- package/self/tests/test-interp.fl +225 -0
- package/self/tests/test-lexer.fl +162 -0
- package/self/tests/test-list-debug.fl +21 -0
- package/self/tests/test-mutual-rec.fl +6 -0
- package/self/tests/test-parser-debug.fl +35 -0
- package/self/tests/test-parser-full-debug.fl +66 -0
- package/self/tests/test-parser-lex-debug.fl +107 -0
- package/self/tests/test-parser-lex-only.fl +40 -0
- package/self/tests/test-parser-simple-debug.fl +35 -0
- package/self/tests/test-parser.fl +262 -0
- package/self/tests/test-real-stdlib.fl +377 -0
- package/self/tests/test-scope.fl +74 -0
- package/self/tests/test-selfcompile.fl +325 -0
- package/self/tests/test-stdlib.fl +44 -0
- package/self/tests/test-tco.fl +16 -0
- package/self/tests/test-token.fl +4 -0
- package/self/token.fl +38 -0
- package/self/token.self.js +8 -0
- package/self/v12-driver.fl +16 -0
- package/self/verify.fl +39 -0
- package/self-evolve/1-observe-ast.fl +28 -0
- package/self-evolve/2-inspect-block.fl +35 -0
- package/self-evolve/3-full-ast-json.fl +10 -0
- package/self-evolve/4-trace-block-fields.fl +23 -0
- package/self-evolve/5-analyze-do-ast.fl +29 -0
- package/self-evolve/6-test-do-elim-simple.fl +14 -0
- package/self-evolve/debug-evaluate.fl +24 -0
- package/self-evolve/debug-gen1-const-fold.fl +57 -0
- package/self-evolve/debug-map.fl +15 -0
- package/self-evolve/debug-optimize-simple.fl +95 -0
- package/self-evolve/debug-recursive-map.fl +23 -0
- package/self-evolve/logs/gen-0.fl +1658 -0
- package/self-evolve/logs/gen-1.fl +1658 -0
- package/self-evolve/logs/gen-2.fl +1658 -0
- package/self-evolve/logs/speed-gen-0.fl +1423 -0
- package/self-evolve/run-semantic-test.js +130 -0
- package/self-evolve/test-basic.fl +19 -0
- package/self-evolve/test-fold-direct.fl +60 -0
- package/self-evolve/test-gen1-simple.fl +67 -0
- package/self-evolve/test-optimize-debug.fl +63 -0
- package/self-evolve/tmp-test.fl +1 -0
- package/self-evolve/v11-analyzer.fl +40 -0
- package/self-evolve/v11-benchmark.fl +45 -0
- package/self-evolve/v11-evolution-real.fl +45 -0
- package/self-evolve/v11-evolution.fl +32 -0
- package/self-evolve/v11-gen1-validate.fl +157 -0
- package/self-evolve/v11-optimizer-constant-fold.fl +124 -0
- package/self-evolve/v11-optimizer-dead-expr.fl +111 -0
- package/self-evolve/v11-optimizer-gen1-complete.fl +180 -0
- package/self-evolve/v11-optimizer-gen1.fl +68 -0
- package/self-evolve/v11-optimizer.fl +56 -0
- package/self-evolve/v11-semantic-test.fl +54 -0
- package/self-evolve/v11-speed-benchmark.fl +106 -0
- package/self-evolve/v11-speed-optimizer.fl +79 -0
- package/src/AGENT-DSL.md +527 -0
- package/src/CLI-DEPLOYMENT.md +204 -0
- package/src/CLI.md +361 -0
- package/src/EXPRESS-ADVANCED.md +294 -0
- package/src/EXPRESS-AUTH.md +365 -0
- package/src/EXPRESS-CACHE.md +409 -0
- package/src/EXPRESS-COMPLETE.md +569 -0
- package/src/EXPRESS-README.md +121 -0
- package/src/EXPRESS-TEST.md +492 -0
- package/src/EXPRESS-WEBSOCKET.md +391 -0
- package/src/LOGGING-GUIDE.md +354 -0
- package/src/STORAGE-GUIDE.md +416 -0
- package/src/__tests__/advanced.test.ts +573 -0
- package/src/__tests__/ai-library.test.ts +210 -0
- package/src/__tests__/build-determinism.test.ts +33 -0
- package/src/__tests__/builtins-advanced.test.ts +150 -0
- package/src/__tests__/builtins-sanity.test.ts +180 -0
- package/src/__tests__/codegen.let.test.ts +81 -0
- package/src/__tests__/core.test.ts +188 -0
- package/src/__tests__/coverage-boost.test.ts +626 -0
- package/src/__tests__/cron-scheduler.test.ts +269 -0
- package/src/__tests__/enterprise-blocks.test.ts +63 -0
- package/src/__tests__/errors.test.ts +313 -0
- package/src/__tests__/integration.test.ts +219 -0
- package/src/__tests__/interpreter.test.ts +170 -0
- package/src/__tests__/l2-proof.test.ts +78 -0
- package/src/__tests__/lexer-parser.test.ts +366 -0
- package/src/__tests__/lexer.test.ts +106 -0
- package/src/__tests__/mariadb-prepared-statement.test.ts +206 -0
- package/src/__tests__/migrate.test.ts +403 -0
- package/src/__tests__/mongodb-integration.test.ts.skip +207 -0
- package/src/__tests__/mongodb-phase4.test.ts +132 -0
- package/src/__tests__/p1-1-parallel-tasks.test.ts +179 -0
- package/src/__tests__/p1-2-compensation.test.ts +242 -0
- package/src/__tests__/p1-3-distributed.test.ts +160 -0
- package/src/__tests__/p1-4-observability.test.ts +161 -0
- package/src/__tests__/parser.test.ts +142 -0
- package/src/__tests__/phase151-self-evolve.test.ts +161 -0
- package/src/__tests__/rate-limiter.test.ts +274 -0
- package/src/__tests__/self-hosting.test.ts +174 -0
- package/src/__tests__/semantic-preservation.test.ts +207 -0
- package/src/__tests__/setup.ts +34 -0
- package/src/__tests__/special-forms-advanced.test.ts +106 -0
- package/src/__tests__/stdlib-crypto-rsa.test.ts +122 -0
- package/src/__tests__/stdlib-f4.test.ts +159 -0
- package/src/__tests__/stdlib-helpers.test.ts +128 -0
- package/src/__tests__/stdlib-modules.test.ts +161 -0
- package/src/__tests__/stdlib-mongodb.test.ts +331 -0
- package/src/__tests__/stdlib-new.test.ts +269 -0
- package/src/__tests__/stdlib-perf.test.ts +125 -0
- package/src/__tests__/stdlib-phase-b.test.ts +249 -0
- package/src/__tests__/stdlib.test.ts +163 -0
- package/src/__tests__/v12-alpha.test.ts +205 -0
- package/src/__tests__/vm-optin.test.ts +141 -0
- package/src/__tests__/web-integration.test.ts +1452 -0
- package/src/__tests__/weblibs.test.ts +210 -0
- package/src/_aliases.json +1123 -0
- package/src/_mongodb_helper.js +272 -0
- package/src/_stdlib-signatures.json +1 -0
- package/src/agent-chain.ts +71 -0
- package/src/agent-dsl.fl +168 -0
- package/src/agent-example-error-handling.fl +51 -0
- package/src/agent-example-sequential.fl +66 -0
- package/src/agent-example-state-tracking.fl +70 -0
- package/src/agent.ts +393 -0
- package/src/align.ts +349 -0
- package/src/analogy.ts +78 -0
- package/src/ast-helpers.ts +199 -0
- package/src/ast.ts +817 -0
- package/src/async-runtime.ts +263 -0
- package/src/belief.ts +86 -0
- package/src/benchmark-self.ts +275 -0
- package/src/benchmarks/bench-interpreter.ts +73 -0
- package/src/benchmarks/bench-runner.ts +85 -0
- package/src/benchmarks/bench-vm.ts +128 -0
- package/src/browser-debug-panel.ts +220 -0
- package/src/browser-entry.ts +79 -0
- package/src/browser-stubs/child-process-stubs.ts +6 -0
- package/src/browser-stubs/crypto-stubs.ts +15 -0
- package/src/browser-stubs/misc-stubs.ts +4 -0
- package/src/browser-stubs/node-stubs.ts +17 -0
- package/src/browser-stubs/path-stubs.ts +6 -0
- package/src/bytecode.ts +41 -0
- package/src/causal.ts +258 -0
- package/src/chain-agents.ts +86 -0
- package/src/checkpoint.ts +106 -0
- package/src/ci-runner.ts +279 -0
- package/src/cli.ts +2136 -0
- package/src/codegen-js.ts +847 -0
- package/src/cognitive.ts +95 -0
- package/src/compete.ts +60 -0
- package/src/compiler.ts +267 -0
- package/src/compose-reason.ts +118 -0
- package/src/consensus.ts +109 -0
- package/src/context-window.ts +139 -0
- package/src/cot.ts +241 -0
- package/src/counterfactual.ts +268 -0
- package/src/critique.ts +77 -0
- package/src/crossover.ts +218 -0
- package/src/curiosity.ts +305 -0
- package/src/debate.ts +64 -0
- package/src/debug-api.ts +92 -0
- package/src/debugger.ts +185 -0
- package/src/delegate.ts +78 -0
- package/src/doc-extractor.ts +255 -0
- package/src/doc-renderer.ts +131 -0
- package/src/echo-server-demo.fl +17 -0
- package/src/error-formatter.ts +369 -0
- package/src/error-system.ts +88 -0
- package/src/errors.ts +281 -0
- package/src/ethics-check.ts +408 -0
- package/src/eval-ai-blocks.ts +182 -0
- package/src/eval-ai-handlers.ts +132 -0
- package/src/eval-builtins-ai.ts +1659 -0
- package/src/eval-builtins.ts +5956 -0
- package/src/eval-call-function.ts +665 -0
- package/src/eval-infra-blocks.ts +450 -0
- package/src/eval-module-system.ts +286 -0
- package/src/eval-pattern-match.ts +289 -0
- package/src/eval-phase150.ts +87 -0
- package/src/eval-reasoning-sequence.ts +218 -0
- package/src/eval-special-forms.ts +2154 -0
- package/src/eval-style-blocks.ts +193 -0
- package/src/eval-type-classes.ts +148 -0
- package/src/evolve.ts +276 -0
- package/src/explain.ts +345 -0
- package/src/express-advanced.fl +78 -0
- package/src/express-auth.fl +118 -0
- package/src/express-cache.fl +118 -0
- package/src/express-chat.fl +81 -0
- package/src/express-example.fl +67 -0
- package/src/express-test.fl +331 -0
- package/src/express.fl +92 -0
- package/src/fitness.ts +238 -0
- package/src/fl-app-demo.fl +19 -0
- package/src/fl-files/fl-fmt.fl +29 -0
- package/src/fl-files/fl-lint.fl +61 -0
- package/src/fl-files/fl-test.fl +52 -0
- package/src/fl-http-demo.fl +19 -0
- package/src/fl-list-utils.fl +108 -0
- package/src/fl-math-lib.fl +14 -0
- package/src/fl-sdk.ts +154 -0
- package/src/fl-server-demo.fl +74 -0
- package/src/fl-str-utils.fl +29 -0
- package/src/fl-tutor.ts +126 -0
- package/src/formatter.ts +581 -0
- package/src/freelang-codegen.fl +904 -0
- package/src/freelang-interpreter.fl +483 -0
- package/src/freelang-lexer.fl +337 -0
- package/src/freelang-parser.fl +349 -0
- package/src/freelang-stdlib.fl +246 -0
- package/src/freelang-typechecker.fl +422 -0
- package/src/freelang-v9-complete.ts +474 -0
- package/src/generation.ts +201 -0
- package/src/gpt-mini-p3.fl +316 -0
- package/src/hot-reload.ts +235 -0
- package/src/http-server-runner.ts +89 -0
- package/src/hypothesis.ts +62 -0
- package/src/immutable.ts +140 -0
- package/src/interpreter-context.ts +87 -0
- package/src/interpreter-scope.ts +140 -0
- package/src/interpreter.ts +2351 -0
- package/src/lazy-seq.ts +134 -0
- package/src/learned-facts-store.ts +306 -0
- package/src/lexer.ts +359 -0
- package/src/lint-rules.ts +584 -0
- package/src/linter.ts +237 -0
- package/src/logger.ts +128 -0
- package/src/logging-deterministic.fl +138 -0
- package/src/lsp-server.ts +379 -0
- package/src/macro-expander.ts +195 -0
- package/src/maybe-chain.ts +108 -0
- package/src/maybe-type.ts +163 -0
- package/src/memory-system.ts +142 -0
- package/src/meta-reason.ts +93 -0
- package/src/multi-agent-hub.ts +247 -0
- package/src/multi-agent.ts +101 -0
- package/src/mutate.ts +226 -0
- package/src/negotiate.ts +55 -0
- package/src/optimizer.ts +277 -0
- package/src/orchestrate.ts +154 -0
- package/src/package-manager.ts +375 -0
- package/src/parser.ts +2722 -0
- package/src/peer-review.ts +53 -0
- package/src/predict.ts +365 -0
- package/src/profiler.ts +150 -0
- package/src/prompt-compiler.ts +123 -0
- package/src/protocol.ts +114 -0
- package/src/prune.ts +195 -0
- package/src/quality-loop.ts +105 -0
- package/src/rag.ts +81 -0
- package/src/reasoning-debugger.ts +122 -0
- package/src/refactor-self.ts +362 -0
- package/src/reflect.ts +186 -0
- package/src/repl.ts +323 -0
- package/src/result-type.ts +126 -0
- package/src/return-signal.ts +10 -0
- package/src/runtime-entry.ts +8 -0
- package/src/runtime-helpers.ts +234 -0
- package/src/self-evolution-hub.ts +431 -0
- package/src/self-improve.ts +107 -0
- package/src/source-map.ts +114 -0
- package/src/stdlib-agent.js +164 -0
- package/src/stdlib-agent.ts +225 -0
- package/src/stdlib-ai-native.ts +176 -0
- package/src/stdlib-ai-workflow.ts +308 -0
- package/src/stdlib-ai.ts +180 -0
- package/src/stdlib-async.ts +179 -0
- package/src/stdlib-audit.ts +94 -0
- package/src/stdlib-auth.ts +196 -0
- package/src/stdlib-bits.ts +86 -0
- package/src/stdlib-blog.ts +127 -0
- package/src/stdlib-browser.ts +239 -0
- package/src/stdlib-cache.ts +147 -0
- package/src/stdlib-capture-error.ts +183 -0
- package/src/stdlib-channel.ts +96 -0
- package/src/stdlib-checkpoint.js +109 -0
- package/src/stdlib-checkpoint.ts +97 -0
- package/src/stdlib-cloud.ts +317 -0
- package/src/stdlib-collection.ts +227 -0
- package/src/stdlib-compile.ts +111 -0
- package/src/stdlib-cron.ts +219 -0
- package/src/stdlib-crypto-rsa.ts +82 -0
- package/src/stdlib-crypto.js +203 -0
- package/src/stdlib-crypto.ts +208 -0
- package/src/stdlib-data.ts +614 -0
- package/src/stdlib-db-query.ts +198 -0
- package/src/stdlib-db.ts +185 -0
- package/src/stdlib-distributed.ts +292 -0
- package/src/stdlib-error.ts +90 -0
- package/src/stdlib-fd.ts +130 -0
- package/src/stdlib-feed.ts +171 -0
- package/src/stdlib-file.ts +182 -0
- package/src/stdlib-helpers.ts +273 -0
- package/src/stdlib-http-macro.ts +178 -0
- package/src/stdlib-http-server.ts +1229 -0
- package/src/stdlib-http.ts +405 -0
- package/src/stdlib-image.ts +92 -0
- package/src/stdlib-kebab-aliases.ts +131 -0
- package/src/stdlib-lazy-registry.ts +106 -0
- package/src/stdlib-loader.ts +810 -0
- package/src/stdlib-mail.ts +251 -0
- package/src/stdlib-mariadb.ts +467 -0
- package/src/stdlib-markdown.ts +227 -0
- package/src/stdlib-matrix.ts +170 -0
- package/src/stdlib-middleware.ts +221 -0
- package/src/stdlib-module.ts +178 -0
- package/src/stdlib-mongodb.ts +174 -0
- package/src/stdlib-oci.ts +321 -0
- package/src/stdlib-optional.ts +56 -0
- package/src/stdlib-orm.ts +241 -0
- package/src/stdlib-perf.ts +140 -0
- package/src/stdlib-pg.ts +181 -0
- package/src/stdlib-plot.ts +196 -0
- package/src/stdlib-process.ts +120 -0
- package/src/stdlib-property.ts +157 -0
- package/src/stdlib-pubsub.ts +93 -0
- package/src/stdlib-queue-helpers.ts +92 -0
- package/src/stdlib-registry.ts +78 -0
- package/src/stdlib-resource.ts +553 -0
- package/src/stdlib-rest-crud.ts +146 -0
- package/src/stdlib-service.ts +206 -0
- package/src/stdlib-shell.ts +76 -0
- package/src/stdlib-stats.ts +172 -0
- package/src/stdlib-table.ts +200 -0
- package/src/stdlib-test-enhanced.ts +76 -0
- package/src/stdlib-test.ts +153 -0
- package/src/stdlib-time.js +217 -0
- package/src/stdlib-time.ts +282 -0
- package/src/stdlib-timer.ts +134 -0
- package/src/stdlib-totp.ts +110 -0
- package/src/stdlib-type-predicates.ts +136 -0
- package/src/stdlib-types.ts +107 -0
- package/src/stdlib-validation.ts +248 -0
- package/src/stdlib-verify.ts +181 -0
- package/src/stdlib-webauthn.ts +192 -0
- package/src/stdlib-workflow.js +715 -0
- package/src/stdlib-workflow.ts +950 -0
- package/src/stdlib-ws.ts +333 -0
- package/src/stdlib-wsc.test.ts +122 -0
- package/src/stdlib-wsc.ts +243 -0
- package/src/storage-unified.fl +279 -0
- package/src/streaming.ts +101 -0
- package/src/struct-system.ts +104 -0
- package/src/style-registry.ts +54 -0
- package/src/swarm.ts +89 -0
- package/src/tco.ts +31 -0
- package/src/test-advanced-patterns.ts +211 -0
- package/src/test-ast-debug.ts +20 -0
- package/src/test-ast-helpers.ts +208 -0
- package/src/test-async.ts +406 -0
- package/src/test-bootstrap-self-compile.ts +449 -0
- package/src/test-bootstrap-verification.ts +336 -0
- package/src/test-composition.ts +206 -0
- package/src/test-errors-phase6.ts +166 -0
- package/src/test-extended-monads.ts +313 -0
- package/src/test-field-parsing.ts +135 -0
- package/src/test-first-class-functions.ts +257 -0
- package/src/test-freelang-interpreter.ts +320 -0
- package/src/test-freelang-lexer.ts +306 -0
- package/src/test-freelang-parser.ts +268 -0
- package/src/test-fullstack-core.ts +258 -0
- package/src/test-fullstack-phase7-12.ts +305 -0
- package/src/test-fullstack-practical.ts +338 -0
- package/src/test-integration-stdlib.ts +195 -0
- package/src/test-interpreter-phase6.ts +305 -0
- package/src/test-lexer-comparison.ts +108 -0
- package/src/test-lexer-phase6.ts +271 -0
- package/src/test-modules.ts +325 -0
- package/src/test-monad-laws.ts +383 -0
- package/src/test-monads.ts +197 -0
- package/src/test-p0-checkpoint.ts +304 -0
- package/src/test-p0-conditional.ts +284 -0
- package/src/test-p0-error-handling.ts +231 -0
- package/src/test-p0-error-messages.ts +220 -0
- package/src/test-p1-1-parallel-tasks.js +214 -0
- package/src/test-parser-phase6.ts +222 -0
- package/src/test-performance.ts +206 -0
- package/src/test-phase10-data.ts +259 -0
- package/src/test-phase10-file.ts +216 -0
- package/src/test-phase100-stdlib-ai.ts +343 -0
- package/src/test-phase101-memory.ts +309 -0
- package/src/test-phase102-rag.ts +296 -0
- package/src/test-phase103-multi-agent.ts +418 -0
- package/src/test-phase104-try-reason.ts +459 -0
- package/src/test-phase105-streaming.ts +287 -0
- package/src/test-phase106-quality.ts +397 -0
- package/src/test-phase107-tutor.ts +305 -0
- package/src/test-phase108-debugger.ts +316 -0
- package/src/test-phase109-prompt-compiler.ts +333 -0
- package/src/test-phase11-12-complete.ts +275 -0
- package/src/test-phase11-error.ts +192 -0
- package/src/test-phase110-sdk.ts +320 -0
- package/src/test-phase111-hypothesis.ts +380 -0
- package/src/test-phase112-maybe-chain.ts +313 -0
- package/src/test-phase113-debate.ts +364 -0
- package/src/test-phase114-checkpoint.ts +348 -0
- package/src/test-phase115-meta-reason.ts +277 -0
- package/src/test-phase116-belief.ts +275 -0
- package/src/test-phase117-analogy.ts +325 -0
- package/src/test-phase118-critique.ts +308 -0
- package/src/test-phase119-compose.ts +434 -0
- package/src/test-phase12-http-shell.ts +120 -0
- package/src/test-phase120-cognitive.ts +297 -0
- package/src/test-phase121-consensus.ts +404 -0
- package/src/test-phase122-delegate.ts +411 -0
- package/src/test-phase123-vote.ts +339 -0
- package/src/test-phase124-negotiate.ts +403 -0
- package/src/test-phase125-swarm.ts +321 -0
- package/src/test-phase126-orchestrate.ts +343 -0
- package/src/test-phase127-peer-review.ts +279 -0
- package/src/test-phase128-chain-agents.ts +456 -0
- package/src/test-phase129-compete.ts +256 -0
- package/src/test-phase13-data.ts +223 -0
- package/src/test-phase130-hub.ts +390 -0
- package/src/test-phase131-evolve.ts +536 -0
- package/src/test-phase132-mutate.ts +268 -0
- package/src/test-phase133-crossover.ts +289 -0
- package/src/test-phase134-fitness.ts +306 -0
- package/src/test-phase135-generation.ts +328 -0
- package/src/test-phase136-prune.ts +228 -0
- package/src/test-phase137-refactor-self.ts +354 -0
- package/src/test-phase138-benchmark-self.ts +325 -0
- package/src/test-phase139-version-self.ts +278 -0
- package/src/test-phase14-collection.ts +254 -0
- package/src/test-phase140-self-evolution.ts +410 -0
- package/src/test-phase141-world-model.ts +387 -0
- package/src/test-phase142-causal.ts +384 -0
- package/src/test-phase143-counterfactual.ts +280 -0
- package/src/test-phase144-predict.ts +312 -0
- package/src/test-phase145-explain.ts +287 -0
- package/src/test-phase146-align.ts +439 -0
- package/src/test-phase147-ethics-check.ts +399 -0
- package/src/test-phase148-curiosity.ts +247 -0
- package/src/test-phase149-wisdom.ts +758 -0
- package/src/test-phase15-agent.ts +320 -0
- package/src/test-phase150-complete.ts +481 -0
- package/src/test-phase16-time.ts +292 -0
- package/src/test-phase17-crypto.ts +312 -0
- package/src/test-phase18-integration.ts +429 -0
- package/src/test-phase19-resource.ts +214 -0
- package/src/test-phase20-server-db.ts +160 -0
- package/src/test-phase21-ws-auth-cache-pubsub.ts +212 -0
- package/src/test-phase22-process.ts +166 -0
- package/src/test-phase23-selfhosting.ts +383 -0
- package/src/test-phase24-codegen.ts +236 -0
- package/src/test-phase25-bootstrap.ts +227 -0
- package/src/test-phase26-map-filter-reduce.ts +282 -0
- package/src/test-phase27-stdlib-codegen.ts +325 -0
- package/src/test-phase28-loop-recur.ts +182 -0
- package/src/test-phase29-import.ts +165 -0
- package/src/test-phase3-web-server.ts +234 -0
- package/src/test-phase30-selfcompile.ts +254 -0
- package/src/test-phase31-gen2-lexer.ts +251 -0
- package/src/test-phase33-gen3-bootstrap.ts +323 -0
- package/src/test-phase34-parser-tco.ts +268 -0
- package/src/test-phase35-error-messages.ts +280 -0
- package/src/test-phase36-sourcemap.ts +240 -0
- package/src/test-phase37-variadic.ts +228 -0
- package/src/test-phase38-destructuring.ts +261 -0
- package/src/test-phase39-do-block.ts +288 -0
- package/src/test-phase40-const-fold.ts +249 -0
- package/src/test-phase41-repl.ts +312 -0
- package/src/test-phase42-watch.ts +314 -0
- package/src/test-phase43-format.ts +377 -0
- package/src/test-phase44-check.ts +505 -0
- package/src/test-phase45-interpreter.ts +367 -0
- package/src/test-phase46-match.ts +390 -0
- package/src/test-phase47-file-io.ts +338 -0
- package/src/test-phase48-types.ts +308 -0
- package/src/test-phase49-stdlib.ts +365 -0
- package/src/test-phase5-week1.ts +160 -0
- package/src/test-phase50-fl-server.ts +159 -0
- package/src/test-phase51-transformer.ts +152 -0
- package/src/test-phase52-import.ts +161 -0
- package/src/test-phase53-training.ts +122 -0
- package/src/test-phase54-fl-utils.ts +122 -0
- package/src/test-phase55-http-client.ts +182 -0
- package/src/test-phase56-lexical-scope.ts +230 -0
- package/src/test-phase58-module-refactor.ts +298 -0
- package/src/test-phase59-errors.ts +226 -0
- package/src/test-phase6-compile.ts +227 -0
- package/src/test-phase60-types.ts +457 -0
- package/src/test-phase61-tco.ts +209 -0
- package/src/test-phase63-macros.ts +191 -0
- package/src/test-phase64-protocols.ts +451 -0
- package/src/test-phase65-patterns.ts +301 -0
- package/src/test-phase66-structs.ts +215 -0
- package/src/test-phase67-concurrency.ts +348 -0
- package/src/test-phase68-pipeline.ts +209 -0
- package/src/test-phase69-lazy.ts +237 -0
- package/src/test-phase7-registry.ts +236 -0
- package/src/test-phase70-immutable.ts +488 -0
- package/src/test-phase71-ai-native.ts +252 -0
- package/src/test-phase72-integration.ts +533 -0
- package/src/test-phase73-formatter.ts +361 -0
- package/src/test-phase74-linter.ts +565 -0
- package/src/test-phase75-repl.ts +227 -0
- package/src/test-phase76-testrunner.ts +439 -0
- package/src/test-phase77-doc.ts +416 -0
- package/src/test-phase78-debugger.ts +370 -0
- package/src/test-phase79-watch.ts +224 -0
- package/src/test-phase8-oci.ts +264 -0
- package/src/test-phase80-ci.ts +282 -0
- package/src/test-phase81-pkg.ts +383 -0
- package/src/test-phase82-profiler.ts +336 -0
- package/src/test-phase83-vm.ts +318 -0
- package/src/test-phase84-optimizer.ts +424 -0
- package/src/test-phase85-codegen.ts +380 -0
- package/src/test-phase86-lsp.ts +533 -0
- package/src/test-phase87-packages.ts +277 -0
- package/src/test-phase88-selfhost.ts +412 -0
- package/src/test-phase89-bench.ts +361 -0
- package/src/test-phase9-flnext-v2.ts +372 -0
- package/src/test-phase9-learn.ts +241 -0
- package/src/test-phase9-reasoning.ts +312 -0
- package/src/test-phase9-search.ts +212 -0
- package/src/test-phase90-release.ts +365 -0
- package/src/test-phase91-maybe.ts +257 -0
- package/src/test-phase92-cot.ts +438 -0
- package/src/test-phase93-tot.ts +462 -0
- package/src/test-phase94-reflect.ts +498 -0
- package/src/test-phase95-context.ts +268 -0
- package/src/test-phase96-errors.ts +296 -0
- package/src/test-phase97-tools.ts +344 -0
- package/src/test-phase98-agent.ts +370 -0
- package/src/test-phase99-self-improve.ts +394 -0
- package/src/test-phase9a-websearch.ts +283 -0
- package/src/test-phase9ab-integration.ts +140 -0
- package/src/test-phase9b-persistence.ts +448 -0
- package/src/test-phase9c-conditional.ts +251 -0
- package/src/test-phase9c-extension.ts +270 -0
- package/src/test-phase9c-feedback.ts +263 -0
- package/src/test-phase9c-loop.ts +239 -0
- package/src/test-selfhosting-sh1.ts +41 -0
- package/src/test-selfhosting-sh2.ts +84 -0
- package/src/test-selfhosting-sh3.ts +61 -0
- package/src/test-selfhosting-sh4.ts +65 -0
- package/src/test-type-classes-dispatch.ts +202 -0
- package/src/test-type-classes.ts +320 -0
- package/src/test-type-inference.ts +464 -0
- package/src/test-typeclass-parsing-final.ts +218 -0
- package/src/test-typeclass-parsing.ts +264 -0
- package/src/todo-server-30116.ts +53 -0
- package/src/token.ts +130 -0
- package/src/tool-registry.ts +195 -0
- package/src/tot.ts +258 -0
- package/src/try-reason.ts +109 -0
- package/src/type-check-static.ts +417 -0
- package/src/type-checker.ts +245 -0
- package/src/type-inference.ts +271 -0
- package/src/type-system.ts +169 -0
- package/src/version-self.ts +219 -0
- package/src/vm-eligible.ts +106 -0
- package/src/vm.ts +219 -0
- package/src/vote.ts +127 -0
- package/src/vpm/checksum-test.fl +193 -0
- package/src/vpm/checksum.fl +219 -0
- package/src/vpm/error-test.fl +211 -0
- package/src/vpm/error.fl +218 -0
- package/src/vpm/lock-file.fl +380 -0
- package/src/vpm/logging-test.fl +194 -0
- package/src/vpm/logging.fl +294 -0
- package/src/vpm/resolver-test.fl +117 -0
- package/src/vpm/resolver.fl +618 -0
- package/src/vpm/semver-test.fl +180 -0
- package/src/vpm/semver.fl +143 -0
- package/src/vpm-cli.ts +1955 -0
- package/src/web/app-router.ts +286 -0
- package/src/web/fl-executor.ts +655 -0
- package/src/web/image-optimizer.ts +206 -0
- package/src/web/index.ts +14 -0
- package/src/web/page-renderer.ts +287 -0
- package/src/web/server.ts +553 -0
- package/src/web-search-adapter.ts +348 -0
- package/src/wisdom.ts +441 -0
- package/src/world-model.ts +348 -0
- package/stdlib/cache.fl +42 -0
- package/stdlib/csv.fl +38 -0
- package/stdlib/date-ext.fl +68 -0
- package/stdlib/log.fl +44 -0
- package/stdlib/math-ext.fl +57 -0
- package/stdlib/number-ext.fl +47 -0
- package/stdlib/queue.fl +57 -0
- package/stdlib/string-ext.fl +45 -0
- package/stdlib/validate.fl +123 -0
- package/stdlib/web/components.fl +125 -0
- package/stdlib/web/csrf.fl +61 -0
- package/stdlib/web/format.fl +75 -0
- package/stdlib/web/forms.fl +94 -0
- package/stdlib/web/image.fl +77 -0
- package/stdlib/web/metadata.fl +85 -0
- package/stdlib/web/pagination.fl +62 -0
- package/stdlib/web/state.fl +167 -0
- package/stdlib/web/styles.fl +68 -0
- package/stdlib/web/toast.fl +62 -0
- package/stdlib/web/v9-stdlib-dom.fl +92 -0
- package/stdlib/web/v9-stdlib-fetch.fl +90 -0
- package/stdlib/web/v9-stdlib-storage.fl +70 -0
- package/stdlib/web/v9-stdlib-ui.fl +115 -0
- package/stdlib/web/ws-client.fl +125 -0
- package/tests/.v11-backup/test-migrate-sample.fl +22 -0
- package/tests/PHASE-C-VERIFICATION-REPORT.md +125 -0
- package/tests/benchmark-v11.1.js +103 -0
- package/tests/evidence/01-about.html +1 -0
- package/tests/evidence/02-post-hello.html +1 -0
- package/tests/evidence/02-post-world.html +1 -0
- package/tests/evidence/03-home.html +1 -0
- package/tests/evidence/04-dist/404.html +1 -0
- package/tests/evidence/04-dist/about/index.html +1 -0
- package/tests/evidence/04-dist/index.html +1 -0
- package/tests/evidence/04-dist/post/hello/index.html +1 -0
- package/tests/evidence/04-dist/post/world/index.html +1 -0
- package/tests/evidence/05-dist/404.html +1 -0
- package/tests/evidence/05-dist/about/index.html +1 -0
- package/tests/evidence/05-dist/index.html +1 -0
- package/tests/evidence/05-dist/post/hello/index.html +1 -0
- package/tests/evidence/05-dist/post/world/index.html +1 -0
- package/tests/evidence/06-dist/404.html +1 -0
- package/tests/evidence/06-dist/about/index.html +1 -0
- package/tests/evidence/06-dist/index.html +1 -0
- package/tests/evidence/06-dist/post/hello/index.html +1 -0
- package/tests/evidence/06-dist/post/world/index.html +1 -0
- package/tests/evidence/07-markdown.html +1 -0
- package/tests/evidence/08-rss.xml +25 -0
- package/tests/evidence/09-robots.txt +4 -0
- package/tests/evidence/09-sitemap.xml +12 -0
- package/tests/evidence/10-jsonld.html +1 -0
- package/tests/evidence/_results.txt +11 -0
- package/tests/evidence/about.html +1 -0
- package/tests/evidence/home.html +1 -0
- package/tests/evidence/missing.html +42 -0
- package/tests/evidence/post-hello.html +1 -0
- package/tests/evidence/post-world.html +1 -0
- package/tests/fixtures/basic-app/about/page.fl +1 -0
- package/tests/fixtures/basic-app/api/echo/route.fl +5 -0
- package/tests/fixtures/basic-app/layout.fl +1 -0
- package/tests/fixtures/basic-app/not-found.fl +1 -0
- package/tests/fixtures/basic-app/page.fl +1 -0
- package/tests/fixtures/basic-app/post/[slug]/generate-static-params.fl +1 -0
- package/tests/fixtures/basic-app/post/[slug]/page.fl +1 -0
- package/tests/fixtures/stdlib-probes/blog.fl +6 -0
- package/tests/fixtures/stdlib-probes/jsonld.fl +1 -0
- package/tests/fixtures/stdlib-probes/map-probe.fl +3 -0
- package/tests/fixtures/stdlib-probes/map-shape.fl +2 -0
- package/tests/fixtures/stdlib-probes/md.fl +1 -0
- package/tests/fixtures/stdlib-probes/robots.fl +1 -0
- package/tests/fixtures/stdlib-probes/rss.fl +4 -0
- package/tests/fixtures/stdlib-probes/sitemap.fl +1 -0
- package/tests/l2/case-01-arithmetic.fl +6 -0
- package/tests/l2/case-02-comparisons.fl +15 -0
- package/tests/l2/case-03-logic.fl +15 -0
- package/tests/l2/case-04-control-flow.fl +15 -0
- package/tests/l2/case-05-functions.fl +13 -0
- package/tests/l2/case-06-collections.fl +14 -0
- package/tests/l2/case-07-pattern-matching.fl +14 -0
- package/tests/l2/case-08-recursion.fl +19 -0
- package/tests/l2/case-09-strings.fl +13 -0
- package/tests/l2/case-10-loops.fl +17 -0
- package/tests/l2/case-11-higher-order.fl +13 -0
- package/tests/l2/case-12-edge-cases.fl +14 -0
- package/tests/l2/case-13-ai-vector.fl +22 -0
- package/tests/l2/case-14-ai-cosine.fl +25 -0
- package/tests/l2/case-15-ai-template.fl +22 -0
- package/tests/l2/case-16-ai-ranking.fl +20 -0
- package/tests/l2/case-17-stdlib-extended.fl +32 -0
- package/tests/l2-proof/01-arithmetic.bootstrap.js +141 -0
- package/tests/l2-proof/01-arithmetic.fl +15 -0
- package/tests/l2-proof/01-arithmetic.stage1.js +141 -0
- package/tests/l2-proof/02-comparisons.bootstrap.js +141 -0
- package/tests/l2-proof/02-comparisons.fl +17 -0
- package/tests/l2-proof/03-logic.bootstrap.js +141 -0
- package/tests/l2-proof/03-logic.fl +15 -0
- package/tests/l2-proof/04-control-flow.bootstrap.js +146 -0
- package/tests/l2-proof/04-control-flow.fl +24 -0
- package/tests/l2-proof/05-functions.bootstrap.js +143 -0
- package/tests/l2-proof/05-functions.fl +16 -0
- package/tests/l2-proof/06-collections.bootstrap.js +146 -0
- package/tests/l2-proof/06-collections.fl +27 -0
- package/tests/l2-proof/07-pattern-matching.bootstrap.js +142 -0
- package/tests/l2-proof/07-pattern-matching.fl +23 -0
- package/tests/l2-proof/08-async-errors.bootstrap.js +142 -0
- package/tests/l2-proof/08-async-errors.fl +17 -0
- package/tests/l2-proof/09-strings.bootstrap.js +141 -0
- package/tests/l2-proof/09-strings.fl +13 -0
- package/tests/l2-proof/10-type-checks.bootstrap.js +141 -0
- package/tests/l2-proof/10-type-checks.fl +17 -0
- package/tests/l2-proof/11-recursion.bootstrap.js +143 -0
- package/tests/l2-proof/11-recursion.fl +21 -0
- package/tests/l2-proof/12-edge-cases.bootstrap.js +141 -0
- package/tests/l2-proof/12-edge-cases.fl +17 -0
- package/tests/parity/01-app-router-static.sh +18 -0
- package/tests/parity/02-app-router-dynamic.sh +18 -0
- package/tests/parity/03-layout-children.sh +17 -0
- package/tests/parity/04-not-found.sh +22 -0
- package/tests/parity/05-ssg.sh +21 -0
- package/tests/parity/06-parallel-render.sh +21 -0
- package/tests/parity/07-markdown.sh +16 -0
- package/tests/parity/08-rss-atom.sh +18 -0
- package/tests/parity/09-sitemap-robots.sh +23 -0
- package/tests/parity/10-jsonld.sh +16 -0
- package/tests/parity/11-blog-helpers.sh +28 -0
- package/tests/parity/12-api-routes.sh +25 -0
- package/tests/parity/_lib.sh +53 -0
- package/tests/parity/run-all.sh +89 -0
- package/tests/parity/score.sh +20 -0
- package/tests/phase-c-fuzzing.fl +89 -0
- package/tests/phase-c-property-testing.fl +137 -0
- package/tests/phase-c-sha-verification.fl +117 -0
- package/tests/phase-c-validation.fl +194 -0
- package/tests/property-testing.sh +47 -0
- package/tests/regen/let-in-expr-01.fl +5 -0
- package/tests/regen/let-in-expr-02.fl +6 -0
- package/tests/regen/let-in-expr-03.fl +4 -0
- package/tests/regen/let-in-expr-04.fl +6 -0
- package/tests/regen/let-in-expr-05.fl +5 -0
- package/tests/test-ai-library.fl +36 -0
- package/tests/test-andor.fl +2 -0
- package/tests/test-bootstrap-match.fl +5 -0
- package/tests/test-cg-final.fl +5 -0
- package/tests/test-cli.fl +19 -0
- package/tests/test-codegen.fl +4 -0
- package/tests/test-cond-flat.fl +1 -0
- package/tests/test-fl-exec-op.fl +1 -0
- package/tests/test-fp.fl +10 -0
- package/tests/test-funcs.fl +11 -0
- package/tests/test-fuzz-crash.fl +3 -0
- package/tests/test-http-get.fl +3 -0
- package/tests/test-json-load.fl +32 -0
- package/tests/test-let-flat.fl +2 -0
- package/tests/test-let-order.fl +3 -0
- package/tests/test-let-simple.fl +3 -0
- package/tests/test-let-syntax.fl +2 -0
- package/tests/test-let.fl +3 -0
- package/tests/test-lex-debug.fl +75 -0
- package/tests/test-loop-bug.fl +5 -0
- package/tests/test-map-entries.fl +1 -0
- package/tests/test-map-pattern.fl +3 -0
- package/tests/test-match-syntax.fl +5 -0
- package/tests/test-migrate-sample.fl +22 -0
- package/tests/test-neg.fl +1 -0
- package/tests/test-nested-let.fl +4 -0
- package/tests/test-node-to-pattern.fl +8 -0
- package/tests/test-quant-lib.fl +114 -0
- package/tests/test-reduce.fl +10 -0
- package/tests/test-server.fl +3 -0
- package/tests/test-simple-map.fl +4 -0
- package/tests/test-simple-match.fl +3 -0
- package/tests/test-simple.fl +1 -0
- package/tests/test-try-bootstrap.fl +7 -0
- package/tests/test-try-catch.fl +3 -0
- package/tests/test-watchdog-lib.fl +69 -0
- package/tests/test-which-lex.fl +4 -0
- package/tsconfig.json +39 -0
package/src/ast.ts
ADDED
|
@@ -0,0 +1,817 @@
|
|
|
1
|
+
// FreeLang v9: AST Node definitions
|
|
2
|
+
|
|
3
|
+
export type ASTNode =
|
|
4
|
+
| Block
|
|
5
|
+
| Literal
|
|
6
|
+
| TemplateString
|
|
7
|
+
| Variable
|
|
8
|
+
| SExpr
|
|
9
|
+
| Keyword
|
|
10
|
+
| TypeVariable
|
|
11
|
+
| PatternMatch
|
|
12
|
+
| Pattern
|
|
13
|
+
| FunctionValue
|
|
14
|
+
| TypeClass
|
|
15
|
+
| TypeClassInstance
|
|
16
|
+
| ModuleBlock
|
|
17
|
+
| ImportBlock
|
|
18
|
+
| OpenBlock
|
|
19
|
+
| SearchBlock
|
|
20
|
+
| LearnBlock
|
|
21
|
+
| ReasoningBlock
|
|
22
|
+
| ReasoningSequence
|
|
23
|
+
| AsyncFunction
|
|
24
|
+
| AwaitExpression
|
|
25
|
+
| TryBlock
|
|
26
|
+
| CatchClause
|
|
27
|
+
| ThrowExpression
|
|
28
|
+
| PageNode
|
|
29
|
+
| RouteNode
|
|
30
|
+
| ComponentNode
|
|
31
|
+
| FormNode;
|
|
32
|
+
|
|
33
|
+
// [BLOCK_TYPE name :key1 val1 :key2 val2 ...]
|
|
34
|
+
export interface Block {
|
|
35
|
+
kind: "block";
|
|
36
|
+
type: string; // "INTENT", "FUNC", "PROMPT", "PIPE", "AGENT"
|
|
37
|
+
name: string;
|
|
38
|
+
fields: Map<string, ASTNode | ASTNode[]>;
|
|
39
|
+
typeAnnotations?: Map<string, TypeAnnotation>; // :params and :return types (Phase 3)
|
|
40
|
+
generics?: string[]; // Generic type variables: ["T", "K", "V"] (Phase 4)
|
|
41
|
+
line?: number; // Phase 35: source line for error messages / source maps
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Literal values
|
|
45
|
+
export interface Literal {
|
|
46
|
+
kind: "literal";
|
|
47
|
+
type: "number" | "string" | "symbol" | "boolean" | "null";
|
|
48
|
+
value: string | number | boolean | null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Template string with ${expr} placeholders
|
|
52
|
+
export interface TemplateString {
|
|
53
|
+
kind: "template-string";
|
|
54
|
+
value: string;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// $varname
|
|
58
|
+
export interface Variable {
|
|
59
|
+
kind: "variable";
|
|
60
|
+
name: string;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// (symbol arg1 arg2 ...)
|
|
64
|
+
export interface SExpr {
|
|
65
|
+
kind: "sexpr";
|
|
66
|
+
op: string;
|
|
67
|
+
args: ASTNode[];
|
|
68
|
+
line?: number; // FreeLang source line number (for error reporting)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// :keyword
|
|
72
|
+
export interface Keyword {
|
|
73
|
+
kind: "keyword";
|
|
74
|
+
name: string;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// Type annotation (NEW for Phase 3)
|
|
78
|
+
export interface TypeAnnotation {
|
|
79
|
+
kind: "type";
|
|
80
|
+
name: string; // "int", "string", "bool", "array<int>", "map<string,int>", "Promise<int>", "T"
|
|
81
|
+
generic?: TypeAnnotation; // for array<T>, map<K,V>, Promise<T>
|
|
82
|
+
union?: TypeAnnotation[]; // for Type1 | Type2
|
|
83
|
+
optional?: boolean; // for Type?
|
|
84
|
+
isTypeVariable?: boolean; // true if this is a generic type variable (Phase 4)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Type variable reference (NEW for Phase 4 Generics)
|
|
88
|
+
export interface TypeVariable {
|
|
89
|
+
kind: "type-variable";
|
|
90
|
+
name: string; // "T", "K", "V", etc.
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Pattern nodes (NEW for Phase 4 Week 3-4 - Pattern Matching)
|
|
94
|
+
|
|
95
|
+
// Literal pattern: matches exact literal value (1, "hello", true)
|
|
96
|
+
export interface LiteralPattern {
|
|
97
|
+
kind: "literal-pattern";
|
|
98
|
+
type: "number" | "string" | "symbol" | "boolean";
|
|
99
|
+
value: string | number | boolean;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Variable pattern: binds matched value to variable (x, y)
|
|
103
|
+
export interface VariablePattern {
|
|
104
|
+
kind: "variable-pattern";
|
|
105
|
+
name: string; // variable name (without $)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// Wildcard pattern: matches any value, doesn't bind (_)
|
|
109
|
+
export interface WildcardPattern {
|
|
110
|
+
kind: "wildcard-pattern";
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// List pattern: destructures lists ([x & xs], [x y z])
|
|
114
|
+
export interface ListPattern {
|
|
115
|
+
kind: "list-pattern";
|
|
116
|
+
elements: Pattern[];
|
|
117
|
+
restElement?: string; // for [x & rest] syntax
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Struct pattern: destructures objects ({:name :age})
|
|
121
|
+
export interface StructPattern {
|
|
122
|
+
kind: "struct-pattern";
|
|
123
|
+
fields: Map<string, Pattern>; // field name -> pattern
|
|
124
|
+
asBinding?: string; // Phase 65: :as $varname — binds entire matched value
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// Or pattern: alternative patterns (1 | 2 | 3)
|
|
128
|
+
export interface OrPattern {
|
|
129
|
+
kind: "or-pattern";
|
|
130
|
+
alternatives: Pattern[]; // list of alternative patterns to try
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// Range pattern: (range min max) — matches min <= val < max (Phase 65)
|
|
134
|
+
export interface RangePattern {
|
|
135
|
+
kind: "range-pattern";
|
|
136
|
+
min: number;
|
|
137
|
+
max: number;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// Union of all pattern types
|
|
141
|
+
export type Pattern = LiteralPattern | VariablePattern | WildcardPattern | ListPattern | StructPattern | OrPattern | RangePattern;
|
|
142
|
+
|
|
143
|
+
// Pattern match expression: (match value case1 case2 ...)
|
|
144
|
+
export interface PatternMatch {
|
|
145
|
+
kind: "pattern-match";
|
|
146
|
+
value: ASTNode; // expression to match
|
|
147
|
+
cases: MatchCase[]; // pattern -> result pairs
|
|
148
|
+
defaultCase?: ASTNode; // optional default case
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// Single case in pattern match: (pattern body)
|
|
152
|
+
export interface MatchCase {
|
|
153
|
+
pattern: Pattern;
|
|
154
|
+
guard?: ASTNode; // optional guard condition (if expr)
|
|
155
|
+
body: ASTNode; // result expression
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// Function value (NEW for Phase 4 Week 1 - First-class functions)
|
|
159
|
+
export interface FunctionValue {
|
|
160
|
+
kind: "function-value";
|
|
161
|
+
params: string[]; // parameter names
|
|
162
|
+
body: ASTNode; // function body
|
|
163
|
+
capturedEnv: Map<string, any>; // closure environment
|
|
164
|
+
name?: string; // optional function name
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// Type Class Definition (NEW for Phase 5 Week 2)
|
|
168
|
+
// [TYPECLASS Monad [M]
|
|
169
|
+
// :methods [
|
|
170
|
+
// :pure (fn [a] (M a))
|
|
171
|
+
// :bind (fn [m f] (M b))
|
|
172
|
+
// :map (fn [m f] (M b))
|
|
173
|
+
// ]
|
|
174
|
+
// ]
|
|
175
|
+
export interface TypeClass {
|
|
176
|
+
kind: "type-class";
|
|
177
|
+
name: string; // e.g., "Monad", "Functor"
|
|
178
|
+
typeParams: string[]; // e.g., ["M"] or ["F"]
|
|
179
|
+
methods: Map<string, TypeClassMethod>; // method name → method signature
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export interface TypeClassMethod {
|
|
183
|
+
name: string;
|
|
184
|
+
type: ASTNode; // Function type (fn [a] (M a)), stored as AST
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// Type Class Instance (NEW for Phase 5 Week 2)
|
|
188
|
+
// [INSTANCE (Monad Result)
|
|
189
|
+
// :pure (fn [x] (ok x))
|
|
190
|
+
// :bind (fn [m f] (match m ...))
|
|
191
|
+
// :map (fn [m f] (match m ...))
|
|
192
|
+
// ]
|
|
193
|
+
export interface TypeClassInstance {
|
|
194
|
+
kind: "type-class-instance";
|
|
195
|
+
className: string; // e.g., "Monad"
|
|
196
|
+
concreteType: string; // e.g., "Result"
|
|
197
|
+
implementations: Map<string, ASTNode>; // method name → implementation (function value)
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// Module Definition (NEW for Phase 5 Week 3)
|
|
201
|
+
// [MODULE math
|
|
202
|
+
// :exports [add subtract multiply]
|
|
203
|
+
// :body [
|
|
204
|
+
// [FUNC add ...]
|
|
205
|
+
// [FUNC subtract ...]
|
|
206
|
+
// ]
|
|
207
|
+
// ]
|
|
208
|
+
export interface ModuleBlock {
|
|
209
|
+
kind: "module";
|
|
210
|
+
name: string;
|
|
211
|
+
exports: string[]; // exported function/intent names
|
|
212
|
+
body: ASTNode[]; // module body (FUNC, INTENT blocks)
|
|
213
|
+
path?: string; // optional file path for external modules
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// Import Block (NEW for Phase 5 Week 3)
|
|
217
|
+
// (import math)
|
|
218
|
+
// (import math :from "./math.fl")
|
|
219
|
+
// (import math :only [add multiply])
|
|
220
|
+
// (import math :as m)
|
|
221
|
+
export interface ImportBlock {
|
|
222
|
+
kind: "import";
|
|
223
|
+
moduleName: string;
|
|
224
|
+
source?: string; // optional :from path
|
|
225
|
+
selective?: string[]; // optional :only [names]
|
|
226
|
+
alias?: string; // optional :as alias
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// Open Block (NEW for Phase 5 Week 3)
|
|
230
|
+
// (open math) -- imports all exports to global scope
|
|
231
|
+
export interface OpenBlock {
|
|
232
|
+
kind: "open";
|
|
233
|
+
moduleName: string;
|
|
234
|
+
source?: string; // optional :from path
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// Search Block (NEW for Phase 9a)
|
|
238
|
+
// [search query :source "web"|"api"|"kb" :cache true|false :limit 5]
|
|
239
|
+
// Represents searching external data sources
|
|
240
|
+
export interface SearchBlock {
|
|
241
|
+
kind: "search-block";
|
|
242
|
+
query: string; // search query
|
|
243
|
+
source: "web" | "api" | "kb"; // data source: web (WebSearch), api (REST API), kb (Knowledge Base)
|
|
244
|
+
cache?: boolean; // whether to cache results (default: false)
|
|
245
|
+
limit?: number; // max number of results (default: 10)
|
|
246
|
+
name?: string; // optional name for this search
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// Learn Block (NEW for Phase 9b)
|
|
250
|
+
// (learn key data :source "search" :confidence 0.95)
|
|
251
|
+
// Represents learning and storing new information
|
|
252
|
+
export interface LearnBlock {
|
|
253
|
+
kind: "learn-block";
|
|
254
|
+
key: string; // learning key (identifier)
|
|
255
|
+
data: any; // data to learn
|
|
256
|
+
source?: "search" | "feedback" | "analysis"; // source of knowledge
|
|
257
|
+
confidence?: number; // confidence score (0-1)
|
|
258
|
+
timestamp?: string; // when learned (ISO 8601)
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// Reasoning Block (NEW for Phase 9c)
|
|
262
|
+
// (observe "facts") → (analyze :angle1 "perf" :angle2 "security") → (decide :choice "angle2")
|
|
263
|
+
// Represents AI reasoning with state transitions: observe → analyze → decide → act → verify
|
|
264
|
+
export interface ReasoningBlock {
|
|
265
|
+
kind: "reasoning-block";
|
|
266
|
+
stage: "observe" | "analyze" | "decide" | "act" | "verify"; // current reasoning stage
|
|
267
|
+
data: Map<string, any>; // stage-specific data
|
|
268
|
+
observations?: any[]; // facts gathered (observe stage)
|
|
269
|
+
analysis?: any[]; // analysis results (analyze stage)
|
|
270
|
+
decisions?: any[]; // decisions made (decide stage)
|
|
271
|
+
actions?: any[]; // actions taken (act stage)
|
|
272
|
+
verifications?: any[]; // verification results (verify stage)
|
|
273
|
+
transitions?: ReasoningTransition[]; // state transitions
|
|
274
|
+
metadata?: { // metadata for reasoning
|
|
275
|
+
startTime?: string; // when reasoning started (ISO 8601)
|
|
276
|
+
endTime?: string; // when reasoning ended (ISO 8601)
|
|
277
|
+
confidence?: number; // overall confidence (0-1)
|
|
278
|
+
feedback?: string; // feedback from verification
|
|
279
|
+
};
|
|
280
|
+
// Phase 9c: Conditional branching (if/when/then/else)
|
|
281
|
+
conditional?: {
|
|
282
|
+
condition: ASTNode; // condition to evaluate (e.g., "confidence > 0.8")
|
|
283
|
+
thenBlock: ReasoningBlock; // block to execute if true
|
|
284
|
+
elseBlock?: ReasoningBlock; // block to execute if false (optional)
|
|
285
|
+
};
|
|
286
|
+
// Phase 9c: When (guard clause - block only executes if condition is true)
|
|
287
|
+
whenGuard?: ASTNode; // guard condition (block skipped if false)
|
|
288
|
+
// Phase 9c: Loop Control (repeat-until / repeat-while)
|
|
289
|
+
loopControl?: {
|
|
290
|
+
type: "repeat-until" | "repeat-while"; // loop type
|
|
291
|
+
condition: ASTNode; // termination condition
|
|
292
|
+
maxIterations?: number; // safety limit (default: 1000)
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
// Reasoning Transition (NEW for Phase 9c)
|
|
297
|
+
// Describes transition from one reasoning stage to next
|
|
298
|
+
export interface ReasoningTransition {
|
|
299
|
+
from: string; // source stage
|
|
300
|
+
to: string; // target stage
|
|
301
|
+
condition?: ASTNode; // guard condition for transition
|
|
302
|
+
action?: ASTNode; // action to execute on transition
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
// Reasoning Sequence (NEW for Phase 9c Extension)
|
|
306
|
+
// (reasoning-sequence (observe ...) (analyze ...) (decide ...) (act ...) (verify ...))
|
|
307
|
+
// Represents a complete reasoning flow with automatic state transitions
|
|
308
|
+
export interface ReasoningSequence {
|
|
309
|
+
kind: "reasoning-sequence";
|
|
310
|
+
stages: (ReasoningBlock | SearchBlock | LearnBlock)[]; // Phase 9a/9b: allow search/learn blocks
|
|
311
|
+
metadata?: {
|
|
312
|
+
startTime?: string;
|
|
313
|
+
endTime?: string;
|
|
314
|
+
totalConfidence?: number;
|
|
315
|
+
executionPath?: string[]; // sequence of stages executed
|
|
316
|
+
};
|
|
317
|
+
// Phase 9a/9b: Store search and learn results for access in subsequent stages
|
|
318
|
+
context?: {
|
|
319
|
+
searches?: Map<string, any>; // cached search results
|
|
320
|
+
learned?: Map<string, any>; // stored learned data
|
|
321
|
+
};
|
|
322
|
+
feedbackLoop?: {
|
|
323
|
+
enabled: boolean; // Phase 9c Feedback: enable feedback loop
|
|
324
|
+
fromStage: "verify" | "act"; // which stage triggers feedback
|
|
325
|
+
toStage: "analyze" | "decide"; // which stage to return to
|
|
326
|
+
condition?: ASTNode; // feedback condition (e.g., confidence < 0.8)
|
|
327
|
+
maxIterations?: number; // max loop iterations (default: 3)
|
|
328
|
+
confidenceDamping?: number; // confidence reduction per iteration (default: 0.1)
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
// Async Function (NEW for Phase 7)
|
|
333
|
+
// [async name [params] body]
|
|
334
|
+
// Returns Promise<T> where T is the return type of body
|
|
335
|
+
export interface AsyncFunction {
|
|
336
|
+
kind: "async-function";
|
|
337
|
+
name: string; // function name
|
|
338
|
+
params: Array<{ name: string; type?: TypeAnnotation }>; // parameter list
|
|
339
|
+
body: ASTNode; // function body
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
// Await Expression (NEW for Phase 7)
|
|
343
|
+
// (await promise-expression)
|
|
344
|
+
// Extracts value from Promise<T> → T
|
|
345
|
+
export interface AwaitExpression {
|
|
346
|
+
kind: "await";
|
|
347
|
+
argument: ASTNode; // expression that evaluates to Promise<T>
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
// Try-Catch-Finally Block (NEW for Phase 11)
|
|
351
|
+
// (try body (catch [pattern] handler) (finally cleanup))
|
|
352
|
+
// Represents error handling with catch clauses and optional finally block
|
|
353
|
+
export interface TryBlock {
|
|
354
|
+
kind: "try-block";
|
|
355
|
+
body: ASTNode; // try body
|
|
356
|
+
catchClauses?: CatchClause[]; // catch clauses (optional)
|
|
357
|
+
finallyBlock?: ASTNode; // finally block (optional)
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
// Catch Clause (NEW for Phase 11)
|
|
361
|
+
// Part of try-catch: (catch [IOError err] (print "File error: " err))
|
|
362
|
+
export interface CatchClause {
|
|
363
|
+
kind: "catch-clause";
|
|
364
|
+
pattern?: Pattern; // optional error pattern (e.g., [IOError], [err])
|
|
365
|
+
variable?: string; // optional error variable name
|
|
366
|
+
handler: ASTNode; // catch body
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
// Throw Expression (NEW for Phase 11)
|
|
370
|
+
// (throw error-expression) or (throw "message")
|
|
371
|
+
// Throws an error/exception
|
|
372
|
+
export interface ThrowExpression {
|
|
373
|
+
kind: "throw";
|
|
374
|
+
argument: ASTNode; // error expression to throw
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
// Web DSL Nodes (NEW for Phase 11 - Web Keywords Integration)
|
|
378
|
+
|
|
379
|
+
// PAGE Block: [PAGE name :title "..." :route "/" :component ComponentName]
|
|
380
|
+
export interface PageNode {
|
|
381
|
+
kind: "page";
|
|
382
|
+
name: string;
|
|
383
|
+
title?: string;
|
|
384
|
+
route?: string;
|
|
385
|
+
component?: string;
|
|
386
|
+
metadata?: Map<string, any>;
|
|
387
|
+
line?: number;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
// ROUTE Block: [ROUTE name :path "/api/users/:id" :method "GET" :handler handlerName]
|
|
391
|
+
export interface RouteNode {
|
|
392
|
+
kind: "route";
|
|
393
|
+
name: string;
|
|
394
|
+
path?: string;
|
|
395
|
+
method?: string; // GET, POST, PUT, DELETE, PATCH
|
|
396
|
+
handler?: string;
|
|
397
|
+
middleware?: string[];
|
|
398
|
+
validation?: string;
|
|
399
|
+
line?: number;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
// COMPONENT Block: [COMPONENT name :render renderFn :state stateName :methods [...]]
|
|
403
|
+
export interface ComponentNode {
|
|
404
|
+
kind: "component";
|
|
405
|
+
name: string;
|
|
406
|
+
render?: string;
|
|
407
|
+
state?: string;
|
|
408
|
+
computed?: string[];
|
|
409
|
+
watch?: Map<string, string>;
|
|
410
|
+
methods?: Map<string, string>;
|
|
411
|
+
slots?: string[];
|
|
412
|
+
line?: number;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
// FORM Block: [FORM name :fields [...] :validation validationFn :submit submitFn]
|
|
416
|
+
export interface FormNode {
|
|
417
|
+
kind: "form";
|
|
418
|
+
name: string;
|
|
419
|
+
fields?: Map<string, any>;
|
|
420
|
+
validation?: string;
|
|
421
|
+
submit?: string;
|
|
422
|
+
handlers?: Map<string, string>;
|
|
423
|
+
line?: number;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
// Function signature (NEW for Phase 3)
|
|
427
|
+
export interface FuncSignature {
|
|
428
|
+
name: string;
|
|
429
|
+
params: Array<{ name: string; type: TypeAnnotation }>;
|
|
430
|
+
returnType: TypeAnnotation;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
// Parser state
|
|
434
|
+
export interface ParserState {
|
|
435
|
+
tokens: any[];
|
|
436
|
+
pos: number;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
// Helpers
|
|
440
|
+
export function makeLiteral(type: "number" | "string" | "symbol" | "boolean" | "null", value: any, line?: number): Literal {
|
|
441
|
+
return { kind: "literal", type, value, line } as any;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
export function makeTemplateString(value: string, line?: number): TemplateString {
|
|
445
|
+
return { kind: "template-string", value, line } as any;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
export function makeVariable(name: string, line?: number): Variable {
|
|
449
|
+
return { kind: "variable", name, line } as any;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
export function makeSExpr(op: string, args: ASTNode[], line?: number): SExpr {
|
|
453
|
+
return { kind: "sexpr", op, args, line };
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
export function makeKeyword(name: string): Keyword {
|
|
457
|
+
return { kind: "keyword", name };
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
export function makeBlock(type: string, name: string, fields: Map<string, ASTNode | ASTNode[]>, line?: number): Block {
|
|
461
|
+
return { kind: "block", type, name, fields, line };
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
// Helper: Create type annotation (Phase 3)
|
|
465
|
+
export function makeTypeAnnotation(
|
|
466
|
+
name: string,
|
|
467
|
+
generic?: TypeAnnotation,
|
|
468
|
+
union?: TypeAnnotation[],
|
|
469
|
+
optional?: boolean
|
|
470
|
+
): TypeAnnotation {
|
|
471
|
+
return { kind: "type", name, generic, union, optional };
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
// Helper: Create function signature (Phase 3)
|
|
475
|
+
export function makeFuncSignature(
|
|
476
|
+
name: string,
|
|
477
|
+
params: Array<{ name: string; type: TypeAnnotation }>,
|
|
478
|
+
returnType: TypeAnnotation
|
|
479
|
+
): FuncSignature {
|
|
480
|
+
return { name, params, returnType };
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
// Helper: Create type variable (Phase 4)
|
|
484
|
+
export function makeTypeVariable(name: string): TypeVariable {
|
|
485
|
+
return { kind: "type-variable", name };
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
// Helper: Create function value (Phase 4 Week 1)
|
|
489
|
+
export function makeFunctionValue(
|
|
490
|
+
params: string[],
|
|
491
|
+
body: ASTNode,
|
|
492
|
+
capturedEnv: Map<string, any>,
|
|
493
|
+
name?: string
|
|
494
|
+
): FunctionValue {
|
|
495
|
+
return { kind: "function-value", params, body, capturedEnv, name };
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
// Helpers: Create patterns (Phase 4 Week 3-4)
|
|
499
|
+
|
|
500
|
+
export function makeLiteralPattern(
|
|
501
|
+
type: "number" | "string" | "symbol" | "boolean",
|
|
502
|
+
value: string | number | boolean
|
|
503
|
+
): LiteralPattern {
|
|
504
|
+
return { kind: "literal-pattern", type, value };
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
export function makeVariablePattern(name: string): VariablePattern {
|
|
508
|
+
return { kind: "variable-pattern", name };
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
export function makeWildcardPattern(): WildcardPattern {
|
|
512
|
+
return { kind: "wildcard-pattern" };
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
export function makeListPattern(elements: Pattern[], restElement?: string): ListPattern {
|
|
516
|
+
return { kind: "list-pattern", elements, restElement };
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
export function makeStructPattern(fields: Map<string, Pattern>, asBinding?: string): StructPattern {
|
|
520
|
+
return { kind: "struct-pattern", fields, asBinding };
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
export function makeRangePattern(min: number, max: number): RangePattern {
|
|
524
|
+
return { kind: "range-pattern", min, max };
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
export function makeOrPattern(alternatives: Pattern[]): OrPattern {
|
|
528
|
+
return { kind: "or-pattern", alternatives };
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
export function makeMatchCase(pattern: Pattern, body: ASTNode, guard?: ASTNode): MatchCase {
|
|
532
|
+
return { pattern, guard, body };
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
export function makePatternMatch(value: ASTNode, cases: MatchCase[], defaultCase?: ASTNode): PatternMatch {
|
|
536
|
+
return { kind: "pattern-match", value, cases, defaultCase };
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
// Helper: Create type class (Phase 5 Week 2)
|
|
540
|
+
export function makeTypeClass(
|
|
541
|
+
name: string,
|
|
542
|
+
typeParams: string[],
|
|
543
|
+
methods: Map<string, TypeClassMethod>
|
|
544
|
+
): TypeClass {
|
|
545
|
+
return { kind: "type-class", name, typeParams, methods };
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
// Helper: Create type class instance (Phase 5 Week 2)
|
|
549
|
+
export function makeTypeClassInstance(
|
|
550
|
+
className: string,
|
|
551
|
+
concreteType: string,
|
|
552
|
+
implementations: Map<string, ASTNode>
|
|
553
|
+
): TypeClassInstance {
|
|
554
|
+
return { kind: "type-class-instance", className, concreteType, implementations };
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
// Helper: Create module block (Phase 5 Week 3)
|
|
558
|
+
export function makeModuleBlock(
|
|
559
|
+
name: string,
|
|
560
|
+
exports: string[],
|
|
561
|
+
body: ASTNode[],
|
|
562
|
+
path?: string
|
|
563
|
+
): ModuleBlock {
|
|
564
|
+
return { kind: "module", name, exports, body, path };
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
// Helper: Create import block (Phase 5 Week 3)
|
|
568
|
+
export function makeImportBlock(
|
|
569
|
+
moduleName: string,
|
|
570
|
+
source?: string,
|
|
571
|
+
selective?: string[],
|
|
572
|
+
alias?: string
|
|
573
|
+
): ImportBlock {
|
|
574
|
+
return { kind: "import", moduleName, source, selective, alias };
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
// Helper: Create open block (Phase 5 Week 3)
|
|
578
|
+
export function makeOpenBlock(moduleName: string, source?: string): OpenBlock {
|
|
579
|
+
return { kind: "open", moduleName, source };
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
// Helper: Create async function (Phase 7)
|
|
583
|
+
export function makeAsyncFunction(
|
|
584
|
+
name: string,
|
|
585
|
+
params: Array<{ name: string; type?: TypeAnnotation }>,
|
|
586
|
+
body: ASTNode
|
|
587
|
+
): AsyncFunction {
|
|
588
|
+
return { kind: "async-function", name, params, body };
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
// Helper: Create await expression (Phase 7)
|
|
592
|
+
export function makeAwaitExpression(argument: ASTNode): AwaitExpression {
|
|
593
|
+
return { kind: "await", argument };
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
// Helper: Create try block (Phase 11)
|
|
597
|
+
export function makeTryBlock(
|
|
598
|
+
body: ASTNode,
|
|
599
|
+
catchClauses?: CatchClause[],
|
|
600
|
+
finallyBlock?: ASTNode
|
|
601
|
+
): TryBlock {
|
|
602
|
+
return { kind: "try-block", body, catchClauses, finallyBlock };
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
// Helper: Create catch clause (Phase 11)
|
|
606
|
+
export function makeCatchClause(
|
|
607
|
+
handler: ASTNode,
|
|
608
|
+
pattern?: Pattern,
|
|
609
|
+
variable?: string
|
|
610
|
+
): CatchClause {
|
|
611
|
+
return { kind: "catch-clause", pattern, variable, handler };
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
// Helper: Create throw expression (Phase 11)
|
|
615
|
+
export function makeThrowExpression(argument: ASTNode): ThrowExpression {
|
|
616
|
+
return { kind: "throw", argument };
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
// Helper: Create page node (Phase 11 - Web DSL)
|
|
620
|
+
export function makePageNode(
|
|
621
|
+
name: string,
|
|
622
|
+
title?: string,
|
|
623
|
+
route?: string,
|
|
624
|
+
component?: string,
|
|
625
|
+
metadata?: Map<string, any>,
|
|
626
|
+
line?: number
|
|
627
|
+
): PageNode {
|
|
628
|
+
return { kind: "page", name, title, route, component, metadata, line };
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
// Helper: Create route node (Phase 11 - Web DSL)
|
|
632
|
+
export function makeRouteNode(
|
|
633
|
+
name: string,
|
|
634
|
+
path?: string,
|
|
635
|
+
method?: string,
|
|
636
|
+
handler?: string,
|
|
637
|
+
middleware?: string[],
|
|
638
|
+
validation?: string,
|
|
639
|
+
line?: number
|
|
640
|
+
): RouteNode {
|
|
641
|
+
return { kind: "route", name, path, method, handler, middleware, validation, line };
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
// Helper: Create component node (Phase 11 - Web DSL)
|
|
645
|
+
export function makeComponentNode(
|
|
646
|
+
name: string,
|
|
647
|
+
render?: string,
|
|
648
|
+
state?: string,
|
|
649
|
+
computed?: string[],
|
|
650
|
+
watch?: Map<string, string>,
|
|
651
|
+
methods?: Map<string, string>,
|
|
652
|
+
slots?: string[],
|
|
653
|
+
line?: number
|
|
654
|
+
): ComponentNode {
|
|
655
|
+
return { kind: "component", name, render, state, computed, watch, methods, slots, line };
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
// Helper: Create form node (Phase 11 - Web DSL)
|
|
659
|
+
export function makeFormNode(
|
|
660
|
+
name: string,
|
|
661
|
+
fields?: Map<string, any>,
|
|
662
|
+
validation?: string,
|
|
663
|
+
submit?: string,
|
|
664
|
+
handlers?: Map<string, string>,
|
|
665
|
+
line?: number
|
|
666
|
+
): FormNode {
|
|
667
|
+
return { kind: "form", name, fields, validation, submit, handlers, line };
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
// Helper: Create reasoning block (Phase 9c)
|
|
671
|
+
export function makeReasoningBlock(
|
|
672
|
+
stage: "observe" | "analyze" | "decide" | "act" | "verify",
|
|
673
|
+
data: Map<string, any>,
|
|
674
|
+
observations?: any[],
|
|
675
|
+
analysis?: any[],
|
|
676
|
+
decisions?: any[],
|
|
677
|
+
actions?: any[],
|
|
678
|
+
verifications?: any[],
|
|
679
|
+
transitions?: ReasoningTransition[],
|
|
680
|
+
metadata?: { startTime?: string; endTime?: string; confidence?: number; feedback?: string }
|
|
681
|
+
): ReasoningBlock {
|
|
682
|
+
return {
|
|
683
|
+
kind: "reasoning-block",
|
|
684
|
+
stage,
|
|
685
|
+
data,
|
|
686
|
+
observations,
|
|
687
|
+
analysis,
|
|
688
|
+
decisions,
|
|
689
|
+
actions,
|
|
690
|
+
verifications,
|
|
691
|
+
transitions,
|
|
692
|
+
metadata
|
|
693
|
+
};
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
// Helper: Create reasoning transition (Phase 9c)
|
|
697
|
+
export function makeReasoningTransition(
|
|
698
|
+
from: string,
|
|
699
|
+
to: string,
|
|
700
|
+
condition?: ASTNode,
|
|
701
|
+
action?: ASTNode
|
|
702
|
+
): ReasoningTransition {
|
|
703
|
+
return { from, to, condition, action };
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
// Helper: Create reasoning sequence (Phase 9c Extension)
|
|
707
|
+
export function makeReasoningSequence(
|
|
708
|
+
stages: ReasoningBlock[],
|
|
709
|
+
metadata?: {
|
|
710
|
+
startTime?: string;
|
|
711
|
+
endTime?: string;
|
|
712
|
+
totalConfidence?: number;
|
|
713
|
+
executionPath?: string[];
|
|
714
|
+
}
|
|
715
|
+
): ReasoningSequence {
|
|
716
|
+
return { kind: "reasoning-sequence", stages, metadata };
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
// ============================================================
|
|
720
|
+
// Phase 6: Type Guard Functions (타입 안전성 강화)
|
|
721
|
+
// ============================================================
|
|
722
|
+
|
|
723
|
+
// Block 타입 가드
|
|
724
|
+
export function isBlock(node: any): node is Block {
|
|
725
|
+
return node && node.kind === "block";
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
// Literal 타입 가드
|
|
729
|
+
export function isLiteral(node: any): node is Literal {
|
|
730
|
+
return node && node.kind === "literal";
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
// Symbol 리터럴 가드
|
|
734
|
+
export function isSymbolLiteral(node: any): node is Literal {
|
|
735
|
+
return isLiteral(node) && node.type === "symbol";
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
// 배열 블록 가드 (특수: [Array ...] 형식)
|
|
739
|
+
export function isArrayBlock(node: any): node is Block {
|
|
740
|
+
return isBlock(node) && node.type === "Array";
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
// FUNC 블록 가드
|
|
744
|
+
export function isFuncBlock(node: any): node is Block {
|
|
745
|
+
return isBlock(node) && node.type === "FUNC";
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
// Variable 타입 가드
|
|
749
|
+
export function isVariable(node: any): node is Variable {
|
|
750
|
+
return node && node.kind === "variable";
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
// SExpr 타입 가드
|
|
754
|
+
export function isSExpr(node: any): node is SExpr {
|
|
755
|
+
return node && node.kind === "sexpr";
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
// ModuleBlock 타입 가드
|
|
759
|
+
export function isModuleBlock(node: any): node is ModuleBlock {
|
|
760
|
+
return node && node.kind === "module";
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
// ImportBlock 타입 가드
|
|
764
|
+
export function isImportBlock(node: any): node is ImportBlock {
|
|
765
|
+
return node && node.kind === "import";
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
// OpenBlock 타입 가드
|
|
769
|
+
export function isOpenBlock(node: any): node is OpenBlock {
|
|
770
|
+
return node && node.kind === "open";
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
// SearchBlock 타입 가드 (NEW for Phase 9a)
|
|
774
|
+
export function isSearchBlock(node: any): node is SearchBlock {
|
|
775
|
+
return node && node.kind === "search-block";
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
// LearnBlock 타입 가드 (NEW for Phase 9b)
|
|
779
|
+
export function isLearnBlock(node: any): node is LearnBlock {
|
|
780
|
+
return node && node.kind === "learn-block";
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
// ReasoningBlock 타입 가드 (NEW for Phase 9c)
|
|
784
|
+
export function isReasoningBlock(node: any): node is ReasoningBlock {
|
|
785
|
+
return node && node.kind === "reasoning-block";
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
// ReasoningSequence 타입 가드 (NEW for Phase 9c Extension)
|
|
789
|
+
export function isReasoningSequence(node: any): node is ReasoningSequence {
|
|
790
|
+
return node && node.kind === "reasoning-sequence";
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
// TryBlock 타입 가드 (NEW for Phase 11)
|
|
794
|
+
export function isTryBlock(node: any): node is TryBlock {
|
|
795
|
+
return node && node.kind === "try-block";
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
// CatchClause 타입 가드 (NEW for Phase 11)
|
|
799
|
+
export function isCatchClause(node: any): node is CatchClause {
|
|
800
|
+
return node && node.kind === "catch-clause";
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
// ThrowExpression 타입 가드 (NEW for Phase 11)
|
|
804
|
+
export function isThrowExpression(node: any): node is ThrowExpression {
|
|
805
|
+
return node && node.kind === "throw";
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
// 제어 블록 타입 목록 (eval()에서 직접 평가되어서는 안 되는 블록들)
|
|
809
|
+
export const CONTROL_BLOCK_TYPES: string[] = [
|
|
810
|
+
"FUNC", "SERVER", "ROUTE", "INTENT", "MIDDLEWARE",
|
|
811
|
+
"WEBSOCKET", "ERROR-HANDLER", "TYPECLASS", "INSTANCE", "MODULE"
|
|
812
|
+
];
|
|
813
|
+
|
|
814
|
+
// 제어 블록 타입 가드 (이미 Block임을 알고 있을 때)
|
|
815
|
+
export function isControlBlock(node: Block): boolean {
|
|
816
|
+
return CONTROL_BLOCK_TYPES.includes(node.type);
|
|
817
|
+
}
|