Module: Cambridge
- Defined in:
- lib/cambridge.rb,
lib/cambridge/tokens.rb,
lib/cambridge/scanner.rb,
lib/cambridge/version.rb,
lib/cambridge/tokenizer.rb,
lib/cambridge/environment.rb,
lib/cambridge/parser/scan.rb,
lib/cambridge/tokens/number.rb,
lib/cambridge/tokens/string.rb,
lib/cambridge/tokens/command.rb
Defined Under Namespace
Modules: Parser, Tokens
Classes: Environment, Scanner, Tokenizer
Constant Summary
collapse
- VERSION =
"0.0.1"
Class Method Summary
collapse
Class Method Details
.compile_string(string) ⇒ Object
15
16
17
18
|
# File 'lib/cambridge.rb', line 15
def self.compile_string(string)
tokenizer = Cambridge::Tokenizer.new string
tokenizer.to_ruby
end
|
.run_file(filename) ⇒ Object
6
7
8
9
|
# File 'lib/cambridge.rb', line 6
def self.run_file(filename)
contents = File.read filename
run_string contents
end
|
.run_string(string) ⇒ Object
11
12
13
|
# File 'lib/cambridge.rb', line 11
def self.run_string(string)
Environment.new.eval compile_string(string)
end
|