A simple language compiles to bash.
- git clone
- make
- binary location: bundle/default/bin/sbash.exe
- git clone
- make mac
- binary location: _build/default/bin/sbash.exe
// basic type
a=1; // num
b="111"; // string
c=[1,2,3]; // num list
d=true; // bool
// basic operation
a=1+2*3-4/5;
b="deee"++"233";
c=[1,2,3]@@[4,5,6];
d=1==2;
e=2>3;
// if
a=1;
b=2;
if (a<b) {
c=2;
} else {
c=3;
}
// for
a=0;
for (i in [1,2,3]) {
a=a+i;
}
// while
a=0;
while (a < 5) {
a=a+1;
}
// define function
fun foo(a, b , c): string-> num -> bool -> string
{
return sprintf("%s,%d,%d", a, b , c);
}
- string|num|bool -> num
print arg to stdout with newline.
- string->…->num
- string->…->string
return formated string
- string -> string
call external shell command, return its stdout output as string.
e.g. call(“ls -l”);
- string -> bool
test if the file(arg) exists or not.
- string|num|bool -> string list
convert string|num|bool to string list
- string|bool|num -> num
convert string|bool|num to num
see also 2bash-mode
- editor support
emacs- vim
- add `break`, `continue`
add postion info to compile error