Skip to content

Conversation

@IsaacOscar
Copy link

I've made several changes to increase the ammount of code that works in both kernan and minigrace, specifically:

  • I have made the parser more forgiving:
    • Blocks can now have patterns that arn't paranthesised, when their is no abiguity, e.g. {Foo.Bar -> hello } is shorthand for { _ : Foo.Bar -> hello }
    • \e in string literals is now the ANSI escape character.
    • semicolons can now be used as statement seperators (and not just terminators) e.g "foo; bar".
      statements can end via means other than a newline or semicolon e.g. in "class{ foo }", "foo" is ended by the "}".
    • new lines are now allowed before expressions (e.g. foo(\nbar), where \n is a newline character).
    • binary operators may now have spaces arround them
    • I deleted checks that lines are correctly indented (because it was rejecting lots of code minigrace accepts), i.e. it is now more permisive (as opposed to more restrictive) then minigrace.
    • I have added "matches" methods to patterns (including types, strings and numbers) that returns a Boolean (like minigrace), they still have Kernan's match method though.
  • Objects now have a default "hash" method that uses object-identity.
  • Strings now have *, replace(_) with(_), and split(_) methods.
  • Booleans now support || and && when the RHS is a block.
  • Numbers niow have a truncated method.
  • I have significantly modifies sequences, for simplicity, kernan now only provides one kind (a "Sequence") that is not lazy. I also implemented ==, indexOf, do(_) separatedBy(_), map(_), ++(_), size, sizeIfUnknown, first, last, indices, hash, at(_) and contains(_). Note that because I'm lazy, I didn't make map lazy (as it is in minigrace).
  • I fixed a bug where matching against type-intersections behaved the same as variants.

Incompatabilities I have not fixed (that can't simply be fixed by using a custom dialect)

  • Many more missing methods....
  • support for ...
  • Support for is abstract and is required
  • Using outer as an expression (and not just a receiver)
  • Using outer.outer.
  • Having closing square brackets right next to a closing curley, e.g. {[ "hello" ]}, one must write {[ "hello" ] },
  • It is not an error if a match-case has multiple cases match
  • The confidential isMe and myIdentityHash methods.

@IsaacOscar
Copy link
Author

I've now made it so that "\n" is the ASCII line feed character (as it is in every other language...) and not the Unicode line-seperator character.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant