Module: Nydp

Defined in:
lib/nydp/readline_history.rb,
lib/nydp.rb,
lib/nydp/vm.rb,
lib/nydp/cond.rb,
lib/nydp/core.rb,
lib/nydp/error.rb,
lib/nydp/truth.rb,
lib/nydp/helper.rb,
lib/nydp/parser.rb,
lib/nydp/runner.rb,
lib/nydp/closure.rb,
lib/nydp/literal.rb,
lib/nydp/version.rb,
lib/nydp/compiler.rb,
lib/nydp/tokeniser.rb,
lib/nydp/assignment.rb,
lib/nydp/string_atom.rb,
lib/nydp/string_token.rb,
lib/nydp/symbol_lookup.rb,
lib/nydp/context_symbol.rb,
lib/nydp/function_invocation.rb,
lib/nydp/interpreted_function.rb

Overview

Defined Under Namespace

Modules: Builtin, Helper, ReadlineHistory Classes: Assignment, AssignmentInstruction, Closure, Compiler, Cond, ContextSymbol, Core, Error, Evaluator, ExecuteConditionalInstruction, FunctionInvocation, InterpretedFunction, InvocationFailed, InvokeFunctionInstruction, LexicalContext, Literal, Nil, Pair, Parser, PopArg, ReadlineReader, Runner, StreamReader, StringAtom, StringFragmentCloseToken, StringFragmentToken, StringReader, Symbol, SymbolLookup, Tokeniser, Truth, VM

Constant Summary collapse

PLUGINS =
[]
VERSION =
"0.0.5"
@@nil =
Nil.new
@@t =
Truth.new

Class Method Summary collapse

Class Method Details

.load_rake_tasksObject



5
# File 'lib/nydp.rb', line 5

def self.load_rake_tasks; PLUGINS.each &:load_rake_tasks      ; end

.loadall(vm, ns, files) ⇒ Object



10
11
12
13
14
15
# File 'lib/nydp.rb', line 10

def self.loadall vm, ns, files
  files.each { |f|
    reader = Nydp::StreamReader.new(File.new(f))
    Nydp::Runner.new(vm, ns, reader).run
  }
end

.loadfilesObject



7
# File 'lib/nydp.rb', line 7

def self.loadfiles;       PLUGINS.map(&:loadfiles).flatten    ; end

.NILObject



37
# File 'lib/nydp/truth.rb', line 37

def self.NIL; @@nil; end

.plug_in(plugin) ⇒ Object



4
# File 'lib/nydp.rb', line 4

def self.plug_in plugin ; PLUGINS << plugin                   ; end

.plugin_namesObject



9
# File 'lib/nydp.rb', line 9

def self.plugin_names   ; PLUGINS.map(&:name)                 ; end

.replObject



17
18
19
20
21
22
23
24
25
# File 'lib/nydp.rb', line 17

def self.repl
  puts "welcome to nydp"
  ns = { }
  setup(ns)
  vm = VM.new
  loadall vm, ns, loadfiles
  reader = Nydp::ReadlineReader.new $stdin, "nydp > "
  Nydp::Runner.new(vm, ns, reader, $stdout).run
end

.setup(ns) ⇒ Object



6
# File 'lib/nydp.rb', line 6

def self.setup ns;        PLUGINS.each { |plg| plg.setup ns } ; end

.TObject



38
# File 'lib/nydp/truth.rb', line 38

def self.T;   @@t;   end

.testfilesObject



8
# File 'lib/nydp.rb', line 8

def self.testfiles;       PLUGINS.map(&:testfiles).flatten    ; end

.tests(*options) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/nydp.rb', line 27

def self.tests *options
  verbose = options.include?(:verbose) ? "t" : "nil"
  puts "welcome to nydp : running tests"
  ns = { }
  setup(ns)
  vm = VM.new
  loadall vm, ns, loadfiles
  loadall vm, ns, testfiles
  reader = Nydp::StringReader.new "(run-all-tests #{verbose})"
  Nydp::Runner.new(vm, ns, reader).run
end