Sha256: 922dea0403c0da327d6eb8e55d65479ad5a43733941cf74bebe6d8fa084a2bde
Contents?: true
Size: 950 Bytes
Versions: 69
Compression:
Stored size: 950 Bytes
Contents
defmodule Forth do @opaque evaluator :: any @doc """ Create a new evaluator. """ @spec new() :: evaluator def new() do end @doc """ Evaluate an input string, updating the evaluator state. """ @spec eval(evaluator, String.t()) :: evaluator def eval(ev, s) do end @doc """ Return the current stack as a string with the element on top of the stack being the rightmost element in the string. """ @spec format_stack(evaluator) :: String.t() def format_stack(ev) do end defmodule StackUnderflow do defexception [] def message(_), do: "stack underflow" end defmodule InvalidWord do defexception word: nil def message(e), do: "invalid word: #{inspect(e.word)}" end defmodule UnknownWord do defexception word: nil def message(e), do: "unknown word: #{inspect(e.word)}" end defmodule DivisionByZero do defexception [] def message(_), do: "division by zero" end end
Version data entries
69 entries across 69 versions & 1 rubygems