The Constlang compiler runs on a browser-based JavaScript engine. File system access and bundling operations occur in the following order:
| Function | Description | Technical Detail |
|---|---|---|
constlib new --app |
Load Project | Uses global.showDirectoryPicker() to get folder access and _traverseDirectory to load all .clg files into sessionStorage. |
constlib new --windows |
Load Project | Uses global.showDirectoryPicker() to get folder access and _traverseDirectory to load all .clg files into sessionStorage. |
constlib new --linux |
Load Project | Uses global.showDirectoryPicker() to get folder access and _traverseDirectory to load all .clg files into sessionStorage. |
constlib new --web |
Load Project | Uses global.showDirectoryPicker() to get folder access and _traverseDirectory to load all .clg files into sessionStorage. |
constlib new --macos |
Load Project | Uses global.showDirectoryPicker() to get folder access and _traverseDirectory to load all .clg files into sessionStorage. |
constlib new --andiroid |
Load Project | Uses global.showDirectoryPicker() to get folder access and _traverseDirectory to load all .clg files into sessionStorage. |
constlib new --ios |
Load Project | Uses global.showDirectoryPicker() to get folder access and _traverseDirectory to load all .clg files into sessionStorage. |
constlang build --app |
Start Compilation | Runs _bundle first (merges files), then runs _transpile (converts to C#). |
constlang build --windows |
Start Compilation | Runs _bundle first (merges files), then runs _transpile (converts to C#). |
constlang build --linux |
Start Compilation | Runs _bundle first (merges files), then runs _transpile (converts to C#). |
constlang build --macos |
Start Compilation | Runs _bundle first (merges files), then runs _transpile (converts to C#). |
constlang build --andiroid |
Start Compilation | Runs _bundle first (merges files), then runs _transpile (converts to C#). |
constlang build --ios |
Start Compilation | Runs _bundle first (merges files), then runs _transpile (converts to C#). |
constlang publish --app |
download output | Runs _bundle first (merges files), then runs _transpile (converts to C#). |
constlang publish --windows |
download output | Runs _bundle first (merges files), then runs _transpile (converts to C#). |
constlang publish --linux |
download output | Runs _bundle first (merges files), then runs _transpile (converts to C#). |
constlang publish --macos |
download output | Runs _bundle first (merges files), then runs _transpile (converts to C#). |
constlang publish --andiroid |
download output | Runs _bundle first (merges files), then runs _transpile (converts to C#). |
constlang publish --ios |
download output | Runs _bundle first (merges files), then runs _transpile (converts to C#). |
_bundle(file) |
Bundler | DFS Algorithm: Follows #import and #install commands to merge all dependencies into a single text block. |
fw:dotnet" |
dotnet commands | Runs _bundle first (merges files), then runs _transpile (converts to C#). |
fw:mono" |
mono commands | Runs _bundle first (merges files), then runs _transpile (converts to C#). |
config() { ... } |
Configuration | Code inside this block is not compiled into the logic; it is extracted and exported as the config.csproj file. |
Constlang types are mapped directly to their C# equivalents via Regex during compilation.
| Constlang | C# Target | Example Usage |
|---|---|---|
int | Int | int num = 10; |
int16 / int32 / int64 / int128 | Int16 / Int32 / Int64 / Int128 | int64 id = 123456789; |
int128 | Int128 | int128 dev = 999...; |
intx | double | intx ratio = 3.14; |
string | String | string name = "Const"; |
ft | bool | ft active = true; |
byte | byte[] (or char[]) | byte data = ...; * |
static [type] | Const [Type] | static int x = 5; |
| Command | Function (C#) | Description |
|---|---|---|
console.print(x) | Console.WriteLine(x) | Writes a line to the console. |
read.data() | Console.ReadLine() | Reads input from the user. |
read.int16() | Convert.ToInt16(Console.ReadLine()) | Reads input from the user. |
read.int32() | Convert.ToInt32(Console.ReadLine()) | Reads input from the user. |
read.int64() | Convert.ToInt64(Console.ReadLine()) | Reads input from the user. |
read.int128() | Convert.ToInt128(Console.ReadLine()) | Reads input from the user. |
read.ft() | Convert.ToBoolean(Console.ReadLine()) | Reads input from the user. |
read.intx() | Convert.ToDouble(Console.ReadLine()) | Reads input from the user. |
read.int() | Convert.ToInt(Console.ReadLine()) | Reads input from the user. |
read.string() | Convert.ToString(Console.ReadLine()) | Reads input from the user. |
read.title(x) | Console.Write(x) | Writes text without a new line. |
console.status() | Custom String | Returns Process Uptime and Thread count. |
system.os() | "app" | Returns the static string "app". |
system.beep(f,d) | Console.Beep(f,d) | Plays a system beep sound. |
system.stop(ms) | Thread.Sleep(ms) | Pauses the thread (milliseconds). |
open.window(x) | Process.Start(x) | Starts a new process or window. |
Commands based on the `System.IO` library.
Commands to safely convert user input or variables into C# types (Prefix: to. or read.).
| Command Group | C# Target |
|---|---|
to.int16/32/64(x) | Convert.ToIntXX(x) |
to.string(x) | Convert.ToString(x) |
to.base64(x) | Convert.ToBase64String(x) |
to.ft(x) | Convert.ToBoolean(x) |
converter.utf8.byte(x) | Encoding.UTF8.GetBytes(x) |
read.int32(p) | Convert.ToInt32(Console.ReadLine(p)) |
Commands managing the C# List<T> structure.
.list.string() / .list.int32() -> Create new list..list.add(x) -> Add item (.Add)..list.new(x) -> Insert item at index (.Insert)..list.delete(i) -> Remove item at index (.RemoveAt)..list.all() -> Sort the list (.Sort)..list.redata() -> Reverse the list (.Reverse)..list.clr() -> Clear list..list.count() -> Get item count.Functions to query the state of a specific character.
Constlang uses a custom macro structure for dynamic code generation.
Syntax: cmd.fn() [ PATTERN command() TEMPLATE ]
Logic:
${cmd^variable} inside the PATTERN.${variable} in the TEMPLATE with the captured values.get(url) -> await client.GetFromJsonAsync(url)ip.parse(s) -> IPAddress.Parse(s).ip.streamr() -> client.GetStream()if() {} -> if() {}else() {} -> else() {}else if {} -> else if{}while() {} -> while() {}for() {} -> for() {}pub.class() {} -> public class {}pwr.class() {} -> private class {}