 		
 	}
 	
+	/// Pop from stack
 	fileprivate func pop() throws -> StackElement {
 		
 		guard let last = stack.popLast() else {

		self.bytecode = bytecode
	}
	
	public func interpret() throws {
		
		stack = [StackElement]()


import Foundation


/// Interpreter Error
public enum InterpreterError: Error {
	/// Unexpected argument
	case unexpectedArgument
	
	/// Illegal stack operation
	case illegalStackOperation
}

/// Bytecode Interpreter
public class BytecodeInterpreter {
	
	fileprivate let bytecode: [BytecodeInstruction]
	
	typealias StackElement = Double
	
	/// Stack
	fileprivate(set) var stack = [StackElement]()
	
	/// Registers
	fileprivate(set) var registers = [String : StackElement]()
	
	
	/// Initalize a BytecodeInterpreter with an array of BytecodeInstruction
	///
	/// - Parameter bytecode: Array of BytecodeInstruction
	public init(bytecode: [BytecodeInstruction]) {
		self.bytecode = bytecode
	}
	
	/// Initalize a BytecodeInterpreter with an array of String
	///
	/// The strings will be parsed into Bytecode Instructions
	///
	/// - Parameter bytecodeStrings: bytecode instructions as strings
	public init?(bytecodeStrings: [String]) {
		
		var bytecode = [BytecodeInstruction]()
