Commit Graph

12 Commits

Author SHA1 Message Date
Michael Schimmel beb693a068 Refactor: Implement block scoping and statement separation
This commit introduces fundamental changes to Myc's language structure
to enhance type safety and scoping clarity.

Key changes include:
- Introducing local scopes for `do` blocks.
- Separating statements (`def`, `assign`) from expressions, where
  statements now have no return value and are only allowed within
  blocks.
- A block now consists of multiple statements followed by a single final
  expression.
- Stricter validation rules are enforced, such as disallowing
  redefinition of local symbols in the same scope while allowing
  shadowing of outer symbols.
- Compiler errors are generated for statements used in expression
  contexts.

The implementation involved modifications to the AST, parser, binder
(scope-stack), and various compiler passes, along with VM runtime
optimizations.
2026-03-09 16:38:44 +01:00
Michael Schimmel d1b8d03604 Update benchmark and repeat counts
This commit updates the benchmark and repeat counts for various example
files. These changes reflect potential performance improvements or
variations observed during testing.
2026-03-03 18:55:31 +01:00
Michael Schimmel 096f166153 Update benchmark numbers
These changes update the benchmark numbers and repeat counts in the
example files. The benchmark results have slightly varied, and these
updates reflect the most recent measurements.
2026-02-28 16:02:38 +01:00
Michael Schimmel 2cc47c557b Update benchmark results
This commit updates the benchmark results for various examples. The
benchmark times and repeat counts have been adjusted to reflect current
performance characteristics.
2026-02-28 14:27:54 +01:00
Michael Schimmel c03b2af770 Update benchmark numbers in examples
This commit updates the benchmark numbers in various example files. The
changes reflect recent performance optimizations or adjustments to the
benchmarking environment.
2026-02-22 16:13:11 +01:00
Michael Schimmel 5a017fb932 Update benchmark tests with filtering 2026-02-22 12:07:58 +01:00
Michael Schimmel 0ed52a811d Update benchmark metadata
This commit updates the benchmark metadata in several example files. The
benchmark runs and repeat counts have been slightly adjusted due to
optimizations or minor variations in execution.
2026-02-22 01:37:00 +01:00
Michael Schimmel 9222fb5bc8 Update benchmark results
The benchmark results in several example files have been updated. This
commit reflects slight variations in performance measurements for
various test cases, including closure scope, data structures,
destructuring, higher-order functions, macros, and tuple operations.
2026-02-21 15:16:36 +01:00
Michael Schimmel 9072cfaa14 Update benchmark timings and repeats
This commit updates the benchmark timings and repeat counts for various
example files. The `tester.rs` script has been modified to:

- Correctly parse and use the `Benchmark-Repeat` directive.
- Implement an adaptive sampling mechanism for more accurate median
  calculation, especially for long-running benchmarks.
- Improve the logic for updating and inserting benchmark and repeat
  lines in example files.
- Handle potential compilation and runtime errors during benchmark
  execution.
2026-02-20 17:11:13 +01:00
Michael Schimmel 4f849ebd34 Refactor type inference for collections
The type inference for collections (tuples, vectors, matrices, and
records) has been significantly refactored.

This includes:
- Introducing distinct `StaticType` variants for `Tuple`, `Vector`, and
  `Matrix`.
- Implementing more robust type checking for these collections, allowing
  for homogeneous and heterogeneous structures.
- Enhancing the `is_assignable_from` method to handle type compatibility
  between these collection types.
- Updating `Value::static_type()` to correctly infer the types of
  literal collections.
- Improving the type inference for map literals to create `Record`
  types.
- Adding comprehensive unit tests for tuple, vector, matrix, and record
  type inference.
2026-02-20 10:19:29 +01:00
Michael Schimmel 7e54b3f443 Add benchmark button to UI
The benchmark button is only enabled in release builds. If clicked, it
will trigger the benchmark suite.
2026-02-18 21:46:50 +01:00
Michael Schimmel 76586c0903 Refactor: Use Symbol for identifiers and macro hygiene
Introduces a `Symbol` struct to represent identifiers, incorporating
macro hygiene context. Updates various parts of the AST compiler and
environment to use `Symbol` instead of raw `Rc<str>` for identifiers,
improving robustness for macro expansions.

Also includes:
- Adds a new example `macro_hygiene.myc`.
- Updates `.gitignore`.
- Refactors `MacroExpander` to use `ExpansionState` for cleaner template
  expansion.
- Adjusts `VM::eval_observed` to ensure `after_eval` is called
  correctly.
- Resets `Environment` for each test run and compilation/dumping in
  `main.rs`.
2026-02-18 14:32:09 +01:00