浏览代码

Create core

master
Dylan Baker 5 年前
父节点
当前提交
88fd2818b9
共有 2 个文件被更改,包括 11 次插入0 次删除
  1. 1
    0
      lib/chervil.rb
  2. 10
    0
      lib/chervil/core.rb

+ 1
- 0
lib/chervil.rb 查看文件

@@ -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 查看文件

@@ -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

正在加载...
取消
保存