Skip to content

Instantly share code, notes, and snippets.

@CoderPuppy
Last active August 29, 2015 14:11
Show Gist options
  • Select an option

  • Save CoderPuppy/a198243716ed7941143f to your computer and use it in GitHub Desktop.

Select an option

Save CoderPuppy/a198243716ed7941143f to your computer and use it in GitHub Desktop.
An example of an imaginary programming language
/// Integers
123
/// Floats
1.23
1.
/// Arbitrary Precision Numbers
123n
1.23n
1n
/// Symbols
:fizbuz
:heyo
/// Text
// these are just tables
"fizbuz"
'fizbuz'
'hack \'n\' slash'
':{'interp'}olation'
/// Tables
{1;2;3}
{4;5;6;}
{
a = 123;
b = 'fizbuz';
c = 'foo'
}
{a=;b=}
// is the same as
{ a = a; b = b; }
{ a = 1; }.a // => 1
{ 1 }[1] // => 1
/// Closures
[x | x + 1]
func(x)
x + 1
end
func foo(x)
x + 1, x - 1
end
/// Calling
foo(1, 2, 3)
tbl:fizbuz(1, 2, 3)
// is the same as
tbl.fizbuz(tbl, 1, 2, 3)
/// Variables
let a = b
const a = b
let a, b = b, a
/// Modules
require('./file')
require('module')
return exports
/// Metadata
-package name@version
-author CoderPuppy
-license MIT
/// Statics
// can be resolved at compile-time
static.fizbuz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment