Browse Source

Create core

master
Dylan Baker 5 years ago
parent
commit
88fd2818b9
2 changed files with 11 additions and 0 deletions
  1. 1
    0
      lib/chervil.rb
  2. 10
    0
      lib/chervil/core.rb

+ 1
- 0
lib/chervil.rb View File

@@ -1,4 +1,5 @@
1 1
 require 'chervil/ast'
2
+require 'chervil/core'
2 3
 require 'chervil/env'
3 4
 require 'chervil/interpreter'
4 5
 require 'chervil/lexer'

+ 10
- 0
lib/chervil/core.rb View File

@@ -0,0 +1,10 @@
1
+module Chervil
2
+  module Core
3
+    CORE = {
4
+      "+" => Proc.new { |*args| args.inject(:+) },
5
+      "-" => Proc.new { |*args| args.inject(:-) },
6
+      "*" => Proc.new { |*args| args.inject(:*) },
7
+      "/" => Proc.new { |*args| args.inject(:/) },
8
+    }
9
+  end
10
+end

Loading…
Cancel
Save