Change history for Purus syntax, specifications, and reserved keywords.
-
blankkeyword (wildcard): A new keyword for explicitly ignoring a function parameter or writing a catch-all pattern match arm. Chosen as the Purus-idiomatic replacement for the_(underscore) convention, which requires the Shift key — contrary to Purus's "no Shift key" design principle.As a function parameter:
-- Ignore the first argument (element), use only the index const indices be Array.from[[length be 5]; fn blank; i to i]const indices = Array.from({ length: 5 }, (_, i) => i);
Multiple
blankparameters become_,_1,_2, … in JS output to avoid strict-mode duplicate parameter errors:fn f blank; blank; x to xfunction f(_, _1, x) { return x; }
As a
switch/matchcatch-all arm:switch status case ///ok/// then ///good/// case blank then ///unknown/// -
//;text;//semicolon string syntax: An alternative to///text///that avoids visual confusion with URLs.;serves as the inner delimiter, so//inside (e.g.https://) never conflicts with the closing;//. Supports the same[expr]interpolation and escape sequences as///...///.const url be //;https://api.example.com/v1;// const msg be //;Hello, [name]!;//Use
\;to include a literal;followed by//:const s be //;end\;// here;// -- "end;// here"
-
purus configcommand: Generates aconfig.purusfile with default settings in the current directory. Ifconfig.purusalready exists, prompts for confirmation before overwriting.purus config
-
Enhanced
purus init:purus initnow createsconfig.purus,.prettierrc, and.gitignorein addition tosrc/main.purus. Ifpackage.jsonalready exists, build and lint scripts are added automatically. All files are skipped if they already exist.File Behavior config.purusCreated if missing .prettierrcCreated if missing .gitignoreCreated if missing src/main.purusCreated if missing package.jsonScripts updated if present
-
Node.js ≥ 20 required: The minimum supported Node.js version has been raised from v18 to v20. Older versions are no longer supported.
-
Bare variable assignment removed: Assignment to a bare identifier without a declaration keyword (
x be 42) is no longer supported. This prevents accidental implicit global variable creation and conflicts with runtime-provided globals such as Node.js'sprocess.- Property assignments (
obj.field be val,this.x be val) remain valid - Index assignments (
arr[\i] be val) remain valid - Compound assignment operators (
x add be 1,x sub be 1, etc.) remain valid
-- Removed (was valid in v0.9.x): x be 42 -- Use instead: const x be 42 -- immutable let x be 42 -- mutable -- Still valid: obj.field be ///new value/// arr[\i] be 0 x add be 1 - Property assignments (
- Auto-initialize object for dotted declaration: When using
const obj.prop be val,let obj.prop be val, orvar obj.prop be val, ifobjhas not yet been declared, it is automatically initialized to{}with the corresponding keyword. Subsequent dotted declarations on the same name do not re-initialize. Bare assignment (obj.prop be valwithout a keyword) behaves as before.const p.x be 10 const p.y be 20 -- const p = {}; -- p.x = 10; -- p.y = 20; let cfg.host be ///localhost/// let cfg.port be 3000 -- let cfg = {}; -- cfg.host = "localhost"; -- cfg.port = 3000;
config.purusexcluded from build: Fixed an issue whereconfig.puruswas incorrectly processed as a source file during the build.- Dotted declaration support: Fixed parsing of property assignments written with a declaration keyword.
const obj.prop be valnow correctly compiles toobj.prop = val.const this.x be 10 -- this.x = 10 let obj.prop be 42 -- obj.prop = 42
- Directory restructure: Reorganized
core/source files intosrc/lexer/,src/parser/,src/codegen/,src/cmd/main/, andpkg/.
iskeyword removed: Theiskeyword (alias foreq) has been removed. Useeqinstead.isis no longer a reserved word.-- Before (v0.8.x): x is y -- x === y x is string -- x === string -- After (v0.9.0): x eq y -- x === y typeof x eq ///string/// -- typeof x === "string"
-
use ... [as ...]for standard library: Theusekeyword imports built-in Purus standard library modules. All modules are prefixed withp-to avoid keyword conflicts. Theaskeyword is optional — when omitted, the module name is used as the binding. Tree-shaking ensures only used functions are included in the output.use p-random as r r.randint[1; 10] -- random integer between 1 and 10 r.gauss[0; 1] -- gaussian distribution r.choice[list[1; 2; 3]] -- random element from array r.shuffle[list[1; 2; 3]] -- shuffled copy of array use p-math as m m.floor[3.7] -- 3 m.pi -- 3.14159... m.abs[-5] -- 5 use p-string as s s.upper[///hello///] -- ///HELLO/// s.reverse[///abc///] -- ///cba/// s.words[///foo bar baz///] -- [///foo///; ///bar///; ///baz///] use p-datetime as dt dt.now[] -- current timestamp (ms) dt.year[dt.now[]] -- current year dt.toiso[dt.now[]] -- ISO 8601 string dt.utchour[dt.now[]] -- current hour (UTC) dt.tzhour[dt.now[]; ///America/New_York///] -- hour in New York dt.format[dt.now[]; ///Asia/Tokyo///] -- formatted in Tokyo tz dt.localtz[] -- local timezone name use p-json as j j.parse[///{ "a": 1 }///] -- { a: 1 } j.stringify[obj] -- JSON string use p-object as o o.keys[obj] -- object keys o.merge[a; b] -- merge objects use p-number as n n.isinteger[42] -- true n.clamp[15; 0; 10] -- 10 use p-array as a a.unique[list[1; 2; 2; 3]] -- [1; 2; 3] a.chunk[list[1; 2; 3; 4]; 2] -- [[1; 2]; [3; 4]] use p-error as e e.create[///something went wrong///] e.iserror[err] -- trueAvailable stdlib modules:
Module Description p-randomrandom,randint,randrange,randbool,getrandbits,randbytes,uniform,triangular,gauss,normalvariate,expovariate,gammavariate,betavariate,lognormvariate,vonmisesvariate,paretovariate,weibullvariate,choice,choices,wchoices,shuffle,sample,binomial,poisson,geometric,clamp,lerpp-mathJS Mathalias + lowercase constant aliases (pi,e,ln2,ln10,sqrt2, etc.)p-stringlen,contains,startswith,endswith,indexof,count,upper,lower,capitalize,title,trim,trimstart,trimend,reverse,repeat,replace,replacefirst,padstart,padend,split,lines,words,join,chars,slice,charat,codeat,fromcodep-datetimenow,today,timestamp,create,utccreate,fromiso,year,month,day,weekday,hour,minute,second,ms,utcyear,utcmonth,utcday,utcweekday,utchour,utcminute,utcsecond,utcms,tzyear,tzmonth,tzday,tzweekday,tzhour,tzminute,tzsecond,toiso,tolocale,todate,totime,format,addms,addseconds,addminutes,addhours,adddays,diff,diffdays,diffhours,diffminutes,diffseconds,offset,localtzp-jsonparse,stringify,prettifyp-objectkeys,values,entries,fromentries,assign,freeze,seal,isfrozen,issealed,hasown,create,is,len,merge,clone,pick,omitp-numberisfinite,isinteger,isnan,issafe,parsefloat,parseint,tofixed,toprecision,toexponential,tostring,clamp+ constantsp-arrayisarray,from,of,len,first,last,range,flatten,unique,zip,unzip,chunk,sum,product,min,max,sortasc,sortdesc,compact,count,groupbyp-errorcreate,type,range,reference,syntax,uri,iserror,message,name,stack,cause,wrap -
Tree-shaking: Only the stdlib functions actually referenced in your code are included in the compiled output, keeping bundle size minimal.
-
Bitwise operators: New keyword-based bitwise operators, matching JavaScript semantics:
a band b -- a & b (bitwise AND) a bor b -- a | b (bitwise OR) a bxor b -- a ^ b (bitwise XOR) bnot a -- ~a (bitwise NOT) a shl b -- a << b (left shift) a shr b -- a >> b (right shift) a ushr b -- a >>> b (unsigned right shift) -
randomstdlib additions:getrandbits,randbytes,normalvariateadded.randboolnow accepts optional probability parameter. -
New stdlib modules:
p-object(Object utility),p-number(Number utility + constants),p-array(Array utility),p-error(Error creation/inspection). -
Additional stdlib modules:
p-regexp(RegExp utility),p-promise(Promise utility),p-set(Set utility),p-map(Map utility). -
infinity/-infinityliterals: Addedinfinityas a reserved keyword.neg infinityand-infinityboth compile to-Infinity.const x be infinity -- Infinity const y be neg infinity -- -Infinity const z be -infinity -- -Infinity (special case) -
do...whileloop: Execute a block at least once, then repeat while condition is true:do process-item[] while has-more[] -
yield/ Generator functions: Functions containingyieldare automatically compiled as generators (function*):fn count-up limit let i be 0 while i lt limit yield i i be i add 1 -
Binary / Hexadecimal number literals:
0band0xprefixed numbers are now supported:const mask be 0b1010 const color be 0xFF00FF -
functionkeyword (deprecated alias):functionis accepted but emits a deprecation warning. Usefninstead. -
protectedkeyword (deprecated alias):protectedis accepted in class bodies but emits a deprecation warning. Useprivateinstead. -
Compound assignment operators: New
add be,sub be,mul be,div be,mod be,pow becompound assignment syntax:x add be 1 -- x += 1 x sub be 1 -- x -= 1 x mul be 2 -- x *= 2 x div be 2 -- x /= 2 x mod be 3 -- x %= 3 x pow be 2 -- x **= 2 obj.count add be 1 -- obj.count += 1 arr[\i] mul be 2 -- arr[i] *= 2 -
JS-style
forloop: New C-style for loop syntax with init, condition, and update clauses. Works with compound assignment operators:for let i be 0; i lt 10; i add be 1 console.log[i] -- → for (let i = 0; i < 10; i += 1) { console.log(i); } for let x be 1; x lt 100; x mul be 2 console.log[x] -- → for (let x = 1; x < 100; x *= 2) { console.log(x); } -
Postfix / prefix increment & decrement:
\addand\subfor increment and decrement. Postfix:x\add→x++,x\sub→x--. Prefix:add\x→++x,sub\x→--x.x\add -- x++ x\sub -- x-- add\x -- ++x sub\x -- --x for let i be 0; i lt 10; i\add console.log[i] -- for (let i = 0; i < 10; i++) { ... } -
Floor division (
fdiv): Integer floor division usingMath.floor.fdiv befor compound assignment:let q be 7 fdiv 2 -- Math.floor(7 / 2) → 3 x fdiv be 10 -- x = Math.floor(x / 10) -
Bitwise compound assignments:
band be,bor be,bxor be,shl be,shr be,ushr be:x band be 255 -- x &= 255 x bor be 1 -- x |= 1 x bxor be mask -- x ^= mask x shl be 2 -- x <<= 2 x shr be 1 -- x >>= 1 x ushr be 1 -- x >>>= 1 -
Logical compound assignments:
and be,or be,coal be— new compound assignment for logical and nullish operators:x and be true -- x &&= true x or be false -- x ||= false x coal be 0 -- x ??= 0 -
BigInt literals: Append
nto any integer literal (decimal, binary, or hex) to create a BigInt:const big be 9007199254740993n -- 9007199254740993n const hex be 0xFFFFFFFFFFFFFFFFn -- 18446744073709551615n const bin be 0b11111111n -- 255n big add 1n -- 9007199254740994n -
voidexpression: Thevoidkeyword evaluates its operand and returnsundefined. Useful for side-effect-only calls:void f[] -- void f() const u be void 0 -- const u = void 0
| Keyword | Change |
|---|---|
is |
Removed (use eq instead) |
use |
Added for standard library imports (use p-... [as ...]) |
from...use |
Removed for stdlib (still works for ES imports: from "mod" import ...) |
band bor bxor bnot shl shr ushr |
Added — bitwise operators |
infinity |
Added — Infinity literal (neg infinity / -infinity for negative) |
do |
Added — do-while loop (deprecated, prefer while/until) |
yield |
Added — yield expression for generator functions |
function |
Added — deprecated alias for fn |
protected |
Added — deprecated alias for private |
add be sub be mul be div be mod be pow be |
Added — compound assignment operators |
fdiv |
Added — floor division (Math.floor(a / b)) |
fdiv be |
Added — floor division compound assignment |
band be bor be bxor be shl be shr be ushr be |
Added — bitwise compound assignment operators |
and be or be coal be |
Added — logical/nullish compound assignment operators (&&=, ||=, ??=) |
\add \sub (postfix), add\ sub\ (prefix) |
Added — increment/decrement operators |
100n / 0xFFn / 0b1n |
Added — BigInt literal suffix n |
void |
Added — void expression (void x → void x) |
-
Bare variable assignment: Using
x be valuewithout a declaration keyword (const/let) is now deprecated. Property assignments (obj.field be value,arr[\i] be value) are not affected.-- Deprecated: x be 42 -- Use instead: const x be 42 let x be 42 -
for ... in rangeloop (deprecated): Thefor x in range a; bsyntax is deprecated. Use the new JS-styleforloop instead:-- Deprecated: for i in range 0; 10 console.log[i] -- Use instead: for let i be 0; i lt 10; i add be 1 console.log[i]
- Linter (
@puruslang/linter):0.7.1→0.8.0— removediskeyword, synced keywords (do,yield,function,protected,infinity,void), added binary/hex/BigInt number support, expanded rules from 8 to 17 (bare-assignment,no-function,no-protected,no-else-if,no-js-chars,no-js-operators,bracket-match,const-reassign,duplicate-use,no-for-range), updatedJS_OPERATOR_MAPwith compound assignment suggestions including&&=→and be,||=→or be,??=→coal be - Prettier Plugin (
@puruslang/prettier-plugin-purus):0.7.1→0.8.0— removediskeyword, synced keywords (do,yield,function,protected,infinity,void), addedBLOCK_STARTERS(do,try,catch,finally,class), added binary/hex/BigInt number support - VS Code Extension (
purus):0.6.1→0.7.0— removedisfrom syntax highlighting, addedusestdlib syntax, added real-time diagnostics (errors, warnings, deprecation notices), reorganized source intosrc/, added snippets (dowhile,yield,genfn,class), updatedusesnippet with all 13 stdlib modules, updated language configuration (do,classindent patterns), added BigInt numeric highlighting, addedvoidkeyword highlight
witch→switchkeyword rename: The pattern matching keywordwitchhas been renamed toswitch. The previous name was a typo/misnaming. Existing code usingwitchmust be updated toswitch.-- Before (v0.8.0): witch x case 1 then ///one/// default ///other/// -- After (v0.8.1): switch x case 1 then ///one/// default ///other///
-
pub→public: Thepubkeyword has been removed. Usepublicinstead. -
Removed automatic type name detection:
eq/iswith type names (e.g.x is string,x eq number) no longer auto-generatestypeofchecks. Type names are now treated as regular identifiers.-- Before (v0.7.x): x is string → typeof x === "string" -- After (v0.8.0): x is string → x === string (identifier comparison) -- Migration: typeof x eq ///string///
-
match/whendeprecated: Thematch/whensyntax still works but is deprecated in favor ofwitch/case/default. -
use/from...usedeprecated: Dot-path imports (use std.math,from std.math use sin, cos) are deprecated. Useimport...fromorfrom...importwith string paths instead.
-
witch/case/defaultsyntax: Added a new pattern matching syntax as the recommended replacement formatch/when/else.witch x case 1 then ///one/// case 2 then ///two/// default ///other///Compiles identically to
match— generates an if-else chain. Guards are supported:case n if n gt 0. -
to returnfor explicit return: Addedto returnsyntax for single-expression function bodies with explicit return.fn double x to return x mul 2 -- Compiled: function double(x) { return x * 2; }Works with named functions, class methods,
static fn,get fn,set fn, and constructors. -
Module type configuration:
.purusfiles can now be compiled as CommonJS instead of ES Modules.- CLI option:
purus build --type commonjs config.purus:const type be ///commonjs///- Resolution order: CLI
--type>config.purustype>package.jsontype> default (module) - CJS mode converts
import/exporttorequire()/module.exports/exports.* .cpurus→ always CJS,.mpurus→ always ESM (unchanged)
- CLI option:
-
purus newimprovements: Generatedconfig.purusnow includes atypefield. Generatedpackage.jsonsetsmainto"dist/main.js"andtypeto"module". -
TypeScript type definitions: Added
index.d.tsfor thepurusnpm package. TypeScript users now get type information forcompile(),check(), andversion. -
from...importsyntax: Added reversed import syntax with module path first.from ///express/// import express from ///react/// import [useState, useEffect] from ///fs/// import all as fs
- Linter:
0.6.0→0.7.0— addedwitch,casekeywords - Prettier Plugin:
0.6.0→0.7.0— addedwitch,casekeywords - VS Code Extension:
0.5.0→0.6.0— addedwitch,casesyntax highlighting
- Added Community Projects page listing unofficial community-created projects
-
Removed implicit return from named functions:
fn name args to exprnow compiles to{ expr; }instead of{ return expr; }. Use block body + explicitreturnto return values. Anonymous functions (fn args to expr→(args) => expr) are not affected.-- Before (v0.6.x): implicit return fn double x to x mul 2 -- Compiled: function double(x) { return x * 2; } -- After (v0.7.0): no implicit return fn double x to x mul 2 -- Compiled: function double(x) { x * 2; } -- Migration: use block body + explicit return fn double x return x mul 2 -- Compiled: function double(x) { return x * 2; }This also applies to class methods and
static fn/get fn/set fn.
nankeyword: Added thenanliteral keyword, which compiles to JavaScript'sNaN.const value be nan -- const value = NaN; x eq nan -- x === NaNwithkeyword (Import Attributes): Added import attributes viaimport ... from ... with [ key be value ]syntax. Compiles to JavaScript'simport ... from "..." with { key: value }.import data from ///./data.json/// with [ type be ///json/// ] -- import data from "./data.json" with { type: "json" }; import [name; version] from ///./package.json/// with [ type be ///json/// ] -- import { name, version } from "./package.json" with { type: "json" }; import ///./styles.css/// with [ type be ///css/// ] -- import "./styles.css" with { type: "css" };
matchguard +BindPatfix: Fixed a scoping error in code generation whenwhen n if condpattern usednas a binding variable. The variablenwas being declared inside theifblock but referenced in the guard condition. Changed to pre-declaration approach: binding variables are declared before theif-elsechain.match value when n if n gt 0 console.log[///positive///] when _ console.log[///other///]// Before (broken): n was not in scope for the guard // After (fixed): const n = value; is pre-declared { const n = value; if (n > 0) { console.log("positive"); } else { console.log("other"); } }
| Keyword | Purpose |
|---|---|
nan |
NaN literal |
with |
Import Attributes |
- Package metadata fix (for npm publish).
- No syntax or keyword changes.
- Class syntax: Added
class/extends/super/static/private/get/setkeywords. Compiles to JavaScript ES6 classes.class Animal private name fn constructor name this.name be name fn speak console.log[this.name] static fn create name return new Animal[name] get fn value return this.name set fn value v this.name be vclass Animal { #name; constructor(name) { this.#name = name; } speak() { console.log(this.#name); } static create(name) { return new Animal(name); } get value() { return this.#name; } set value(v) { this.#name = v; } }
superexpression: Addedsuperas an expression for calling parent class constructors and methods.class Dog extends Animal fn constructor name super[name]- Inheritance:
class Child extends Parentcompiles to JavaScript'sclass Child extends Parent.
| Keyword | JS Output | Purpose |
|---|---|---|
class |
class |
Class declaration |
extends |
extends |
Inheritance |
super |
super |
Parent class reference |
static |
static |
Static method |
private |
# (private field) |
Private field |
get |
get |
Getter |
set |
set |
Setter |
coal(Nullish Coalescing):a coal bcompiles toa ?? b.const name be user.name coal ///anonymous/// -- const name = user.name ?? "anonymous";- Optional chaining:
obj\.field→obj?.field,obj\.method[args]→obj?.method(args).const name be user\.profile\.name -- const name = user?.profile?.name; user\.greet[///hello///] -- user?.greet("hello"); - Computed property access:
obj[\key]→obj[key].const val be obj[\key] -- const val = obj[key]; - String interpolation:
///Hello [name]!///compiles to template literals. Square brackets[expr]inside triple-slash strings are interpolated.const msg be ///Hello [name]! You are [age] years old./// -- const msg = `Hello ${name}! You are ${age} years old.`; - Side-effect import:
import ///module///→import "module"for imports that only execute side effects.import ///./polyfill.js/// -- import "./polyfill.js"; async fnexpression: Support forasync fn x to exprandasync fnblock body as expressions (e.g., in variable assignment).const fetchData be async fn url to await fetch[url] -- const fetchData = async (url) => await fetch(url);- Object destructuring:
const object[a; b] be expr→const { a, b } = expr. Uses theobjectkeyword prefix to distinguish from array destructuring.const object[name; age] be person -- const { name, age } = person; - Underscore identifiers: Support for identifiers starting with underscore like
_variable,_private,__internal.
| Symbol | Purpose |
|---|---|
\ |
Computed property access prefix |
\. |
Optional chaining |
| Keyword | JS Output | Purpose |
|---|---|---|
coal |
?? |
Nullish Coalescing |
- Added version sync script for consistent versioning across packages.
- No syntax or keyword changes.
ne→neqrenamed: The inequality operator keyword was renamed fromnetoneq. All existing code usingnemust be updated toneq.-- Before (v0.3.x) x ne y -- x !== y -- After (v0.4.0) x neq y -- x !== y x not eq y -- x !== y (alternative)
powoperator:a pow bcompiles toa ** b. Right-associative precedence, higher thanmul/div/mod.2 pow 10 -- 2 ** 10 x pow y pow z -- x ** (y ** z) (right-associative)not eqoperator composition:not eqis parsed asneq(!==). Similarly,lt eq→le(<=) andgt eq→ge(>=).x not eq y -- x !== y x lt eq y -- x <= y x gt eq y -- x >= y- Range arrays:
[start..end](inclusive) /[start...end](exclusive) generates arrays usingArray.from().[1..5] -- Array.from({ length: 5 - 1 + 1 }, (_, i) => i + 1) → [1,2,3,4,5] [0...5] -- Array.from({ length: 5 - 0 }, (_, i) => i + 0) → [0,1,2,3,4] - Slicing:
arr[start..end]/arr[start...end]compiles to.slice(). Slice assignment compiles to.splice().arr[1..3] -- arr.slice(1, 3 + 1) arr[1...3] -- arr.slice(1, 3) arr[1..3] be [7; 8; 9] -- arr.splice(1, 3 - 1 + 1, 7, 8, 9) - Array destructuring:
const [a; b] be arr→const [a, b] = arr.const [first; second] be arr -- const [first, second] = arr; namespacekeyword:namespace nameblock compiles to an IIFE (Immediately Invoked Function Expression).namespace Utils pub fn helper return 42purus checkcommand: Added CLI command for syntax checking without generating output files.
| Symbol | Purpose |
|---|---|
.. |
Inclusive range |
... |
Exclusive range |
| Keyword | Change |
|---|---|
pow |
Added (exponentiation operator) |
neq |
Renamed from ne |
namespace |
Added (module namespace, alias for use) |
purus versioncommand: Addedversion/--version/-vCLI commands.- Build refactoring: Single-file build now uses the compile API directly instead of delegating to the MoonBit compiler. Header comment generation moved to the JS wrapper layer.
purus newprompt change: Default answer for "Install dependencies?" changed from No to Yes.- No syntax or keyword changes.
- Package metadata fix (README links).
- No syntax or keyword changes.
- CLI tools: Added full CLI interface with the following commands:
purus build [file]— Compile to JavaScriptpurus build --directory <dir>— Compile all files in a directorypurus build --output <dir>— Specify output directorypurus build --no-header— Compile without header commentpurus build --stdout— Output to stdoutpurus run [file]— Run without generating filespurus new [name] [-y]/purus create— Create a new projectpurus init— Initialize project in current directorypurus help— Show help
- Config file: Added
config.purusconfiguration file support for project-level build settings. - File extension mapping:
.purus→.js,.cpurus→.cjs(CommonJS),.mpurus→.mjs(ES Module). - Removed
purus.jsonproject file (replaced byconfig.purus).
- No syntax or keyword changes.
eq/isparse fix: Previously,eqandishad separate parse paths —eqalways produced a binary equality (===), whileisproduced atypeofcheck. Fixedeqto also generate a type check (IsCheck) when the next token is a recognized type name. Botheqandisnow behave identically.Recognized type names:-- Before (v0.0.x): eq always produced === x eq string -- x === string (wrong — compared to variable) -- After (v0.1.0): eq detects type names x eq string -- typeof x === "string" (type check) x is string -- typeof x === "string" (same behavior)string,number,boolean,undefined,function,symbol,bigint,null,object, and PascalCase identifiers (e.g.,Array,Date).
- No syntax or keyword changes.
- Package version fix.
- No syntax or keyword changes.
- README link fix, package file configuration fix.
- No syntax or keyword changes.
First release of the Purus language.
- Integer, float, string (
///...///), regex (///regex///),true/false,null/nil/undefined - Array
[1; 2; 3], object[key be value]
const/let/var+be(assignment keyword)const name be ///Purus/// -- const name = "Purus"; let count be 0 -- let count = 0;
| Keyword | JS Output | Purpose |
|---|---|---|
add |
+ |
Addition / string concatenation |
sub |
- |
Subtraction |
mul |
* |
Multiplication |
div |
/ |
Division |
mod |
% |
Modulo |
neg |
- (unary) |
Negation |
eq |
=== |
Equality |
ne |
!== |
Inequality |
lt |
< |
Less than |
gt |
> |
Greater than |
le |
<= |
Less than or equal |
ge |
>= |
Greater than or equal |
and |
&& |
Logical AND |
or |
|| |
Logical OR |
not |
! |
Logical NOT |
fn/return/to(expression body) /gives(type annotation) /async/awaitfn greet name to console.log[name] -- function greet(name) { return console.log(name); } fn add a b return a add b -- function add(a, b) { return a + b; }
if/elif/else/unless/then(inline)while/until/for/in/rangebreak/continuematch/when(pattern matching)pipe(pipe operator|>)
stmt if cond/stmt unless cond/stmt for x in arrconsole.log[x] if x gt 0 -- if (x > 0) { console.log(x); }
try/catch/finally/throw
is/as/of(type annotation) /typeof/instanceof/type(type alias)
new/delete/this
import/from/export/default/requireuse(dot-path import)pub(public export modifier)all(namespace import:import all as name from ...)
;(semicolon) and,(comma) are interchangeable as separators
list/object(reserved for explicit constructors)
- Shebang support (
#!line is preserved) // commentstyle comments via-- comment
| Symbol | Purpose |
|---|---|
[ / ] |
Function calls / arrays / objects |
, |
Array / object separator |
; |
Arguments / parameters / destructuring separator |
. |
Property access |