diff options
Diffstat (limited to 'source/primitives/core.d')
-rw-r--r-- | source/primitives/core.d | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/source/primitives/core.d b/source/primitives/core.d index 75783ed..ab0b85c 100644 --- a/source/primitives/core.d +++ b/source/primitives/core.d @@ -1,9 +1,20 @@ module primitives.core; import std.stdio; +import std.variant; import state.stack; +bool handle(Token token) { + return token.visit!( + (int ) => false, + (bool ) => false, + (string word) => handle(word) + ); +} + +private { + bool handle(string word) { switch ( word ) { case "+" : binary_op_add; break; @@ -24,8 +35,6 @@ bool handle(string word) { return true; } -private { - void binary_op_add() { int b = stack.pop.get!int; int a = stack.pop.get!int; |