Releases: riff-lang/riff
0.3.6
New Features
read()
now accepts an optional string parameter which serves as the "mode" for the file read operation."A"
or"a"
will read the entire file, while"L"
or"l"
will read a single line (default).- Built-in functions
assert()
anderror()
have been added to aid error-handling.
Changes
eof()
andget()
have been removed as built-in functions.!read([f,]0)
can be used in place ofeof([f])
read([n])
is identical toget([n])
Fixes
- Fixed a bug where strings would not be coerced to numbers during table lookups
- Fixed an issue where the parser could signal the codegen to reserve stack space for local variables more than once
- Fixed a bug that prevented hexadecimal escape sequences from being lexed correctly
- Fixed a bug where the VM would interpret the operands of
OP_IMM16
as signed instead of unsigned
Full Changelog: 0.3.5...0.3.6
0.3.5
New Features
- Support for interpolation of expressions in string literals. This includes basic variable expansion, but also supports the full expression grammar of Riff.
- Keywords
and
,or
andnot
have been added to the language as aliases for&&
,||
and!
, respectively.
Changes
- Numbers without digits following the
.
are now lexed as floats. This matches the behavior of languages like C, Python, Lua, etc. Previously, this threw a "member access" syntax error. printf()
now defers towrite()
when the first argument is not a string.\
will now escape any character by default inside a string literal.
Fixes
- Fixed a bug introduced in 0.3.4 where local variables would not have their stack slot reserved, potentially causing memory corruption or segmentation faults.
Full Changelog: 0.3.4...0.3.5
0.3.4
Riff 0.3.4 implements codegen improvements and performance optimizations specifically for subscripting/indexing operations.
This release also includes a fix for an issue where segfaults would occur in some cases using the comma-delimited multidimensional table lookup syntax (e.g. x[y,z]
).
Full Changelog: 0.3.3...0.3.4
0.3.3
Riff 0.3.3 is a bug-fix release, mainly for a bug that rendered the built-in standard streams completely unusable (stdin
, stdout
and stderr
).
Full Changelog: 0.3.2...0.3.3
0.3.2
Riff 0.3.2 adds a new style of syntax for table lookups, as well as some optimizations related to string handling and allocation.
New Features
- "Member access" syntax for table lookups. This is functionally identical to Lua's "field" syntax, where
x.y
is syntactic sugar forx["y"]
, with an added benefit of faster lookups due to specialized opcodes.
Changes
- User-defined functions can no longer be indexed/subscripted.
Improvements
- String interning is now employed, decreasing overall memory usage and improving performance for string comparisons.
- Added a fast path for hash table lookups for hash tables consisting only of string keys. E.g. global variables in the VM. This speeds up global variable lookups by ~25%.
- String hashes are now computed using a constant-time hash function.
- A string's ability to be coerced to a number is now evaluated during string creation and cached in the string object.
Fixes
- Hash equality is no longer used for string comparisons, resolving issues stemming from hash collisions.
- Fixed a bug introduced in the previous release that could cause segmentation faults when collecting values for table iteration.
- Fixed an issue with iterating over
null
, which would cause segmentation faults.
Full Changelog: 0.3.1...0.3.2
0.3.1
Riff 0.3.1 is a minor release, mainly featuring a new hash table implementation under the hood. This new implementation improves performance and fixes some elusive bugs related to hash table key eviction.
This release also adds clock()
as a library function.
Full Changelog: 0.3...0.3.1
0.3
Riff 0.3 adds support for common I/O operations, as well as various changes and bug fixes.
New Features
- Support for file handles as a data type.
- Library functions:
open()
close()
read()
write()
flush()
eof()
get()
getc()
putc()
print()
printf()
eval()
exit()
- Predefined variables for standard I/O streams:
stdin
stdout
stderr
- Support for program input via standard input.
%m
format specifier for formatting integers as a multi-character string.- Support for bracket-delimited table literals. E.g.
[1,2,3]
.
Changes
- Interpreting Riff programs stored in files is now the default operation on the command-line. Literal programs provided on the command-line can be executed using the
-e
option. - Logical expressions (
&&
,||
) no longer evaluate strictly to1
or0
. - Support for
exit
andprint
as keywords have been removed in favor of library functionsexit()
andprint()
, respectively. srand()
now returns the value used to seed the PRNG.
Fixes
%c
format specifier now formats Unicode code points aschar()
andputc()
do.- Fixed an issue where strings with embedded zeros would not be parsed properly when used in regex operations.
- Fixed an issue where valid expressions like
a=f(b=1)
ora=b[c=d]
would throw an error during compilation. - Syntax errors such as
a=b+c=3
are now caught during compilation (I swear I already did this). - Fixed a bug related to shebang handling.
- Fixed a buffer overflow issue when disassembling programs containing long string literals.
- Fixed an issue where table lookups would cause a segmentation fault when the key is an unsupported data type.
- Fixed a bug where
break
orcontinue
statements not inside some loop construct would not be caught at compile time if the lexical depth was >= 1. - Runtime regex compilation errors are now caught. This could otherwise cause segfaults when a string is the RHS of a match expression, and the string is an invalid regex.
Full Changelog: 0.2.2...0.3
0.2.2
Riff 0.2.2 implements a few small features as well as some overdue bug fixes.
New Features
- String types can now be subscripted with negative indices.
- Substrings from numbers can now be extracted by subscripting with ranges.
- Character literals can now be composed of multiple characters, creating a Riff integer composed of the ordinal values of the character(s) in zero-padded big-endian form.
- Shebangs in Riff files are now skipped, allowing Riff source files to be made executable without the interpreter trying to parse the shebang as part of the program.
Changes
- Default output precision for floats increased to 14 (i.e.
%.14g
).
Fixes
- Fixed a codegen issue related to field expressions and postfix increment/decrement operators.
- Expressions between
?
and:
in ternary expressions are now truly parenthesized. - Strings are now tested for the literal
0
when evaluating truthiness in the VM. - Many temporary-usage strings are now stack-allocated instead of heap-allocated and subsequently freed.
OP_LEN
now correctly returns20
forINT64_MIN
.
Full Changelog: 0.2.1...0.2.2
0.2.1
Riff 0.2.1 introduces a new method for generating pseudo-random numbers, as well as other various enhancements.
New Features
- Extra forms of calling
rand()
to produce pseudo-random numbers:rand(x,y)
rand(<range>)
(e.g.rand(x..y:z)
)
- Command-line options:
-h
for printing basic usage information.--
for preventing any more command-line options from being processed.
%b
format specifier for formatting values as unsigned binary integers infmt()
.
Changes
- Pseudo-random numbers are now generated using
xoshiro256**
instead of the POSIXrand48()
family of functions. - Floats resulting from addition, subtraction or multiplication operations are no longer promoted to integers. Previously, the VM coerced results of these operations to integers if the float was equivalent to its truncated version (i.e.
result == (int64_t) result
). null
is returned when subscripting a value whose type isn't supported by subscripting operations (previously0
).- Version information is now generated from
git describe
at compile-time, instead of being hardcoded as a preprocessor macro.
Fixes
- An operator precedence issue caused by consuming unary minus symbols (
-
) directly prefixed to numeric literals during lexical analysis. - Any Riff value will properly seed the PRNG via
srand()
. Previously, values would be coerced to integers before seeding the PRNG. - String table keys that evaluate to
0
are now checked for the literal0
. This fixes a rare issue where strings like"+"
would be interpreted as0
. - Intermediate
rf_str
objects are no longer allocated and freed for string concatenation.
Full Changelog: 0.2...0.2.1
0.2
Riff 0.2 brings regular expression support using the Perl Compatible Regular Expressions library (PCRE2). Riff can be compiled and linked with a PCRE2 library installed on the system.
New Features
- Regular expression literals denoted by forward slash (
/
) delimited strings. - Match (
~
) and negated match (!~
) infix operators. - Functions
gsub()
andsub()
for performing find and replace on strings using regular expressions.
Changes
$n
expressions now refer to a "fields" table, where substrings from regular expression matches and captures are stored. Command-line arguments are still accessible via thearg
table.split()
now treats the optional second argument as a regular expression pattern delimiter.- Escape sequences in the form
\nnn
inside string and character literals are now interpreted as octal instead of decimal. This was changed to match the behavior of PCRE2, as well as many other widely-used languages.
Full Changelog: 0.1...0.2