diff options
| author | Drahflow <drahflow@gmx.de> | 2012-12-31 19:00:08 +0100 |
|---|---|---|
| committer | Drahflow <drahflow@gmx.de> | 2012-12-31 19:00:08 +0100 |
| commit | d7d307dc6563fe27bf43cab1e83ac21204fea6c6 (patch) | |
| tree | 13a37937bbdb8a25c953183be0b8cf61e3acc6a9 /compiler/standard.ey | |
| parent | ac637b1cda03446a57ca6b1f20e5e63f1c8d7d0f (diff) | |
Bytecode executing
Specifically, an empty opcode sequence is executed
for each token. Next up: Scope resolution and actually
call some of these functions.
Diffstat (limited to 'compiler/standard.ey')
| -rw-r--r-- | compiler/standard.ey | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/compiler/standard.ey b/compiler/standard.ey index 7c92e35..0d96431 100644 --- a/compiler/standard.ey +++ b/compiler/standard.ey @@ -1,7 +1,44 @@ +|defv "==" deff +|deff "=*" deff + { "}" | * { /f deff /x defv { x f } } quoted { } { * } ? * -} "}0" defq +} "}_" defq + +{ ==f _ ==a len ==l + l { + 0 a * + 1 l 1 sub range { a * f * } each + } { "fold on empty array" die } + ? * +} /fold deff + +{ |or fold } /any deff +{ |and fold } /all deff + +{ =*p { + [ -01 { _ p { } { -- } ? * } each ] +} } /engrep deff + +{ engrep * } /grep deff +{ -110 ; engrep |dom -20*1* } /indices deff + +{ =*p _ =*a len ==l + 1 neg ==r + + 0 { + _ l lt 1 neg r eq and + } { + _ a p { _ =r } { } ? * + 1 add + } loop -- + r +} /index deff + +{ + not { "Assertion failure" die } rep +} /assert deff # vim: syn=elymas |
