Changelog
Format based on Keep a Changelog.
Versioning based on Semantic Versioning, with suffix based on rockspec versioning.
[1.0.0-1] - August 11, 2023
Changed
- No longer allow keywords as index fields (generated invalid Lua code)
- Loaded compiled Lua chunks now have their source names embedded in their chunkname
- Operator assignments no longer cause unnecessary duplicate indexing
- https://github.com/erde-lang/erde/issues/29
- ex)
my_expensive_function().x += 1will now only callmy_expensive_functiononce. - ex)
a.b.c += 1will only causeato be indexed once.
- Erde now transforms variable names based on the scope they were declared with.
- The most recently declared scope will always take precedence
- ex)
local x = 0; global x = 1; assert(x == 1)
- Erde now throws a parsing error when declaring a destructured variable with no value (ex.
local { a };) - Erde now throws a parsing error when using
gotowith an undefined label (same behavior as Lua)
Fixed
- Fixed allowing keywords as variable names
- Fixed compilation error for interpolation strings with only an escaped brace
- Fixed return list failing to parse surround chars in strings
- Fixed not being able to assign to the index of a function call result
- Fixed parsing table string entry with only
= - Fixed compilation of function declarations with Lua keywords
- Fixed operator precedence fighting in operator assignments
- Fixed
erde compilefailing when parent directories are not present- parent directories are now created recursively as needed
- Fixed mismatched names for Lua keywords when accessing
_Gor_MODULE - Fixed
moduledeclarations not updating_MODULE - Fixed
continuegenerating invalid code when targeting 5.1(+) - Fixed return lists incorrectly interpreting expression commas as list commas
- For example, returning an iife with a comma in the function body
- Fixed mangled stacktrace for
bitlibrary tail calls
Added
- Erde will now throw a compiler error when targeting
5.1,5.1+, orjit, and there are additional statements following abreak.- Lua 5.1 / LuaJIT do not support statements following
break(parsing error, similar toreturn) - https://github.com/erde-lang/erde/issues/34
- Lua 5.1 / LuaJIT do not support statements following
- Compiled files now include the Lua target at the bottom of the compiled file.
- Added specific error checks for common mistakes
~=vs!=elseifvselse if
[0.6.0-1] - June 16, 2023
Changed
- BREAKING CHANGE: Functions no longer default to
local- Differs too much from vanilla Lua
- Unexpected behavior, especially for newer users
- More confusing than helpful
- Allow excluding target from
load(i.e. allow options table as only argument) - When using the
modulekeyword, users can now access the module table via_MODULE._MODULEis declared at the top of the module (accessible anywhere)moduledeclarations are immediately added to the_MODULEtable
Fixed
- Fixed throwing object when failing to load compiled code
- Fixed erde loaders not handling multiple returns (package loader &&
erde.run) - Fixed incorrect source map when code starts with newlines
- Fixed incorrect source map for function call statements
erde.tracebacknow properly handles non-string messages- message is returned immediately without further processing
- same behavior as Lua's native
debug.traceback
- The bitwise unary
~operator now properly uses native Lua for 5.3+ (previously always used bitlib) - Erde now properly reports error lines as compiled error lines when there is no sourcemap
- Erde now properly injects the compile footer for empty files
- Fixed not throwing error when using both
returnandmodule - Fixed
erde(REPL) anderde runnot respecting--target(https://github.com/erde-lang/erde/issues/11) - Fixed global destructuring (https://github.com/erde-lang/erde/issues/14)
- Global declarations now directly mutate
_G(https://github.com/erde-lang/erde/issues/15) - Fixed compilation of Lua (but not Erde) keyword (https://github.com/erde-lang/erde/issues/8)
- Fixed greedy tokenization of
\in block strings (error when tokenizing[[\]])
Added
- Allow passing in options in
erde.compile - Allow disabling caching source maps
- Added
erde sourcemapcommand to CLI help
[0.5.0-1] - April 01, 2023
Removed
- BREAKING CHANGE: Removed
try...catchstatementspcallparadigm suffices,try...catchstatement in practice was not that useful- Do not want to split code styles on
pcallvstry...catch
- Removed
erdeXXXexecutables (erdejit,erde5.1, etc).- Did not realize luarocks wraps these Lua scripts and forces their running Lua version
- Not as useful now that
erde.loadautomatically infers the target - Polluted path a little bit (lots of executables, especially when installing for multiple versions)
- Removed
-d,--debugcli option
Changed
- Erde now allows all number forms for all Lua targets and will transpile numbers to decimal format (including newly added binary literals).
erdecli no longer requires the subcommand to appear directly aftererde(flags in between are accepted)erdecli defaultscompileandcleanargs to the current directory.- Erde now throws an error when trying to call
loadwith an invalid Lua target. - Erde now overrides Lua's
debug.tracebackonload.- Can be disabled in
loadoptions usingkeep_traceback - Lua's native
debug.tracebackis restored when callingunload
- Can be disabled in
- Erde now infers a version for
loadautomatically based on_VERSIONwhen one is not specified. - Erde no longer catches and rethrows errors internally.
- Previously used custom rethrown data type w/
__tostringmetamethod, (overcomplicated, not user friendly) - Catching and rethrowing changes the call stack. Want to avoid this, as it causes confusion when debugging.
- Still cannot handle the case when callbacks written in Erde but run in Lua throw errors.
- Easier / simplest to have user handle error rewriting themselves at top level
- Often times this will be automatically handled since we override
debug.tracebackonload
- Often times this will be automatically handled since we override
erdecli will still rewrite errors (repl anderde run)
- Previously used custom rethrown data type w/
Fixed
- Fixed compiling of chained function calls (ex.
myfunc()()) - Erde now properly ignores escape sequences (except interpolation) in block strings (
[[ ... ]]) - Fixed
erdecompile / clean checks for empty Lua files (is_compiled_file) - Erde now properly rewrites source references in error messages (ex.
xxx: in function <my_erde_file.erde:174>) - Erde now properly checks for invalid varargs for arrow functions with implicit params
- Erde now properly injects the erde package loader when using the repl.
Added
- Allow binary literals (ex.
print(0b100)) for all Lua targets. - Allow strings to act as index chain bases without parentheses.
- ex)
'mystring':find('my')
- ex)
- Compiled files now include the version of Erde used at the bottom of the compiled file.
- Allow specifying bitlib in
loadoptions - Added
sourcemapsubcommand for debugging
[0.4.0-1] - January 7, 2023
Changed
- CLI options now use all lowercase (more standard)
--outDiris now--outdir--bitLibis now--bitlib
- Readline history no longer saves empty lines
- Parser now properly checks varargs scope (cannot be used outside vararg function)
Fixed
- Fixed
moduledeclarations with destructuring - Long strings no longer throw errors for unrecognized escape chars (same behavior as Lua)
- Fixed determining ReturnList variants
- Fixed compile error when return arrow function
return () -> { ... } - Fixed readline history not saving
- Fixed ambiguous iife syntax in compiled Lua (inject semicolon)
- CLI now checks one extra character when looking for the compiled footer comment (handle trailing newlines injected by editor)
Added
- Added versioned executables to allow specifying the underlying lua executable version. Each additionally sets
--targetappropriately.erde5.1- sets--target 5.1and useslua5.1executableerde5.2- sets--target 5.2and useslua5.2executableerde5.3- sets--target 5.3and useslua5.3executableerde5.4- sets--target 5.4and useslua5.4executableerdejit- sets--target jitand usesluajitexecutable
- Any arguments following a script to be run are now accessible in the script via the
argglobal (same behavior as Lua)- ex)
erde myscript.erde "myscript_arg1"
- ex)
- CLI now supports overwriting existing Lua files when compiling with
-f, --force - CLI now supports printing compiled code instead of writing to files with
-p, --print(useful for debugging)
[0.3.0-2] - November 7, 2022
Removed
- Erde no longer depends on argparse
Changed
erde runno longer uses a subcommanderde compileanderde cleanno longer default to cwd- Improved error messages and error handling
Fixed
- Fix assignment operator compiled operation
- Fixed compilation error rewriting for asserts
- Fixed compilation of exponentiation operator for pre Lua5.3
- Fixed empty message when error does not have stacktrace
- Fixed
C.BITLIBvsC.BIT_LIBinconsistencies - Fixed empty file compilation
- Erde now substitutes variable names that are keywords in Lua but not in Erde (previously produced invalid Lua code)
- Erde now reports error lines at the start of the error (previously reported after)
- Erde now correctly preserves newlines following interpolations in long strings.
- Erde now correctly rewrites top level errors (previously always used main file source map)
Added
- Added __tostring metamethod for thrown table errors (especially useful for sandboxed, embedded lua such as neovim)
- Added line numbers for errors when using
erde compile - Added REPL support
- Throw error when
returnstatement is not the last statement in a block
[0.3.0-1] - August 26, 2022
Removed
- Removed
doexpressions. - Removed spread operator.
- Removed optional chaining.
- Removed
erde.loader(replaced byrequire('erde').loadapi)
Changed
- Reverted split of
erdeanderdecin favor of morepacmanlike "main flags". - Improved
erde --helpoutput. erdenow runs with the regular lua shebang (#!/usr/bin/env luainstead of#!/usr/bin/env luajit)
Added
- Erde now supports running on Lua 5.1+
erdenow accepts Lua targets to compile to, with specific Lua version compatabilitieserdenow accepts specifying a bit library to compile bit operations to- Erde now generates souce maps and will rewrite errors when running scripts via the CLI or using
erde.load. - Several new apis have been added both to replace
erde.loaderand to allow for better error handlingerde.rewrite- rewrite Lua errors using a source map. Does a best-effort lookup for cached source map when one is not providederde.traceback- erde version ofdebug.tracebackw/ line rewriteserde.load- replacement forerde.loader, with an optional lua target as a parameter.erde.unload- api to remove the injected erde loader (from a previous call toerde.load).
[0.2.0-1] - June 03, 2022
Removed
- Removed
selfshorthand$. Completely unnecessary and confusing. - Removed
mainkeyword. Completely unnecessary and confusing. - Removed ternary / null coalescing operator
- Ternary created ambiguous syntax (
a ? b:c() : d()vsa ? b : c():d()) - Both difficult to optimize (requires iife)
- Ternary created ambiguous syntax (
Changed
- Refactored internal structure (now cleaner / faster)
- Erde now uses a newline to differentiate syntax ambiguity
- Erde no longer parses number destruct aliases as valid syntax
- Varargs now spreads when used as a table or param expression.
- Erde no longer allows trailing commas in Return expressions unless parentheses are present
erde.loaderno longer mutates the global require function, but usespackage.loaders(as it should)catchvar no longer uses parentheses (more lua like)catchvar can now be a destructure- Array destructures can no longer be nested inside map destructures
- String interpolation is no longer supported for single quote strings
- The
erdeexecutable has been split intoerde(interpreter) anderdec(compiler)argparsedoes not allow arguments if subcommands are used, which means we could not do:erde myfile.erdeto run a file. This was very unfriendly to scripts that may want to use a shebang witherde.- Use a similar structure as moonscript for familiarity.
Fixed
- Tokenizer now correctly consumes whitespace in string interpolation.
- String interpolation w/ names now compiles correctly.
- Parenthesized Return now parses correctly.
- Keywords are now allowed as named index chains (ex: x.if, y:else()).
!=operator is now actually compiled.- OptChain now correctly parses optional method calls
- Fixed void
return(i.e. no expressions) - Parser / compiler no longer crash when the ast is empty
[0.1.0-1] - March 3, 2022
Initial Release