Constlang Technical Reference v6.0

System Note: This documentation was generated by reverse-engineering the Constlang Compiler source code (JS). It represents the exact logic currently implemented in the compiler.

1. Compiler Architecture & API

The Constlang compiler runs on a browser-based JavaScript engine. File system access and bundling operations occur in the following order:

Core Functions

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.

2. Variable Types & Definitions

Constlang types are mapped directly to their C# equivalents via Regex during compilation.

Constlang C# Target Example Usage
intIntint num = 10;
int16 / int32 / int64 / int128Int16 / Int32 / Int64 / Int128int64 id = 123456789;
int128Int128int128 dev = 999...;
intxdoubleintx ratio = 3.14;
stringStringstring name = "Const";
ftboolft active = true;
bytebyte[] (or char[])byte data = ...; *
static [type]Const [Type]static int x = 5;
* Warning: The `byte` definition is matched twice in the compiler regex. The second match converts it to `char[]`.

3. Input / Output (I/O) & System

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 StringReturns 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.

4. File & Directory Management

Commands based on the `System.IO` library.

// Read & Write file.add("file.txt", "content"); -> File.WriteAllText file.load("file.txt"); -> File.ReadAllText file.redata("file.txt"); -> StreamWriter // Management file.move(source, dest); -> File.Move file.copy(source, dest); -> File.Copy folder.add("folder"); -> Directory.CreateDirectory folder.fileinfo("path"); -> Directory.GetFiles folder.folderinfo("path"); -> Directory.GetDirectories

5. Data Conversion

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))

6. Lists & Collections (.list)

Commands managing the C# List<T> structure.

7. Character Analysis (.char)

Functions to query the state of a specific character.

.char.letter(c) -> Is Letter? .char.i09(c) -> Is Digit? .char.isc(c) -> Is Alphanumeric? .char.space(c) -> Is Whitespace? .char.symbol(c) -> Is Symbol? .char.upper(c) -> Is Uppercase? .char.lower(c) -> Is Lowercase? .char.tostring() -> Convert to String

8. Macro System (cmd.fn)

Constlang uses a custom macro structure for dynamic code generation.

Syntax: cmd.fn() [ PATTERN command() TEMPLATE ]

Logic:

  1. The compiler finds ${cmd^variable} inside the PATTERN.
  2. Converts these into Regex capturing groups.
  3. Replaces ${variable} in the TEMPLATE with the captured values.

9. Network & Security

Network Commands

10. other

Other Commands