Skip to content

Instantly share code, notes, and snippets.

View bakkdoor's full-sized avatar

Christopher Bertels bakkdoor

View GitHub Profile
@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:~/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 / 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[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:~/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
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
# * ...
============= :__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 / 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
if: 3 < 4 then: {
# ...
} else: {
# ...
}
# vs:
if: (3 < 4) then: {
src/packets.cpp: In member function ‘int PacketHandler::holding_change(User*)’:
src/packets.cpp:677: warning: ‘itemID’ may be used uninitialized in this function
src/packets.cpp: In member function ‘int PacketHandler::complex_entities(User*)’:
src/packets.cpp:783: warning: ‘len’ may be used uninitialized in this function
src/packets.cpp:782: warning: ‘x’ may be used uninitialized in this function
src/packets.cpp:783: warning: ‘y’ may be used uninitialized in this function
src/packets.cpp:782: warning: ‘z’ may be used uninitialized in this function
src/packets.cpp: In member function ‘int PacketHandler::pickup_spawn(User*)’:
src/packets.cpp:715: warning: ‘item.spawnedItem::count’ may be used uninitialized in this function
src/packets.cpp:715: warning: ‘item.spawnedItem::item’ may be used uninitialized in this function