mirror of
https://github.com/PeterCamilleri/fOOrth
synced 2024-09-28 03:20:28 +02:00
Day 1
This commit is contained in:
commit
2bfd05ed9b
14 changed files with 356 additions and 0 deletions
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
rdoc/
|
||||
*.gem
|
||||
*.zip
|
||||
*.tmp
|
17
.rdoc_options
Normal file
17
.rdoc_options
Normal file
|
@ -0,0 +1,17 @@
|
|||
--- !ruby/object:RDoc::Options
|
||||
encoding: UTF-8
|
||||
static_path: []
|
||||
rdoc_include:
|
||||
- .
|
||||
charset: UTF-8
|
||||
exclude: !ruby/regexp /(?-mix:doc)|(?-mix:sire.rb)|(?-mix:.*\.4th)|(?-mix:.*\.odt)|(?-mix:.*txt)|(?-mix:.*bat)|(?-mix:.*dll)|(?-mix:.*exe)/
|
||||
hyperlink_all: false
|
||||
line_numbers: false
|
||||
main_page:
|
||||
markup: rdoc
|
||||
page_dir:
|
||||
show_hash: false
|
||||
tab_width: 8
|
||||
title:
|
||||
visibility: :protected
|
||||
webcvs:
|
38
fOOrth.gemspec
Normal file
38
fOOrth.gemspec
Normal file
|
@ -0,0 +1,38 @@
|
|||
#Specify the building of the fOOrth gem.
|
||||
|
||||
Gem::Specification.new do |s|
|
||||
s.name = "fOOrth"
|
||||
s.summary = "FNF == fOOrth is Not FORTH."
|
||||
s.description = "An Object Oriented ~FORTH~ language gem."
|
||||
s.version = '0.6.0'
|
||||
s.author = ["Peter Camilleri"]
|
||||
s.email = "peter.c.camilleri@gmail.com"
|
||||
s.homepage = "http://teuthida-technologies.com/"
|
||||
s.platform = Gem::Platform::RUBY
|
||||
s.required_ruby_version = '>=1.9.3'
|
||||
|
||||
s.add_development_dependency 'rake'
|
||||
s.add_development_dependency 'reek'
|
||||
s.add_development_dependency 'minitest'
|
||||
|
||||
#s.add_runtime_dependency 'in_array'
|
||||
|
||||
s.files = ['lib/fOOrth.rb']
|
||||
s.files += Dir['lib/fOOrth/*.rb']
|
||||
s.files += Dir['lib/fOOrth/core/*.rb']
|
||||
s.files += Dir['lib/fOOrth/interpreter/*.rb']
|
||||
s.files += Dir['lib/fOOrth/compiler/*.rb']
|
||||
|
||||
s.files += Dir['tests/*.rb']
|
||||
|
||||
s.files += ['rakefile.rb',
|
||||
'license.txt',
|
||||
'readme.txt',
|
||||
'reek.txt']
|
||||
|
||||
s.extra_rdoc_files = ['license.txt']
|
||||
s.test_files = Dir['tests/*.rb']
|
||||
s.license = 'MIT'
|
||||
s.has_rdoc = true
|
||||
s.require_path = 'lib'
|
||||
end
|
109
fOOrth.reek
Normal file
109
fOOrth.reek
Normal file
|
@ -0,0 +1,109 @@
|
|||
---
|
||||
Attribute:
|
||||
enabled: false
|
||||
exclude: []
|
||||
BooleanParameter:
|
||||
enabled: true
|
||||
exclude: []
|
||||
ClassVariable:
|
||||
enabled: true
|
||||
exclude: []
|
||||
ControlParameter:
|
||||
enabled: true
|
||||
exclude: []
|
||||
DataClump:
|
||||
enabled: true
|
||||
exclude: []
|
||||
max_copies: 2
|
||||
min_clump_size: 2
|
||||
DuplicateMethodCall:
|
||||
enabled: true
|
||||
exclude: []
|
||||
max_calls: 1
|
||||
allow_calls: []
|
||||
FeatureEnvy:
|
||||
enabled: true
|
||||
exclude: []
|
||||
IrresponsibleModule:
|
||||
enabled: true
|
||||
exclude: []
|
||||
LongParameterList:
|
||||
enabled: true
|
||||
exclude: []
|
||||
max_params: 3
|
||||
overrides:
|
||||
initialize:
|
||||
max_params: 5
|
||||
LongYieldList:
|
||||
enabled: true
|
||||
exclude: []
|
||||
max_params: 3
|
||||
NestedIterators:
|
||||
enabled: true
|
||||
exclude: []
|
||||
max_allowed_nesting: 1
|
||||
ignore_iterators: []
|
||||
NilCheck:
|
||||
enabled: true
|
||||
exclude: []
|
||||
PrimaDonnaMethod:
|
||||
enabled: true
|
||||
exclude: []
|
||||
RepeatedConditional:
|
||||
enabled: true
|
||||
exclude: []
|
||||
max_ifs: 2
|
||||
TooManyInstanceVariables:
|
||||
enabled: true
|
||||
exclude: []
|
||||
max_instance_variables: 9
|
||||
TooManyMethods:
|
||||
enabled: true
|
||||
exclude: []
|
||||
max_methods: 25
|
||||
TooManyStatements:
|
||||
enabled: true
|
||||
exclude:
|
||||
- initialize
|
||||
max_statements: 7
|
||||
UncommunicativeMethodName:
|
||||
enabled: true
|
||||
exclude: []
|
||||
reject:
|
||||
- !ruby/regexp /^[a-z]$/
|
||||
- !ruby/regexp /[0-9]$/
|
||||
- !ruby/regexp /[A-Z]/
|
||||
accept: []
|
||||
UncommunicativeModuleName:
|
||||
enabled: true
|
||||
exclude: []
|
||||
reject:
|
||||
- !ruby/regexp /^.$/
|
||||
- !ruby/regexp /[0-9]$/
|
||||
accept:
|
||||
- Inline::C
|
||||
UncommunicativeParameterName:
|
||||
enabled: true
|
||||
exclude: []
|
||||
reject:
|
||||
- !ruby/regexp /^.$/
|
||||
- !ruby/regexp /[0-9]$/
|
||||
- !ruby/regexp /[A-Z]/
|
||||
- !ruby/regexp /^_/
|
||||
accept: []
|
||||
UncommunicativeVariableName:
|
||||
enabled: true
|
||||
exclude: []
|
||||
reject:
|
||||
- !ruby/regexp /^.$/
|
||||
- !ruby/regexp /[0-9]$/
|
||||
- !ruby/regexp /[A-Z]/
|
||||
accept:
|
||||
- _
|
||||
UnusedParameters:
|
||||
enabled: true
|
||||
exclude: []
|
||||
UtilityFunction:
|
||||
enabled: true
|
||||
exclude: []
|
||||
max_helper_calls: 1
|
41
lib/fOOrth.rb
Normal file
41
lib/fOOrth.rb
Normal file
|
@ -0,0 +1,41 @@
|
|||
# coding: utf-8
|
||||
|
||||
# The fOOrth Language System implemented via a Ruby gem.
|
||||
|
||||
require_relative 'fOOrth/interpreter'
|
||||
require_relative 'fOOrth/compiler'
|
||||
require_relative 'fOOrth/main'
|
||||
|
||||
#\XfOOrth - the module name space of the fOOrth language system.
|
||||
#* fOOrth.rb - The root file that gathers up all the system's parts.
|
||||
module XfOOrth
|
||||
|
||||
#The version of this module.
|
||||
#<br>Returns
|
||||
#* A version string; <major>.<minor>.<step>
|
||||
def version
|
||||
"00.06.00"
|
||||
end
|
||||
|
||||
#\VirtualMachine - the heart of the fOOrth language system.
|
||||
class VirtualMachine
|
||||
#The descriptive name of this virtual machine.
|
||||
attr_reader :name
|
||||
|
||||
#Create an new instance of a fOOrth virtual machine
|
||||
#<br>Parameters:
|
||||
#* name - An optional string that describes this virtual machine instance.
|
||||
def initialize(name='----')
|
||||
@name = name
|
||||
|
||||
#Bring the major sub-systems to a known state.
|
||||
interpreter_reset
|
||||
compiler_reset
|
||||
|
||||
#This virtual machine is associated with this thread.
|
||||
Thread.current[:vm] = self
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
9
lib/fOOrth/compiler.rb
Normal file
9
lib/fOOrth/compiler.rb
Normal file
|
@ -0,0 +1,9 @@
|
|||
# coding: utf-8
|
||||
|
||||
#* compiler.rb - The compiler portion of the fOOrth language system.
|
||||
module XfOOrth
|
||||
|
||||
class VirtualMachine
|
||||
end
|
||||
|
||||
end
|
9
lib/fOOrth/core.rb
Normal file
9
lib/fOOrth/core.rb
Normal file
|
@ -0,0 +1,9 @@
|
|||
# coding: utf-8
|
||||
|
||||
#* core.rb - The fOOrth language OO core.
|
||||
module XfOOrth
|
||||
|
||||
class VirtualMachine
|
||||
end
|
||||
|
||||
end
|
11
lib/fOOrth/interpreter.rb
Normal file
11
lib/fOOrth/interpreter.rb
Normal file
|
@ -0,0 +1,11 @@
|
|||
# coding: utf-8
|
||||
|
||||
require_relative 'interpreter/data_stack'
|
||||
|
||||
#* interpreter.rb - The run time interpreter portion of the fOOrth language system.
|
||||
module XfOOrth
|
||||
|
||||
class VirtualMachine
|
||||
end
|
||||
|
||||
end
|
9
lib/fOOrth/interpreter/data_stack.rb
Normal file
9
lib/fOOrth/interpreter/data_stack.rb
Normal file
|
@ -0,0 +1,9 @@
|
|||
# coding: utf-8
|
||||
|
||||
#* data_stack.rb - The fOOrth language system data stack.
|
||||
module XfOOrth
|
||||
|
||||
class VirtualMachine
|
||||
end
|
||||
|
||||
end
|
39
lib/fOOrth/main.rb
Normal file
39
lib/fOOrth/main.rb
Normal file
|
@ -0,0 +1,39 @@
|
|||
# coding: utf-8
|
||||
|
||||
require 'getoptlong'
|
||||
|
||||
#* main.rb - The entry point for a stand-alone fOOrth session.
|
||||
module XfOOrth
|
||||
|
||||
class VirtualMachine
|
||||
@library_loaded = false
|
||||
|
||||
#Has the fOOrth run time library been loaded?
|
||||
def library_loaded?
|
||||
@library_loaded
|
||||
end
|
||||
|
||||
#The fOOrth run time library has been loaded!
|
||||
def library_loaded
|
||||
@library_loaded = true
|
||||
end
|
||||
|
||||
#The starting point for an interactive fOOrth programming session.
|
||||
#This method only returns when the session is closed.
|
||||
#<br>To launch a fOOrth session, simply use:
|
||||
# XfOOrth::VirtualMachine.new.main
|
||||
def main
|
||||
|
||||
end
|
||||
|
||||
#Process the command line arguments. A string is returned containing
|
||||
#fOOrth commands to be executed after the dictionary is loaded.
|
||||
#<br>Returns
|
||||
#A string of fOOrth commands to be executed after the dictionary is loaded.
|
||||
def process_command_line_options
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
21
license.txt
Normal file
21
license.txt
Normal file
|
@ -0,0 +1,21 @@
|
|||
=== The MIT License (MIT).
|
||||
|
||||
Copyright (c) 2014 Peter Camilleri
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
45
rakefile.rb
Normal file
45
rakefile.rb
Normal file
|
@ -0,0 +1,45 @@
|
|||
#!/usr/bin/env rake
|
||||
# coding: utf-8
|
||||
|
||||
require 'rake/testtask'
|
||||
require 'rdoc/task'
|
||||
|
||||
RDoc::Task.new do |rdoc|
|
||||
rdoc.rdoc_dir = "rdoc"
|
||||
|
||||
#List out all the files to be documented.
|
||||
rdoc.rdoc_files = ["lib/fOOrth.rb",
|
||||
"lib/fOOrth/core.rb",
|
||||
"lib/fOOrth/interpreter.rb",
|
||||
"lib/fOOrth/compiler.rb",
|
||||
"lib/fOOrth/main.rb",
|
||||
"license.txt", "README.txt"]
|
||||
|
||||
#Make all access levels visible.
|
||||
rdoc.options << '--visibility' << 'private'
|
||||
end
|
||||
|
||||
Rake::TestTask.new do |t|
|
||||
#List out all the test files.
|
||||
t.test_files = []
|
||||
|
||||
t.verbose = false
|
||||
end
|
||||
|
||||
task :reek do |t|
|
||||
`reek --no-color lib > reek.txt`
|
||||
end
|
||||
|
||||
def eval_puts(str)
|
||||
puts str
|
||||
eval str
|
||||
end
|
||||
|
||||
task :console do
|
||||
require 'irb'
|
||||
require 'irb/completion'
|
||||
require './lib/fOOrth'
|
||||
puts "Starting an IRB console for fOOrth."
|
||||
ARGV.clear
|
||||
IRB.start
|
||||
end
|
2
readme.txt
Normal file
2
readme.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
This project contains the Ruby FlexArray gem. A gem used to facilitate the
|
||||
creation and processing of multi-dimensional arrays in a flexible manner.
|
2
reek.txt
Normal file
2
reek.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
|
||||
0 total warnings
|
Loading…
Reference in a new issue