ruspea_lang 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.travis.yml +7 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +47 -0
- data/LICENSE.txt +21 -0
- data/README.md +183 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/ruspea +8 -0
- data/lib/example.rb +10 -0
- data/lib/example.rsp +23 -0
- data/lib/language/standard.rsp +77 -0
- data/lib/ruspea.rb +9 -0
- data/lib/ruspea/code.rb +19 -0
- data/lib/ruspea/error/arity.rb +7 -0
- data/lib/ruspea/error/resolution.rb +7 -0
- data/lib/ruspea/error/standard.rb +3 -0
- data/lib/ruspea/error/syntax.rb +4 -0
- data/lib/ruspea/interpreter/evaler.rb +67 -0
- data/lib/ruspea/interpreter/form.rb +27 -0
- data/lib/ruspea/interpreter/reader.rb +127 -0
- data/lib/ruspea/language/core.rb +185 -0
- data/lib/ruspea/language/ruby.rb +36 -0
- data/lib/ruspea/printer.rb +54 -0
- data/lib/ruspea/repl/loop.rb +85 -0
- data/lib/ruspea/repl/repl.rsp +2 -0
- data/lib/ruspea/runtime/env.rb +119 -0
- data/lib/ruspea/runtime/fn.rb +23 -0
- data/lib/ruspea/runtime/list.rb +67 -0
- data/lib/ruspea/runtime/lm.rb +74 -0
- data/lib/ruspea/runtime/nill.rb +54 -0
- data/lib/ruspea/runtime/sym.rb +28 -0
- data/lib/ruspea/version.rb +3 -0
- data/lib/ruspea_lang.rb +4 -0
- data/ruspea.gemspec +31 -0
- metadata +137 -0
@@ -0,0 +1,54 @@
|
|
1
|
+
require "singleton"
|
2
|
+
|
3
|
+
module Ruspea::Runtime
|
4
|
+
class Nill
|
5
|
+
include Singleton
|
6
|
+
|
7
|
+
ARRAY = [].freeze
|
8
|
+
|
9
|
+
def head
|
10
|
+
nil
|
11
|
+
end
|
12
|
+
|
13
|
+
def car
|
14
|
+
nil
|
15
|
+
end
|
16
|
+
|
17
|
+
def tail
|
18
|
+
self
|
19
|
+
end
|
20
|
+
|
21
|
+
def cdr
|
22
|
+
self
|
23
|
+
end
|
24
|
+
|
25
|
+
def count
|
26
|
+
0
|
27
|
+
end
|
28
|
+
|
29
|
+
def cons(el)
|
30
|
+
return List.new(el, self, count: 1)
|
31
|
+
end
|
32
|
+
|
33
|
+
def empty?
|
34
|
+
true
|
35
|
+
end
|
36
|
+
|
37
|
+
def to_a(*_)
|
38
|
+
ARRAY
|
39
|
+
end
|
40
|
+
|
41
|
+
def eq?(other)
|
42
|
+
self == other
|
43
|
+
end
|
44
|
+
|
45
|
+
def eql?(other)
|
46
|
+
self == other
|
47
|
+
end
|
48
|
+
|
49
|
+
def ==(other)
|
50
|
+
return true if other.is_a? Nill
|
51
|
+
false
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Ruspea::Runtime
|
2
|
+
class Sym
|
3
|
+
def initialize(id)
|
4
|
+
@id = String(id.to_s)
|
5
|
+
end
|
6
|
+
|
7
|
+
def to_s
|
8
|
+
@id
|
9
|
+
end
|
10
|
+
|
11
|
+
def eql?(other)
|
12
|
+
self == other
|
13
|
+
end
|
14
|
+
|
15
|
+
def ==(other)
|
16
|
+
return false if self.class != other.class
|
17
|
+
@id == other.id
|
18
|
+
end
|
19
|
+
|
20
|
+
def hash
|
21
|
+
@id.hash + :rsp_sym.hash
|
22
|
+
end
|
23
|
+
|
24
|
+
protected
|
25
|
+
|
26
|
+
attr_reader :id
|
27
|
+
end
|
28
|
+
end
|
data/lib/ruspea_lang.rb
ADDED
data/ruspea.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "ruspea/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "ruspea_lang"
|
8
|
+
spec.version = Ruspea::VERSION
|
9
|
+
spec.authors = ["Ricardo Valeriano"]
|
10
|
+
spec.email = ["mister.sourcerer@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{A full featured lisp to be used as a Ruby Library (written in Ruby)}
|
13
|
+
spec.description = %q{A full featured lisp to be used as a Ruby Library (written in Ruby)}
|
14
|
+
spec.homepage = "https://github.com/mistersourcerer/ruspea"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Specify which files should be added to the gem when it is released.
|
18
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
19
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
20
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
21
|
+
end
|
22
|
+
spec.bindir = "exe"
|
23
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
|
+
spec.require_paths = ["lib"]
|
25
|
+
|
26
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
27
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
28
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
29
|
+
|
30
|
+
spec.add_dependency "zeitwerk"
|
31
|
+
end
|
metadata
ADDED
@@ -0,0 +1,137 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ruspea_lang
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ricardo Valeriano
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-09-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: zeitwerk
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: A full featured lisp to be used as a Ruby Library (written in Ruby)
|
70
|
+
email:
|
71
|
+
- mister.sourcerer@gmail.com
|
72
|
+
executables:
|
73
|
+
- ruspea
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- ".gitignore"
|
78
|
+
- ".rspec"
|
79
|
+
- ".travis.yml"
|
80
|
+
- Gemfile
|
81
|
+
- Gemfile.lock
|
82
|
+
- LICENSE.txt
|
83
|
+
- README.md
|
84
|
+
- Rakefile
|
85
|
+
- bin/console
|
86
|
+
- bin/setup
|
87
|
+
- exe/ruspea
|
88
|
+
- lib/example.rb
|
89
|
+
- lib/example.rsp
|
90
|
+
- lib/language/standard.rsp
|
91
|
+
- lib/ruspea.rb
|
92
|
+
- lib/ruspea/code.rb
|
93
|
+
- lib/ruspea/error/arity.rb
|
94
|
+
- lib/ruspea/error/resolution.rb
|
95
|
+
- lib/ruspea/error/standard.rb
|
96
|
+
- lib/ruspea/error/syntax.rb
|
97
|
+
- lib/ruspea/interpreter/evaler.rb
|
98
|
+
- lib/ruspea/interpreter/form.rb
|
99
|
+
- lib/ruspea/interpreter/reader.rb
|
100
|
+
- lib/ruspea/language/core.rb
|
101
|
+
- lib/ruspea/language/ruby.rb
|
102
|
+
- lib/ruspea/printer.rb
|
103
|
+
- lib/ruspea/repl/loop.rb
|
104
|
+
- lib/ruspea/repl/repl.rsp
|
105
|
+
- lib/ruspea/runtime/env.rb
|
106
|
+
- lib/ruspea/runtime/fn.rb
|
107
|
+
- lib/ruspea/runtime/list.rb
|
108
|
+
- lib/ruspea/runtime/lm.rb
|
109
|
+
- lib/ruspea/runtime/nill.rb
|
110
|
+
- lib/ruspea/runtime/sym.rb
|
111
|
+
- lib/ruspea/version.rb
|
112
|
+
- lib/ruspea_lang.rb
|
113
|
+
- ruspea.gemspec
|
114
|
+
homepage: https://github.com/mistersourcerer/ruspea
|
115
|
+
licenses:
|
116
|
+
- MIT
|
117
|
+
metadata: {}
|
118
|
+
post_install_message:
|
119
|
+
rdoc_options: []
|
120
|
+
require_paths:
|
121
|
+
- lib
|
122
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
123
|
+
requirements:
|
124
|
+
- - ">="
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '0'
|
127
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
requirements: []
|
133
|
+
rubygems_version: 3.0.3
|
134
|
+
signing_key:
|
135
|
+
specification_version: 4
|
136
|
+
summary: A full featured lisp to be used as a Ruby Library (written in Ruby)
|
137
|
+
test_files: []
|