Brat is a little language for people who don't like to be told what to do.
Brat is a little toy language that just doesn't care.
Brat uses a PEG parser written using TreeTop, a Ruby parser generator. The Brat code is compiled to Lua.
Brat is flexible enough that you can get by with a very small core and write any functionality that most languages use keywords for. For example, you can write and use a while loop like so:
#Loops until the block returns false
while = { block |
true? block, { while ->block }
}
n = 1
while {
p n
n = n + 1
n < 10
}
If you would rather have your conditions be separated out, you could define it this way instead:
#Loops until condition is false
while = { condition, block |
true? condition, { block; while ->condition, ->block }
}
n = 1
while { n < 10 } { p n; n = n + 1 }
Features
- Typeless, and pretty much classless
- Everything is object, except functions
- And functions are closures, which can be attached to objects to make methods
- Objects use a prototyping system and are completely open
- Built in hash tables and dynamic arrays
- Very flexible unary and binary operators
- Tail calls are optimized to make infinite loops faster (and more infinite)
Information updated 01/19/12
