Littlescript is a project mainly written in JAVASCRIPT and COFFEESCRIPT, it's free.
A programming language to code on your mobile phone. Based off GOTOs and Global Variables
see a live demo at http://littlescript.the.tl
log "hello world"
name = "Drew"
log "hello #{name}"
my_number = 1
person = {}
arr = []
other_arr = arr
name = "Drew"
name = "Drew"
funny_str = string this goes to the end of the line
multi = "
strings can be mulit line.. watch out for extra spacing though
"
var = "variables"
stuff = {}
stuff.language = "LittleScript"
interp = "you can even interoplate #{var} in #{stuff.language}"
person = {}
person.name = "Drew LeSueur"
prop = "height"
# double dot is like []
person..prop = "5'8"
# similar to person[prop] = "5'8"
awards = []
awards.0 = "my first award"
awards.1 = []
awards.1.0 = "second award a"
awards.1.1 = "scond award b"
x = 1
if x is 1
s = string yes, x is 1
log s
end
y = 0
if y
log string y is truthy
else
log string y is falsy
end
def call_me
string 480-840-5406
end
phone = call_me !
log phone
def hello name
log name
end
my_name = string Drew LeSueur
hello my_name
def test_args
log args.0
log args.1
end
test_args 1 3 6
Use the scope
variable
scope.so
is the return value
def concat
` scope.so = scope.args.join("")
end
s = string My name is
name = string Drew LeSuuer
sentence = concat s name
log sentence
If you want to instead of functions
x = 1
ifgoto x xgood
goto xnotgood
label xgood
log "x_is_truthy"
goto quit
label xnotgood
log "x_is_falsy"
goto quit
label quit
exit
#exit exits the program
#comments are made with the # character
# setting x to "wowser"
x = string wowser
Add for in
loops and for of
loops
Add elseif
s.
For expressiveness, consider adding the following global handlers
onBeforeSetVariable
to be called before a variable is set. You can override what happensonSetVariable
to be called when a variable has been setonBeforeGetVariable
to be called before a variable is gotten. You can override what happensonGetVariable
to be called after a variable is gottenset!
function that sets a variable with no triggerget!
function that gets a variable with no triggeronBeforeExecuteLine
... is that getting too meta?)Write a compiler for other languages, Ruby, PHP, PHP 4, Bash, C, VB, C#, Java
Standard library
Possibly parens for nesting
Reevaluate what should go in the first pass, and what should go in the second pass
Possibly rewrite code for function calls instead of having it handled thru straight js
Right now functions are just integers. Allow an optional [int, my_scope]
array for functions
Think about expressiveness and get
, meta_get
; set
, meta_set
; call
, meta_call
Be cautious about adding too much