Skip to content

A programming language that compiles to Lua.

Notifications You must be signed in to change notification settings

TechnoJo4/luadaul

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

daul

daul is a language that transpiles to Lua. It aims to simplify the use of functional-style code by eliminating the distinction between statements and expressions.

Daul Generated/Equivalent Lua code

Tables:

// Use [] instead of {}
val arr = [ 1, 2, 3 ]

// Use "key:" instead of "[key] ="
val tbl = [ "arr": arr ]
val zeroindexed = [ 0: 1, 2, 3 ];
local arr={1,2,3};
local tbl={["arr"]=arr};
local zeroindexed={[0]=1,2,3};

Statements and blocks:

// Example TODO
-- Example TODO

Constant variables:

var x = 0
x = 1
val y = 2
y = 3

Compiler error:

 4 | y = 3
     ~
Variable 'y' was declared as constant (val)

Functions:

val f1 = \arg1, arg2 -> {
    print(arg1)
    arg1 + arg2
}

// Block can be omitted for a single expression
val f2 = \x -> 1+x

// Arguments can be omitted when there are none
val f3 = \[ "a": "b" ]
val f4 = \{
  print("f4")
  f3()
}
local f1 = (function(arg1,arg2)
    print(arg1);
    return (arg1+arg2);
end);

local f2 = (function(x)
    return (1+x);
end);

local f3 = (function()
    return {["a"]="b"};
end);

local f4 = (function()
    print("f4");
    return f3();
end);

About

A programming language that compiles to Lua.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published