Home /Modules/tests/README.md

README.md

tests/sleela-syntax-1.9/README.md · 77 line(s) · markdown

<img align="right" src="https://github.com/mearvk/SLeeLa/blob/master/images/debian/debian-logo.png" width="75" height="75" alt="SLeeLa">

SLeeLa syntax 1.9 regression fixtures

These fixtures exercise the syntax 1.9 feature: the GC-hint statement x = gc N; / x = mem N;, a developer-emitted request for a short-term garbage-collection cleanup of unreachable allocations after a value is done being used. N is a 0..100 aggressiveness (0 is a no-op; higher runs a larger young-only safepoint collection; 100 requests a full collection). The bare form x = gc; defaults to a modest cleanup. Both the gc and mem spellings are accepted and are contextual — gc/mem remain ordinary identifiers everywhere except as the whole right-hand side of an assignment.

Passing:

Correctness under scale and liveness:

Failing (must produce an explicit semantic error):

Negative/edge forms exercised during review (behave as ordinary code, not hints): x = gc -5; parses as the expression gc - 5 (so gc/mem stay usable as variables); x = gc.field; is a member access; x = gc 1.5; is a syntax error (a double is not a valid aggressiveness); an out-of-scope target is rejected.

The ran:: system namespace (§13.4):

The qualifier ran is contextual (special only immediately before ::), so ran/mem/gc are also valid struct field names and plain variables; this is exercised in the pass fixture.

Run them from the repository root after building the native compiler:

make -C impl
impl/build/sleela run tests/sleela-syntax-1.9/gc-hint-pass.sleela
impl/build/sleela run tests/sleela-syntax-1.9/gc-hint-contextual.sleela
impl/build/sleela run tests/sleela-syntax-1.9/gc-hint-range-invalid.sleela
impl/build/sleela run tests/sleela-syntax-1.9/gc-hint-version-invalid.sleela

The -invalid commands are expected to fail with an explicit semantic error. The GC hint reclaims only genuinely unreachable objects; it never frees a live value, and (like every collection safepoint) it is deferred while worker threads are active.