Skip to content

Instantly share code, notes, and snippets.

View bakkdoor's full-sized avatar

Christopher Bertels bakkdoor

View GitHub Profile
@bakkdoor
bakkdoor / gist:741327
Created December 14, 2010 23:25
require.diff
diff --git a/lib/compiler/ast/require.fy b/lib/compiler/ast/require.fy
index 0e89a5c..7a8d548 100644
--- a/lib/compiler/ast/require.fy
+++ b/lib/compiler/ast/require.fy
@@ -4,10 +4,7 @@ class Fancy AST {
}
def bytecode: g {
- Fancy AST Self new: 1 . bytecode: g
- @string bytecode: g
============= :__script__ ==============
Arguments: 0 required, 0 total
Locals: 0
Stack size: 2
Lines to IP: 8: 0-11, 9: 12-23, 10: 24-35, 11: 36-47, 12: 48-59, 13: 60-71, 14: 72-83, 15: 84-95, 16: 96-107, 17: 108-119, 18: 120-131, 19: 132-143, 20: 144-155, 21: 156-167, 22: 168-179, 23: 180-191, 24: 192-203, 25: 204-215, 26: 216-227, 27: 228-239, 28: 240-251, 29: 252-263, 30: 264-275, 31: 276-287, 32: 288-299, 33: 300-311, 34: 312-325
0000: push_const_fast :Fancy, 1
0003: find_const 2
0005: push_literal "rbx/documentation"
@bakkdoor
bakkdoor / rbx.fyc
Created December 15, 2010 00:08
rubinius push_const_fast instruction
# [Operation]
# Pushes a constant onto the stack. Caches the lookup to provide
# faster future lookup
# [Format]
# \push_const_fast symbol_index association_index
# [Stack Before]
# * ...
# [Stack After]
# * const
# * ...
bakkdoor:~/projekte/fancy/fancy-lang[master*]> fancy -c tests/*.fy
Compiling tests/argv.fy
Compiling tests/array.fy
Compiling tests/block.fy
Compiling tests/class.fy
Compiling tests/documentation.fy
Compiling tests/exception.fy
Compiling tests/file.fy
rbx: vm/llvm/jit_visit.hpp:2859: void rubinius::JITVisit::visit_raise_return(): Assertion `creator' failed.
Aborted
bakkdoor:~/projekte/fancy/fancy-lang[master*]> fancy -c lib/*.fy
Compiling lib/argv.fy
Compiling lib/array.fy
Compiling lib/block.fy
Compiling lib/boot.fy
Compiling lib/class.fy
Compiling lib/compiler.fy
Compiling lib/directory.fy
Compiling lib/documentation.fy
Compiling lib/enumerable.fy
@bakkdoor
bakkdoor / fancy repl backtrace
Created December 15, 2010 01:57
fancy repl backtrace.
bakkdoor:~/projekte/fancy/fancy-lang[diff*]> fancy
An exception occurred running /home/bakkdoor/projekte/fancy/fancy-lang/bin/fancy
Coercion error: nil.to_str => String failed (TypeError)
Backtrace:
Type.coerce_to at kernel/common/type.rb:22
Kernel(Class)#StringValue at kernel/common/kernel.rb:112
File.expand_path at kernel/common/file.rb:360
main.__script__ at lib/compiler.fy:11
{ } in Fancy::CodeLoader.load_compiled_file:find_file: at lib/rbx/code_loader.fy:168
bakkdoor:~/projekte/fancy/fancy-lang[diff*]> fancy -cv lib/compiler.fy
Compiling lib/compiler.fy
============= :__script__ ==============
Arguments: 0 required, 0 total
Locals: 0
Stack size: 5
Lines to IP: 5: 0-11, 6: 12-23, 7: 24-35, 9: 36-47, 15: 48-48, 11: 49-75, 14: 76-77, 15: 78-84
0000: push_const_fast :Fancy, 1
@bakkdoor
bakkdoor / pluginsystem.cpp
Created December 15, 2010 13:51
rough idea.
class PluginManager;
enum EVENT_TYPE {
EVENT_BLOCK_PLACED,
EVENT_BLOCK_DESTROYED,
EVENT_PLAYER_MOVED
// etc...
}
// base event struct.
@bakkdoor
bakkdoor / thrift-mode.el
Created January 8, 2011 02:56
Simple thrift mode (taken from https://github.com/kragen/stevej-emacs/blob/master/thrift-mode/thrift.el) and adjusted to highlight self-defined types, unions & namespaces nicely.
(require 'font-lock)
(defvar thrift-mode-hook nil)
(add-to-list 'auto-mode-alist '("\\.thrift\\'" . thrift-mode))
(defvar thrift-indent-level 2
"Defines 2 spaces for thrift indentation.")
;; syntax coloring
@bakkdoor
bakkdoor / blocks.fy
Created January 9, 2011 01:04
Output of running blocks.fy - I cut out a big part that isn't interesting to the problem (due to output size). See below.
# Fancy source code for the output below:
i = 0
loop: { # endless loop, same as: while: { true } do: { ... }
"-------> " ++ i println
2 times: {
"yo" println
}
i = i + 1
}