beer
is a programming language.
Most languages aim to provide strong features like
concurrency
.blazingly fast performance
.confusing memory safety on steroids
.A new package/framework/library/runtime every week
.
Can't you write a project on a lazy Sunday afternoon, without worrying about the future ?
beer
is a lighly brewed language, that aims to provide a simple and fun way to write code.
- The codebase is designed for beginner coders to understand and contribute.
- Aimed to be extensible and easy to hack on.
- Smartly documented with beautiful write-up and self-explanatory code.
- The syntax is not ambiguous and is easy to read.
- Looks beautiful and is fun to write.
- Errors don't scold you.
- Comes with a suite of tools to write, test and deploy code.
- Write, Test, Refactor quickly.
- You fall in love with coding.
a: 10
b: 20
if a > b { printf("a is greater than b") }
fn add(a, b) { ret a + b }
Call using
add(a:10, b:20)
fn something() { printf("something") }
}`
;; this is a comment
;;; this is a docstring
;;; before a function it becomes a docstring
number
, combination ofint
andfloat
.string
, a sequence of characters.boolean
,true
orfalse
.list
, a sequence of elements.table
.
+
,-
,*
,/
,%
.==
,!=
,>
,<
,>=
,<=
.&&
,||
,!
.++
,--
.
-
Write a test anywhere.
-
Just use
test
instead offn
.
test add { a: 10 b: 20 assert a + b == 30, "addition failed" }
assert
can test anything!
- A
cask
is a something like apackage
in other languages.
import math
- Export functions using
cask
keyword.
cask { ;; mention the functions you want to export ;; you can only export functions add, }
- Should be at the end of the file.
- A directory with a set of files becomes a
cask
, that can be imported with the directory name. - A directory when run using
beer run
will find themain
function and run it. It shouldn't be exported.
- Open a file with
.b
as extension and write code. - Run code with
beer run <filename>
- Generate a new project with
beer create
- Test code with
beer test
.