Permalink
Browse files

removes samples and bootstrap code, not applicable anymore

  • Loading branch information...
1 parent 2bd4977 commit 8b34f1ecf1d8f1ec6c1a258c29be08a89d249259 @jeremytregunna jeremytregunna committed May 18, 2012
@@ -1 +0,0 @@
---colour
@@ -1,8 +0,0 @@
-source :rubygems
-
-gem 'parslet', '~> 1.2.3' #, :git => 'git://github.com/kschiess/parslet.git'
-#gem 'first-essence', :git => 'git://github.com/acutelanguage/acute.git'
-gem 'rake'
-gem 'rspec'
-gem 'simplecov', '>= 0.4.0', :require => false
-gem 'simplecov-rcov', :require => false
@@ -1,33 +0,0 @@
-GEM
- remote: http://rubygems.org/
- specs:
- blankslate (2.1.2.4)
- diff-lcs (1.1.3)
- multi_json (1.0.3)
- parslet (1.2.3)
- blankslate (~> 2.0)
- rake (0.9.2)
- rspec (2.6.0)
- rspec-core (~> 2.6.0)
- rspec-expectations (~> 2.6.0)
- rspec-mocks (~> 2.6.0)
- rspec-core (2.6.4)
- rspec-expectations (2.6.0)
- diff-lcs (~> 1.1.2)
- rspec-mocks (2.6.0)
- simplecov (0.5.3)
- multi_json (~> 1.0.3)
- simplecov-html (~> 0.5.3)
- simplecov-html (0.5.3)
- simplecov-rcov (0.2.3)
- simplecov (>= 0.4.1)
-
-PLATFORMS
- ruby
-
-DEPENDENCIES
- parslet (~> 1.2.3)
- rake
- rspec
- simplecov (>= 0.4.0)
- simplecov-rcov
@@ -1,29 +0,0 @@
-## Ruby bootstrap
-
-So you're brave. Brave enough to venture into trying to build this monstrocity. The initial bootstrap, the one you're looking at right
-now, is written in Ruby. Why Ruby? Why not? It has recent LLVM bindings, which are something we need, base types that I'd otherwise have
-to implement myself, and all these goodies. It's a "get up off the ground quickly" language for me, and for Acute.
-
-This code will no longer be used at some point in the future. When that happens, there will be LLVM IR in another dir under the main
-bootstrap dir, which will be used instead. This IR will be pre-generated from this very bootstrap, or perhaps, the full vm itself. Either
-way, the future bootstrap involves LLVM IR and not Ruby. I will however, leave the Ruby bootstrap, in all its wonderous glory, in the
-tree forever and ever, amen. Think of it as a donation for those who may want to understand how one little language was initially
-bootstrapped. Or a high level implementation of an IoVM. Either way, we'll leave it for science.
-
-### Building
-
-To build the Ruby bootstrap, we need to have installed, Ruby 1.9.2 (tested with -p180, other versions may work). We also need to have
-LLVM 2.9 built with the shared library (compile with --enable-shared). Go ahead, do that first; I'll wait.
-
-...
-
-Next you'll want to install bundler if you haven't already, it can be installed by running:
-
- $ gem install bundler
-
-Next, we ask bundler to install our dependencies:
-
- $ bundle install
-
-That's it, you're almost done. The next part hasn't been written yet, since we're only at the phase when I write this where the object
-model is being built up. The model is done, and tested, but no front-end exists yet. Stay tuned.
@@ -1,101 +0,0 @@
-#!/usr/bin/env ruby
-
-begin
- require 'rubygems'
- require 'bundler/setup'
-rescue LoadError => e
- e.render
-end
-
-$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
-require 'getoptlong'
-require 'parslet'
-require 'acute'
-require 'pp'
-
-def usage
- puts "Usage: #{$0} [options]"
- puts " --eval, -e <code> Evaluates the supplied code and exits"
- puts " --repl, -i Runs the read-eval-print-loop, this is the default"
- puts " --bench, -b Times how long the code takes to run"
- puts " --help, -h This message"
-end
-
-opts = GetoptLong.new(
- ['--eval', '-e', GetoptLong::REQUIRED_ARGUMENT],
- ['--repl', '-i', GetoptLong::NO_ARGUMENT],
- ['--bench', '-b', GetoptLong::NO_ARGUMENT],
- ['--help', '-h', GetoptLong::NO_ARGUMENT]
-)
-
-bench = false
-repl = false
-file = nil
-eval_string = nil
-evals = []
-
-opts.each do |opt, arg|
- case opt
- when '--help'
- usage
- exit 1
- when '--bench'
- bench = true
- when '--repl'
- repl = true
- when '--eval'
- eval_string = arg
- end
-end
-
-# We solve the chicken-egg problem by creating a new empty object as the lobby, we'll later set its parent
-# to Object once we create Object.
-lobby = ::Acute::Object.new
-$state = ::Acute::State.new(lobby)
-$state.init_protos
-
-display = proc do |code|
- parser = Acute::Parser.new
-
- if bench
- require 'benchmark'
- Benchmark.bmbm do |x|
- x.report { tree = parser.parse(code) }
- end
- else
- begin
- tree = parser.parse(code)
- rescue Parslet::ParseFailed => error
- puts error, parser.root.error_tree
- end
- end
-
- begin
- puts "=> " + tree.perform_on({ :sender => lobby, :target => lobby, :msg => tree }, lobby, lobby).to_s
- rescue Exception => e
- puts "Exception: " + e.message
- puts "\t" + e.backtrace.join("\n\t")
- end
-end
-
-file = ARGV.last unless repl or eval_string
-if file
- evals << File.read(file)
-elsif eval_string
- evals << eval_string
-end
-
-if evals.empty?
- if $stdin.tty?
- require 'readline'
- loop do
- code = Readline.readline "Acute> "
- exit 0 unless code and code != "exit"
- display[code]
- end
- else
- evals << STDIN.read
- end
-end
-
-evals.each(&display)
@@ -1,17 +0,0 @@
-# Acute Language
-# Copyright © 2011, Jeremy Tregunna, All Rights Reserved.
-#
-
-module Acute
- autoload :State, 'acute/state'
- autoload :Object, 'acute/object'
- autoload :Nil, 'acute/nil'
- autoload :Message, 'acute/message'
- autoload :Closure, 'acute/closure'
- autoload :Block, 'acute/block'
- autoload :Number, 'acute/number'
- autoload :List, 'acute/list'
- autoload :String, 'acute/string'
- autoload :Parser, 'acute/parser'
- autoload :Transformer, 'acute/transformer'
-end
@@ -1,65 +0,0 @@
-# Acute Language
-# Copyright © 2011, Jeremy Tregunna, All Rights Reserved.
-#
-
-module Acute
- class Block < ::Acute::Object
- # Blocks have a list of argument names, a Call object, a scope, and a body message.
- attr_accessor :argument_names, :scope, :body
- attr_reader :locals
-
- def initialize(scope, body, args = [])
- super()
- @scope = scope
- @body = body
- @locals = ::Acute::Nil.instance
- @activatable = true
- @argument_names = args.map(&:name) rescue [] #args[0].map(&:name) rescue []
- register(:parent, $state.find("Object"))
- method_table
- end
-
- def method_table
- method(:call) { |env| env[:target].call(env) }#, env[:msg].arguments) }
- method(:activate) { |env| activate(env) }
- method(:message) { |env| env[:target].body }
- method(:argumentNames) { |env| ::Acute::List.new(env[:target].argument_names.map { |a| ::Acute::String.new(a) }) }
- method(:scope) { |env| env[:target].scope }
- method(:setScope) { |env| env[:target].scope = env[:msg].eval_arg_at(env, 0); env[:target] }
- end
-
- def activate(env)
- call(env)#, env[:msg].arguments)
- end
-
- def call(env)#, args = [])
- #self.scope = $state.find("Object") unless scope
- create_locals(env, scope)
- argument_names.each_with_index do |name, idx|
- obj = env[:msg].eval_arg_at(env, idx)
- locals.register(name, obj)
- end
- body.perform_on(env, locals, locals)
- #doMessage(env.merge(:msg => body, :target => locals), locals)
- end
-
- def scope=(other)
- @scope = other
- locals.register(:parent, other)
- end
-
- private
-
- def create_locals(env, parent)
- @locals = ::Acute::Object.new
- locals.register(:parent, parent)
- locals.register(:self, scope || env[:target])
- call = ::Acute::Object.new
- call.register(:parent, $state.find("Object"))
- %w{target message sender}.each { |str| call.register(str, env[str.to_sym]) }
- call.register(:slotContext, env[:slot_context])
- call.register(:activated, self)
- locals.register(:call, call)
- end
- end
-end
@@ -1,24 +0,0 @@
-# Acute Language
-# Copyright © 2011, Jeremy Tregunna, All Rights Reserved.
-#
-
-module Acute
- class Closure < ::Acute::Object
- attr_reader :func
-
- def initialize(env, &blk)
- super()
- @func = blk
- @activatable = true
- @slots[:activate] = lambda {|e| activate(e) }
- end
-
- def activate(env)
- call(env, env[:msg].arguments)
- end
-
- def call(env, args = [])
- func.call(env)
- end
- end
-end
@@ -1,40 +0,0 @@
-# Acute Language
-# Copyright © 2011, Jeremy Tregunna, All Rights Reserved.
-#
-
-module Acute
- class List < ::Acute::Object
- include Comparable
- attr_reader :value
-
- def initialize(*args)
- super()
- @value = args
- method_table
- register(:parent, $state.find("Object"))
- end
-
- def method_table
- method(:at) { |env| env[:target].value[env[:msg].eval_arg_at(env, 0).to_i] }
- method(:append) { |env| env[:target].value << env[:msg].eval_arg_at(env, 0); self }
- method(:prepend) { |env| env[:target].value.unshift env[:msg].eval_arg_at(env, 0); self }
- method(:isEmpty) { |env| env[:target].value.empty? }
- method(:size) { |env| ::Acute::Number.new env[:target].value.count }
- method(:indexOf) { |env| ::Acute::Number.new(env[:target].value.index(env[:msg].eval_arg_at(env, 0))) }
- method(:asString) { |env| ::Acute::String.new(self.to_s) }
- end
-
- def <=>(other)
- self.value <=> other.value
- end
-
- def to_s
- s = "list("
- max_count = value.count - 1
- value.each_with_index do |elem, i|
- s << "#{elem.to_s}#{i != max_count ? ', ' : ''}"
- end
- s << ")"
- end
- end
-end
Oops, something went wrong.

0 comments on commit 8b34f1e

Please sign in to comment.