Module: Kapusta::Compiler
- Defined in:
- lib/kapusta/compiler.rb,
lib/kapusta/compiler/emitter.rb,
lib/kapusta/compiler/runtime.rb,
lib/kapusta/compiler/normalizer.rb,
lib/kapusta/compiler/emitter/interop.rb,
lib/kapusta/compiler/emitter/support.rb,
lib/kapusta/compiler/emitter/bindings.rb,
lib/kapusta/compiler/emitter/patterns.rb,
lib/kapusta/compiler/emitter/collections.rb,
lib/kapusta/compiler/emitter/expressions.rb,
lib/kapusta/compiler/emitter/control_flow.rb
Defined Under Namespace
Modules: EmitterModules, Runtime
Classes: Emitter, Error, Normalizer
Constant Summary
collapse
- SPECIAL_FORMS =
%w[
fn lambda λ let local var set if when unless case match
while for each do values
-> ->> -?> -?>> doto
icollect collect fcollect accumulate faccumulate
hashfn
. ?. :
..
length
require
module class
try catch finally
raise
ivar cvar gvar
ruby
tset pcall xpcall
and or not
= not= < <= > >=
+ - * / %
print
].freeze
Class Method Summary
collapse
Class Method Details
.compile(source, path: '(kapusta)') ⇒ Object
.run(source, path: '(kapusta)') ⇒ Object
39
40
41
42
|
# File 'lib/kapusta/compiler.rb', line 39
def self.run(source, path: '(kapusta)')
ruby = compile(source, path:)
TOPLEVEL_BINDING.eval(ruby, path, 1)
end
|
.run_file(path) ⇒ Object
44
45
46
|
# File 'lib/kapusta/compiler.rb', line 44
def self.run_file(path)
run(File.read(path), path:)
end
|