This repository has been archived by the owner on May 13, 2019. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
506 additions
and
275 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,18 @@ | |||
#!/usr/bin/env ruby | |||
|
|||
$: << "/home/matthew/src/citrus/lib" | |||
|
|||
$: << File.join(File.dirname(File.dirname(__FILE__)), "lib") | |||
|
|||
require 'rasp' | |||
|
|||
filename = 't/math.vbs' | |||
parse = Rasp::Parser.parse(File.read(filename), :consume => true) | |||
#puts parse.dump | |||
|
|||
parse.value.graph | |||
#p parse.value | |||
|
|||
$DEBUG = true | |||
p Rasp::Compiler.new.compile(parse.value, filename) | |||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,3 @@ | |||
require 'rasp/compiler' | |||
require 'rasp/parser' | |||
require 'rasp/ast' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,12 +1,21 @@ | |||
module Rasp::AST | module Rasp::AST | ||
|
|
||
class Scope < Node | class File < Node | ||
include Rubinus::Compiler::LocalVariables | include Rasp::Compiler::LocalVariables | ||
|
|
||
attr_accessor :statements | attr_accessor :statements | ||
def initialize(statements) | def initialize(statements) | ||
@statements = statements | @statements = statements | ||
end | end | ||
def global; self; end | |||
def bytecode(g) | |||
g.push_state self | |||
statements.each do |s| | |||
p s | |||
s.bytecode(g) | |||
end | |||
g.pop_state | |||
end | |||
end | end | ||
|
|
||
end | end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,10 @@ | |||
module Rasp::AST | |||
|
|||
class VarAccess < Node | |||
attr_accessor :var | |||
def initialize(var) | |||
@var = var | |||
end | |||
end | |||
|
|||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.