RecurLoop/ Documentation
LanguageKit/Guidesv0.2.12

LanguageKit

LanguageKit supplies reusable tools for source-defined vocabularies: growable text, token readers, phrase-aware parsing, managed values and cross-language bindings. Import it when writing a language extension or using its native helpers directly.

First example

recurloop
import language-kit
let make_message = fn () -> u8* {
    let text = LanguageKit:Text:new()
    if !text { return cast(u8*, 0) }
    defer text.destroy()
    if !text.append("Hello, ") || !text.append("RecurLoop") { return cast(u8*, 0) }
    return text.take()
}
let demonstrate = fn () -> i64 {
    let message = make_message()
    if !message { return 1 }
    defer free(message)
    return strcmp(message, "Hello, RecurLoop") != 0
}
assert demonstrate() == 0

Choose a facility

FacilityUse it for
Textbuild owned null-terminated byte strings
Readerconsume the active source cursor
SliceReaderinspect a bounded, borrowed byte slice
Phrase readersrespect aliases and the active grammar
Value and publishexchange data between vocabularies
Lifetimescope-owned resources and weak handles

Native pointers and runtime values have different ownership; avoid replacing a documented release operation with free merely because the representation contains a pointer.

Learning path

  1. Text buffers — Build strings and transfer their buffers.
  2. Source readers — Inspect and consume source without losing ownership.
  3. Grammar parsing — Respect the active phrase grammar and aliases.
  4. Shared values — Publish values and callbacks between vocabularies.
  5. Managed lifetimes — Manage adopted resources and weak references.