Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.6.3
2.7.0
45 changes: 24 additions & 21 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,48 +1,51 @@
PATH
remote: .
specs:
feeble (0.1.0)
feeble (0.2.0)
immutable-ruby
zeitwerk

GEM
remote: https://rubygems.org/
specs:
byebug (11.0.1)
byebug (11.1.1)
coderay (1.1.2)
concurrent-ruby (1.0.5)
diff-lcs (1.3)
immutable-ruby (0.0.4)
concurrent-ruby (~> 1.0.0)
method_source (0.9.2)
pry (0.12.2)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
pry-byebug (3.7.0)
pry-byebug (3.8.0)
byebug (~> 11.0)
pry (~> 0.10)
rake (10.5.0)
rspec (3.8.0)
rspec-core (~> 3.8.0)
rspec-expectations (~> 3.8.0)
rspec-mocks (~> 3.8.0)
rspec-core (3.8.0)
rspec-support (~> 3.8.0)
rspec-expectations (3.8.3)
rake (13.0.1)
rspec (3.9.0)
rspec-core (~> 3.9.0)
rspec-expectations (~> 3.9.0)
rspec-mocks (~> 3.9.0)
rspec-core (3.9.1)
rspec-support (~> 3.9.1)
rspec-expectations (3.9.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-mocks (3.8.0)
rspec-support (~> 3.9.0)
rspec-mocks (3.9.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.8.0)
rspec-support (3.8.0)
zeitwerk (2.1.6)
rspec-support (~> 3.9.0)
rspec-support (3.9.2)
zeitwerk (2.2.2)

PLATFORMS
ruby

DEPENDENCIES
bundler (~> 2.0)
feeble!
pry
pry-byebug
rake (~> 10.0)
rspec (~> 3.0)
pry-byebug (~> 3)
rake (~> 13.0)
rspec

BUNDLED WITH
2.0.1
2.1.2
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Feeble

Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/feeble`. To experiment with that code, run `bin/console` for an interactive prompt.

TODO: Delete this and the text above, and describe your gem
A small programming language for education purposes.
It is functional, favoring immuatbility and supports TCO.
Meant to be hosted, uses Ruby as a "runtime".

## Installation

Expand Down
3 changes: 0 additions & 3 deletions bin/console
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,5 @@ require "feeble"
require "pry"

include Feeble
include Feeble::Reader
include Feeble::Evaler
include Feeble::Runtime

Pry.start
8 changes: 4 additions & 4 deletions feeble.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ Gem::Specification.new do |spec|
spec.require_paths = ["lib"]

spec.add_development_dependency "bundler", "~> 2.0"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "rspec", "~> 3.0"
spec.add_development_dependency "pry"
spec.add_development_dependency "pry-byebug"
spec.add_development_dependency "rake", "~> 13.0"
spec.add_development_dependency "rspec"
spec.add_development_dependency "pry-byebug", "~>3"

spec.add_dependency "zeitwerk"
spec.add_dependency "immutable-ruby"
end
46 changes: 0 additions & 46 deletions lib/feeble/evaler/lispey.rb

This file was deleted.

25 changes: 0 additions & 25 deletions lib/feeble/language/ruby/define.rb

This file was deleted.

15 changes: 0 additions & 15 deletions lib/feeble/language/ruby/fbl.rb

This file was deleted.

25 changes: 0 additions & 25 deletions lib/feeble/language/ruby/lambda.rb

This file was deleted.

18 changes: 0 additions & 18 deletions lib/feeble/language/ruby/print.rb

This file was deleted.

18 changes: 0 additions & 18 deletions lib/feeble/language/ruby/println.rb

This file was deleted.

14 changes: 0 additions & 14 deletions lib/feeble/language/ruby/quote.rb

This file was deleted.

27 changes: 0 additions & 27 deletions lib/feeble/printer/expression.rb

This file was deleted.

7 changes: 0 additions & 7 deletions lib/feeble/printer/printable.rb

This file was deleted.

48 changes: 48 additions & 0 deletions lib/feeble/pushback_reader.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
class Feeble::PushbackReader
def self.with(io, chunk_size: 16384)
raise "Pass the block that will receive the pushback reader" if !block_given?

reader = new(io, chunk_size: chunk_size)
yield(reader)
reader.close
end

def initialize(io, chunk_size: 16384)
@io = io.is_a?(String) ? StringIO.new(io) : io
@chunk_size = chunk_size
@started = nil
@buffer = []
end

def next
return nil if eof?

@started ||= true
bufferize if @buffer.length == 0
@buffer.shift
end

def peek(length = 1)
bufferize if !@started
str = @buffer[0...length]
str.length > 0 ? str.join : nil
end

def push(string)
@buffer = string.to_s.chars + @buffer
end

def eof?
@buffer.length == 0 && @io.eof?
end

def close
@io.close
end

private

def bufferize
@buffer = @io.read(@chunk_size).chars
end
end
Loading