All Projects → presidentbeef → Brat

presidentbeef / Brat

Brat is a little language for people who don't like to be told what to do.

Programming Languages

c
50402 projects - #5 most used programming language
lua
6591 projects
language
365 projects

Labels

Projects that are alternatives of or similar to Brat

Turbo
Turbo is a framework built for LuaJIT 2 to simplify the task of building fast and scalable network applications. It uses a event-driven, non-blocking, no thread design to deliver excellent performance and minimal footprint to high-load applications while also providing excellent support for embedded uses.
Stars: ✭ 480 (+515.38%)
Mutual labels:  luajit
Nano Nginx
Nano container with nginx preconfigured as reverse proxy
Stars: ✭ 15 (-80.77%)
Mutual labels:  luajit
Luamqtt
luamqtt - Pure-lua MQTT v3.1.1 and v5.0 client
Stars: ✭ 58 (-25.64%)
Mutual labels:  luajit
Luaradio
A lightweight, embeddable software-defined radio framework built on LuaJIT
Stars: ✭ 509 (+552.56%)
Mutual labels:  luajit
Liko 12
LIKO-12 is an open source fantasy computer made using LÖVE.
Stars: ✭ 811 (+939.74%)
Mutual labels:  luajit
Lqt
Lua Binding for Qt5
Stars: ✭ 30 (-61.54%)
Mutual labels:  luajit
Picolove
PICO-8 Reimplementation in Love2D
Stars: ✭ 467 (+498.72%)
Mutual labels:  luajit
Luajit Msgpack Pure
MessagePack for LuaJIT (using FFI, no bindings, V4 API)
Stars: ✭ 71 (-8.97%)
Mutual labels:  luajit
Luaty
Lua with more or less typing. You type less; we type check.
Stars: ✭ 9 (-88.46%)
Mutual labels:  luajit
Koreader
An ebook reader application supporting PDF, DjVu, EPUB, FB2 and many more formats, running on Cervantes, Kindle, Kobo, PocketBook and Android devices
Stars: ✭ 9,467 (+12037.18%)
Mutual labels:  luajit
Grid Sdk
The Grid SDK - Game engine for Lua
Stars: ✭ 612 (+684.62%)
Mutual labels:  luajit
Raptorjit
RaptorJIT: A dynamic language for system programming (LuaJIT fork)
Stars: ✭ 784 (+905.13%)
Mutual labels:  luajit
Lua Resty Post
HTTP post utility for openresty
Stars: ✭ 30 (-61.54%)
Mutual labels:  luajit
Apisix
The Cloud-Native API Gateway
Stars: ✭ 7,920 (+10053.85%)
Mutual labels:  luajit
Pelagia
Automatic parallelization (lock-free multithreading thread) tool developed by Surparallel Open Source.Pelagia is embedded key value database that implements a small, fast, high-reliability on ANSI C.
Stars: ✭ 1,132 (+1351.28%)
Mutual labels:  luajit
Luv
Bare libuv bindings for lua
Stars: ✭ 466 (+497.44%)
Mutual labels:  luajit
Kong
🦍 The Cloud-Native API Gateway
Stars: ✭ 30,838 (+39435.9%)
Mutual labels:  luajit
Pure lua sha
SHA1, SHA2 and SHA3 functions written in pure Lua and optimized for speed
Stars: ✭ 78 (+0%)
Mutual labels:  luajit
Lgf
Game development framework for Lua
Stars: ✭ 68 (-12.82%)
Mutual labels:  luajit
Vanilla
An OpenResty Lua MVC Web Framework
Stars: ✭ 1,018 (+1205.13%)
Mutual labels:  luajit

Brat

Build Status

Try Brat online!

Brat is a simple little toy language that lets you do what you want. It is primarily object-oriented with first-class functions and very little syntax.

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 }
}

# Print 1 through 9
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 }

Brat compiles to Lua and runs on LuaJit.

Features

  • Dynamically typed
  • 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)

Requirements

Please have on hand:

  • Linux or OS X
  • The usual development tools (like make and gcc)
  • Git if you want to check it out of the repository directly - sudo urpmi git-core (or the equivalent for your platform)

Installation

Please follow the following steps, in the order in which they are ordered. Otherwise, results are not guaranteed.

With Git:

  1. Clone the latest Brat version: git clone git://github.com/presidentbeef/brat.git
  2. Change to new directory: cd brat
  3. Run sh ./build.sh
  4. Optionally, run sudo sh ./install.sh. This will install in /usr by default. Append a directory to change this.

Without Git:

  1. Download the latest
  2. Decompress the archive (unzip brat-master.zip)
  3. Change to the new directory (cd brat-master)
  4. Run sh ./build.sh
  5. Optionally, run sudo sh ./install.sh. This will install in /usr by default. Append a directory to change this.

Testing

Try out your newly discovered power thusly:

  1. Create a new file, perhaps called test.brat
  2. In that file, type something like: p "OK COMPUTER"
  3. Save and close it
  4. Return to the comfort of your command line
  5. Type brat test.brat (or ./brat test.brat if you did not run the install script)
  6. Cross fingers
  7. Press enter
  8. Marvel or weep, as appropriate

More Testing

Run brat test/test.brat to run the test suite. SWEET.

More fun

Running Brat without specifying a file will launch interactive mode.

$ ./brat
# Interactive Brat
brat:1> 1 + 1
#=> 2

Even more fun

Take a look at some examples of Brat code.

Problems

Sometimes there are problems. Everyone has issues. Report Brat issues here.

License

The MIT License

Copyright (c) 2009-2019, Justin Collins

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].