jsk-language
v1.0.0
Published
A JavaScript/Node.js interpreter for the .jsk programming language.
Downloads
20
Readme
.jsk
.jsk is a small JavaScript-inspired programming language implemented in modern Node.js with ES Modules. It uses a lexer → parser → AST → interpreter → runtime architecture.
Install
From the project directory:
npm install
npm linkNo third-party dependencies are required.
Run
jsk file.jskSyntax
Variables
factor name = "World";
factor age = 20;factor is the .jsk declaration keyword corresponding to JavaScript-style variables.
Functions
undef greet(name) {
printWrd("Hello " + name);
}
greet("World");Classes
Classes use grade and methods use undef:
grade Person {
undef init(name) {
printWrd(name);
}
}printWrd
printWrd("Hello World");if / else
A single = inside an if condition is treated as equality comparison by the .jsk grammar:
factor name = "text";
if name = "text" {
printWrd("hi");
} else {
printWrd("bye");
}try / else
try (
printWrd(unknown);
) else (
printWrd("An error occurred");
)This maps conceptually to JavaScript try/catch.
HTML system API
.jsk provides system.createElement(), dynamic system.<elementName>(), and finishElement():
factor cds = system.createElement("cds") {
systemType: "code";
systemLanguageType: "html";
}
finishElement();
system.cds({
<h1>contoh</h1>
});The runtime keeps named system elements and can render their content as HTML. The lexer/parser also preserve the ordinary .jsk grammar around the API.
Architecture
.jsk source
↓
Lexer (source → tokens)
↓
Parser (tokens → AST)
↓
Interpreter (AST execution)
↓
Runtime (variables, functions, classes, printWrd, system)
↓
Node.jsProject structure
The project intentionally contains only the requested files and directories.
