class Omnium::CLI::Core

Public Class Methods

new(args) click to toggle source
# File lib/omnium/cli/core.rb, line 8
def initialize(args)
  @filename = args&.first
end

Public Instance Methods

run() click to toggle source
# File lib/omnium/cli/core.rb, line 12
def run
  program = IO.readlines(@filename).join

  interpret(program)
rescue TypeError => e
  raise(CLIError, '@filename is blank.')
rescue Errno::ENOENT => e
  raise(CLIError, "@filename '#{@filename}' does not exist.")
end

Private Instance Methods

interpret(input) click to toggle source
# File lib/omnium/cli/core.rb, line 24
def interpret(input)
  lexer = Lexer.new(input)
  parser = Parser.new(lexer)
  interpreter = Interpreter.new(parser)
  interpreter.interpret

  interpreter.symbol_table
end