itty

Sean's Itty Bitty Programming Language
git clone https://code.literati.org/itty.git
Log | Files | Refs | LICENSE

commit 5069df76a6e0bdb1af1383a1cb2b3e743cdc8729
parent e226c91f7692f161bfb33cfb468d4d03f49d0f7f
Author: Sean Lynch <seanl@literati.org>
Date:   Thu, 26 Aug 2010 11:54:57 -0700

Add LICENSE and README

Diffstat:
ALICENSE | 20++++++++++++++++++++
AREADME.markdown | 94+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 114 insertions(+), 0 deletions(-)

diff --git a/LICENSE b/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2010 Sean Richard Lynch + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE.+ \ No newline at end of file diff --git a/README.markdown b/README.markdown @@ -0,0 +1,94 @@ +Itty +==== +Sean's Itty Bitty Language + +Itty is a stack-based language with single-character words, inspired +primarily by False and Mouse. + +Examples +-------- + +hello.itty is the classic hello world. + +pi.itty is an unbounded pi spigot; it will print the digits of pi +until the cows come home. IMHO this is a much better hello world for +this language; it's actually why I developed Itty in the first place. + + +Variables +--------- + +Currently there are 26 global variables represented by the ASCII +capital letters, and 26 local variables represented by the ASCII +lowercase letters. This will change: I intend to implement nested +scope and allow all 52 variables to exist in any scope. + +Variables are set with :<variable letter>, fetched by typing just the +letter. Functions stored in variables will be evaluated rather than +being put on the stack; to actually put the function on the stack use +;<variable> (not yet implemented). + +To set a bunch of variables at once, enclose the names in single +quotes, for example: 'abcd' will pop d, then c, then b, then a. This +makes it a lot easier to read and write functions that take multiple +arguments, since it's traditional to put arguments on the stack in +reverse order. + + +Blocks +------ + +Blocks are created by enclosing code in square brackets +([ and ]). Call a block unconditionally with ! or conditionally with +?. ? Takes three arguments: a boolean (0 for false or nonzero number +for true), a true case block, and a false case block. To leave one out +just use an empty block. To execute a tail call, make sure the ? or ! +comes right before a ]; whitespace will break the tail call detection +code (this is a bug). + + +Input +----- + +There is no input right now. Suggestions welcome. + + +Output +------ + +Comma (,) will print the ASCII character corresponding to the number +on the top of the stack. Print a newline with 10, or a tab with 8,. To +print a string, enclose it in double quotes. Strings may eventually be +first class, so this may change. There is no escape character; to +print double quotes use 34,. + +Period (.) will print the object on top of the stack, with no newline. + +Math +---- + +Numbers are represented by sequences of decimal digits. Only positive +integer constants can be represented. To put a negative number on the +stack, subtract from 0 or use the unary negation (_) operator. + +Only integers are supported; they are implemented as bignums using GNU +MP. Addition (+), subtraction (-), multiplication (*), floor division +(/), and modulo (%), and unary negation (_) are supported. Other +popular math functions that would be too slow to implement in Itty +will eventually go into a math module once I have modules. + + +Booleans +-------- + +Nonzero represents true; zero represents false. Operations are unary +not (~), binary and (&), and binary or (|). I may add xor in the +future using ^, which is currently the trace operation, and move trace +to a debug module once I've implemented namespaces. + + +Debugging +--------- + +There is currently only trace (^). Eventually debugging functions will +get their own module.