Skip to content

Instantly share code, notes, and snippets.

@eihigh
Last active February 6, 2019 04:20
Show Gist options
  • Save eihigh/cbb764322339c61cfa2562b74f10efd5 to your computer and use it in GitHub Desktop.
Save eihigh/cbb764322339c61cfa2562b74f10efd5 to your computer and use it in GitHub Desktop.
-----
proc <hoge> { rcv <s> <Scanner> in (int) (string) out (string) } {
wait (60)
if <Var.count < 3> {
se <step1>
get { item <elixir> num (5) }
get { item <gold key> }
set <count> <knock_power * 2>
m ||
Hello World!
||
loop <Var.count < 10> {
member { add <Bob> init <yes> }
member { remove <Alice> }
inc <count>
}
for ($i) ($e) { range (array) } {
printf <%d: %d> (i) (e)
sum (sum + e)
}
query |SQL|
SELECT * FROM table WHERE id > 10
|SQL|
}
} # proc
yol := table | array | ordered
table := { (key array)* }
array := value+ | [ value* ]
tokens {
lparen # (
rparen # )
lbrack # [
rbrack # ]
lbrace # {
rbrace # }
labrack # <
rabrack # >
apos # '
key # any string
lheredoc # |foobar|
rheredoc # |foobar|
}
type Table struct {
pairs []Pair `LBRACE @@* RBRACE`
}
type Pair struct {
key Key `@KEY`
values Array `@@`
}
type Array struct {
values []Value `( @@+ | LBRACK @@* RBRACK )`
}
type Value struct {
lit *string `( @STRING `
heredoc *string `| @HEREDOC `
expr *Expr `| @EXPR `
table *Table `| @@ `
array *Array `| @@ )`
}
defs {
yol {
or <table> <array>
}
table [
<{>
{ any <key> <array> }
<}>
]
array {
or [
{ rep <value> }
[ <[> { any <value> } <]> ]
]
} # array
}
func <fact> { in (n) (int) out (int) } {
return (n * fact(n-1))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment