Skip to content

Instantly share code, notes, and snippets.

$code = '' # Line for execution
$line_no = 0 # Line number
$base = 0 # Master pointer
$vars = { } # Variables hash table
$lines = [ ] # Lines of program
$return_stack = [ ] # Call stack
$run = true # False if END
@pankuznetsov
pankuznetsov / parse_string.rb
Created February 28, 2019 16:25
Code for paring string
$code = '' # Line for execution
$base = 0 # Master pointer, points the place where functions start parsing
def peek(oft) # Returns symbol from $code by index oft relatively to the $base
if oft < 0 or oft >= $code.size then return nil end
return $code[$base + oft]
end
def skip_trash # Function skipping whitespaces.
i = 0 # The pointer