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
18 changes: 16 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
Kotlin dialect (**KD**) is a set of tools and rules to write
logic in Kotlin for several platforms.

The Kotlin dialect's core is an architecture inspired by Redux.
If you know what Kotlin Multiplatfrom is, you probably wonder what's the fuss.
If you tried Kotlin Multiplatform you surely know how hard it is to set up
correctly for multiple platforms. This project dictates one particular way
to have your code organized to be able to easily have logic in Kotlin
across platforms in **native** apps.

# Klin
This project's core concept is a Redux-like architecture.

# Building and distributing Klin

Klin is a translator that converts YML to Kotlin.

To build and distribute it, run:

$ `./util/run-klin-dbg`

The resulting Node.js application is located in `dist`

# Running Klin

$ `node dist/app.js --file=/path/to/kd.yml --out=/path/to/kd.kt`

## Generation of entity fields

| № | YML type | Kotlin type | Default value | YML example | Kotlin example |
Expand Down
50 changes: 50 additions & 0 deletions dist/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/usr/bin/env node

let fs = require("fs");
let KT = require("./ver-nodejs-app").org.opengamestudio;

//!<-- API -->

function appSet(key, value) {
KT.appCtrl().set(key, value);
}

//!<-- Component -->

function AppComponent() {
this._construct = function() {
// Effects
let oneliners = [
"inputFile", (c) => { appReadFile(c.inputFile) },
"outputFileContents", (c) => { appWriteFile(c.outputFile, c.outputFileContents) },
];
KT.registerOneliners(KT.appCtrl(), oneliners);

// Defaults.
//appSet("isDbg", true);
appSet("arguments", process.argv);
};

this._construct();
}

//<!-- Effects -->

function appReadFile(fileName) {
let contents = fs.readFileSync(fileName, { encoding: "utf8", flag: "r" });
let lines = contents.split("\n");
appSet("inputFileLines", lines);
}

function appWriteFile(fileName, contents) {
fs.writeFileSync(fileName, contents);
appSet("didWriteOutputFile", true);
}

//<!-- Installation -->

let cmp = new AppComponent();

//<!-- Run -->

appSet("didLaunch", true);
Loading