Skx Monkey Versions Save

An interpreted language written in Go

release-0.9.5

5 months ago

This release bundles together a bunch of fixes and updates, primarily aimed at improving the error handling. As this is the first release in some time the changelog here is a little abbreviated.

New features:

  • Support was added for switch and case
    • Implemented in #71, reported in #70.
  • Added explicit support for the null token.
    • Implemented in #83.
  • Support was added for regular expression capture groups.
    • Implemented in #69, reported in #68.

Improvements:

  • The addition of fuzz-testing, to help catch errors.
    • Implemented in #101, reported in #99
  • The range operator (..) allows descending ranges as well as ascending
    • Implemented in #100, reported in #98
  • The context supplied to the evaluator is no longer dropped and lost when handing (internal) recursion.
    • Implemented in #96, reported in #93.
  • Iteration over hash-keys returns things in a consistent order
    • Implemented in #91, reported in #90.
  • The new golang toolchain allows embedded files to be handled, without the use of an external build tool.
    • This was used to handle our standard library, in #73 .

Bugfixes:

  • Malformed regular expressions are caught and reported.
    • Implemented in #95, reported in #94.
  • Nested if/else if/else support was improved in #82.

release-0.9.4

3 years ago

release-0.9.4

This release features the addition of a new approach for iterating over the contents of arrays, hashes, and string-values with the foreach keyword. The new support is documented in the README.md, as well as being demonstrated in our sample code.

Our literal regular expressions were enhanced to allow access to capture groups. For example the following works as you might expect:

ip = "192.168.1.1";

if ( ip ~= /([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/  ) {
   printf("Matched! %s.%s.%s.%s\n", $1, $2, $3, $4 );
}

Here we see the capture groups are accessable in $1, $2, etc. as they would be in Perl scripts.

The example above also demonstrates a new enhancement to the built-in facilities, we now support outputting via format strings with either printf, and the use of sprintf to generate such strings.

Finally the range-operator allows creation of arrays containing contiguous integers, for example 1..10 creates and returns an array with the value [1,2,3,4,5,6,7,8,9,10].

In addition to these new features our internal codebase continued to improve, several linter warnings were resolved, and our internal implementation cleaned up a little more.

release-0.9.3

4 years ago

release-0.9.3

This minor release updates the handling of identifiers to allow functions/variables to have digits in their names, (however the initial character must be alphabetical) which was implemented in #58.

We've also improved the error-handling of the parser in #57, to abort correctly when fed incomplete programs. (Specifically we could encounter infinite loops when searching for closing block-terminators, and statement terminators.)

release-0.9.2

4 years ago

release-0.9.2

This release updates our language to add two new features:

  • The ability to define/use regular-expression literals, just like in perl
    • This was added via #53
  • The introduction of the ternary expression.
    • This was added via #55
    • NOTE: Nested ternary-expressions are denied, as a syntax error, because they're unreadable!

release-0.9.1

4 years ago

release-0.9.1

This release updates our CI process, improves our documentation and code-quality, but makes no significant new changes.

There have been some improvements to the implementation to resolve linting issues, and the parsing of && + || have been improved. In short this is a minor release which makes minor changes.

The github action which uploads our binaries has changed recently, so this lead to a minor update from the previous release.

release-0.9

4 years ago

release-0.9

This release updates our CI process, improves our documentation and code-quality, but makes no significant new changes.

There have been some improvements to the implementation to resolve linting issues, and the parsing of && + || have been improved. In short this is a minor release which makes minor changes.

release-0.8

5 years ago

This release improves the standard library a little, but is being made mostly to transition the testing and release process from TravisCI to github actions:

Changes include some additions to the standard-library:

  • type works on built-in functions.
  • There is a file-object.
  • There are facilities to run mkdir, chmod, etc.
  • Test cases updated and improved.

release-0.7

5 years ago

The previous release updated the Monkey-language to support object-based method-calls - invoking methods against objects, with the methods being written in Go.

In this release it became possible to define object-methods in Monkey, and this is now used to implement as much as possible of the languages' standard-library in monkey itself. For example functions which were previously implemented in golang, such as string.toupper(), string.tolower(), string.replace(), are now implemented solely in monkey.

Migrating methods to monkey provides a good example of real code, as well as providing an opportunity to see which abilities/functions were missing.

One example of the migration inspiring new features is the changes inspired by writing string.toupper(). It is obvious we'd want to test if a character was lower-case - the natural way to write that would be:

  if ( c >= 'a' && c <= 'z' ) {
  }

Unfortunately the use of && inside conditionals wasn't available, so I had to add it! Porting the string.toupper() function from golang to monkey directly inspired three new features:

  • The use of && in conditional-tests.
  • The use of || in conditional-tests.
  • The function string.ord() and integer.chr()
    • Both used to add/subtract 32 - which is used in ASCII case-conversion.

The only significant new feature in this release is the implementation of the eval method, which allows monkey-code to be executed dynamically at run-time. With the addition of this new eval function it became possible to write a useful assert method, which has been done.

Using our new assert/eval functions the standard-library code which is implemented in monkey is now tested at run-time. This should ensures that future-bugs are caught earlier.

Finally there were the usual range of bug-fixes including the following:

release-0.6

5 years ago

This release updates our parser and run-time to allow object-based method-calls.

Our primitive types (int, float, string, array, & map) have been updated to add some simple methods which may be invoked upon them. For example you can reverse a string like so:

let a = "Steve";
puts( a.reverse() );

Currently methods are implemented upon objects only in Go, it might be that in the future it will be possible to declare object-based methods natively.

This release changes compatibility with previous ones, because it denys the use of "." in method-names. In the past it would have been legal to declare a function with a period in the name, but now it is not - because we want to identify method-invokation instead.

So this used to work, but is now illegal:

  function foo.bar() { puts("Hello!\n" ); }

Finally this release fixes an omission where string-equality testing was not supported. It is now possible to compare two strings, as you would expect:

  let a = "Steve";
  let b = "Ste" + "ve";

  if ( a == b ) { puts( "We can compare strings, yay!\n" ); }

release-0.5

5 years ago

This release improves our language by adding several new features, the most obvious is that now "in-place" operators work for integers, allowing:

 let x = 1;
 x += 3;
 x *= 7;
 x -= 4;
 x /= 2;

 // x is now 12 

As a special case strings may be appended to via += too:

 let name = "Steve";
 name += " Kemp";

We've also updated function-definitions to allow default arguments, to allow code like this to work:

 function hello( name = "Steve" ) {  puts( "Hello, " + name + "\n" ); }
 hello();
 hello( "Bob" );

That code produces this output:

 Hello, Steve
 Hello, Bob

Finally we've added the ability to define "constant" variables, variables which cannot be modified:

 const PIE = 4;
 PIE = 43;         // This terminates the program.

The implementation of a few minor things has been cleaned up, and we've now implemented several of our core functions in 100% pure monkey - rather than in Golang. For example first(), rest() and last() are now 100% monkey, as are the definitions of the symbols PI and E.