bakkdoor-blocktalk 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.
Files changed (2) hide show
  1. data/bin/blocktalk +68 -0
  2. metadata +62 -0
data/bin/blocktalk ADDED
@@ -0,0 +1,68 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "rubygems"
4
+ require "treetop"
5
+
6
+ if ARGV.size < 1
7
+ puts "Error: Please specify a source file to interpret.\n\n"
8
+ puts "Usage:\nblocktalk source.bt [--debug / --ruby]"
9
+ exit
10
+ end
11
+
12
+
13
+ load_path = ""
14
+
15
+ if ARGV.join(" ").match(/\-I\s*(\S+)/)
16
+ $: << File.expand_path($1)
17
+ load_path = $1 + "/"
18
+ end
19
+
20
+ require load_path + "lib/core"
21
+ require load_path + "evaluator"
22
+ require load_path + "parser/nodes"
23
+
24
+ require "pp"
25
+
26
+
27
+ parser_dynamic = ARGV.include?("--dynparser")
28
+
29
+ if parser_dynamic
30
+ # load & generate parser from grammar dynamically
31
+ Treetop.load load_path + "grammar/blocktalk.tt"
32
+ else
33
+ # load pregenerated parser (faster)
34
+ require load_path + "grammar/blocktalk"
35
+ end
36
+
37
+ parse_file = ARGV[0]
38
+ parser = BlocktalkParser.new
39
+ ast = parser.parse IO.read(parse_file)
40
+
41
+ # start evaluation process
42
+ ast.evaluate
43
+
44
+ debug_on = ARGV.include?("--debug")
45
+ ruby_output = ARGV.include?("--ruby")
46
+
47
+ if debug_on
48
+ puts ast.inspect
49
+ puts "\n============================================================\n\n"
50
+ puts "--------------------\n"
51
+ puts "Generated Ruby code:\n"
52
+ puts "--------------------\n\n"
53
+ Evaluator.inspect
54
+ puts "\n============================================================\n\n"
55
+ end
56
+
57
+
58
+ if ruby_output
59
+ Evaluator.inspect
60
+ else
61
+ # also pass any additional args in ARGV to Evaluator
62
+ # (ARGV[0] is the name of the file to execute).
63
+ Evaluator.eval(ARGV[1..-1])
64
+
65
+ if debug_on
66
+ puts
67
+ end
68
+ end
metadata ADDED
@@ -0,0 +1,62 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bakkdoor-blocktalk
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Christopher Bertels
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-05-16 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: treetop
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
25
+ description:
26
+ email: bakkdoor@flasht.de
27
+ executables:
28
+ - blocktalk
29
+ extensions: []
30
+
31
+ extra_rdoc_files: []
32
+
33
+ files: []
34
+
35
+ has_rdoc: false
36
+ homepage: http://www.adztec-independent.de
37
+ post_install_message:
38
+ rdoc_options: []
39
+
40
+ require_paths:
41
+ - ""
42
+ required_ruby_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: "0"
47
+ version:
48
+ required_rubygems_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: "0"
53
+ version:
54
+ requirements: []
55
+
56
+ rubyforge_project:
57
+ rubygems_version: 1.2.0
58
+ signing_key:
59
+ specification_version: 2
60
+ summary: Blocktalk is a dynamic, object-oriented programming language somewhat in the tradition of Smalltalk and Ruby.
61
+ test_files: []
62
+