Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
editor
[Exprimental] Online IDE for kin-lang
# Kin online editor (experimental)

Web playground for [Kin](https://github.com/kin-lang/kin).

## Notes

- The playground runs a **single buffer** in the browser.
- Multi-file modules (`koresha "…" nka alias` / `emerera_gukoresha`) need the **CLI**
(`kin run entry.kin`) so files can be loaded from disk. See `examples/importing/`
in the language repo and the [Modules](https://kinlang.vercel.app/docs/language-structure/Modules) docs.
- Typed samples and OOP/`ubwoko` printing are aligned with recent Kin releases when
`@kin-lang/kin` is updated in this package.
23 changes: 23 additions & 0 deletions lib/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,29 @@ export function matchType(arg: RuntimeVal): any {
internal: false,
};
}
case "class": {
const c = arg as RuntimeVal & { name?: string };
return c.name ?? "imiterere";
}
case "instance": {
const inst = arg as RuntimeVal & {
klass?: { name?: string };
fields?: Map<string, RuntimeVal>;
};
const fields: { [key: string]: unknown } = {};
inst.fields?.forEach((value, key) => {
fields[key] = matchType(value);
});
return `${inst.klass?.name ?? "instance"} ${JSON.stringify(fields)}`;
}
case "type-val": {
const t = arg as RuntimeVal & { name?: string };
return t.name ?? "type-val";
}
case "bound-method": {
const bm = arg as RuntimeVal & { method?: { name?: string } };
return `<method ${bm.method?.name ?? "?"}>`;
}
default:
return arg;
}
Expand Down