From bddb011df4999f7ffeeddf6a4b66e2da6ab19ea0 Mon Sep 17 00:00:00 2001 From: Cody Date: Thu, 15 Dec 2022 13:23:48 -0600 Subject: Initial language designs & lexer from crafting interpreters The very initial language designs I came up with for Sloth. Likely contains inconsistencies and definitely contains things that will be changed in the future. This is basically just a dump of every idea I've had for the language thus far. As for the lexer right now it is heavily based on the one from the Crafting Interpretrs book and doesn't yet parse Sloth grammar. --- tour/annotations.sloth | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tour/annotations.sloth (limited to 'tour/annotations.sloth') diff --git a/tour/annotations.sloth b/tour/annotations.sloth new file mode 100644 index 0000000..91e88eb --- /dev/null +++ b/tour/annotations.sloth @@ -0,0 +1,24 @@ +# Annotations can be used to provide metadata used by the interpreter or via +# code using reflection (?). +# +# Annotations are scoped with the closest scopes take precedence, so if you +# had a package scoped annotation with strict mode enabled, but then a locally +# scoped annotation on a function with strict mode disabled strict mode would +# be disabled for that function. +# +# Scopes available: +# - package :: the current module and all other modules in the package +# - module :: only the current module +# - local :: only the current scope (default) +# - expr :: only the following expression +@package:name("Example Sloth program"); +@package:author("Cody "); +@package:summary("This program is a little tour de Sloth"); +@package:license("MIT"); + +# Similarly to TypeScript Sloth is a hybrid between a dyncmially typed and +# statically typed language, however if you would like to enforce static typing +# you can enable strict mode. +# +# Using strict mode is required for publishing to canopy. +@package:strict(true); -- cgit v1.2.3