Sha256: 43fff94e219fcb0a66960f58dd0ee6f9aa94240fed157ae26124a64d004296d1

Contents?: true

Size: 951 Bytes

Versions: 327

Compression:

Stored size: 951 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

327 entries across 327 versions & 1 rubygems

Version Path
trackler-2.2.1.109 tracks/elixir/exercises/forth/forth.exs
trackler-2.2.1.108 tracks/elixir/exercises/forth/forth.exs
trackler-2.2.1.107 tracks/elixir/exercises/forth/forth.exs
trackler-2.2.1.106 tracks/elixir/exercises/forth/forth.exs
trackler-2.2.1.105 tracks/elixir/exercises/forth/forth.exs
trackler-2.2.1.104 tracks/elixir/exercises/forth/forth.exs
trackler-2.2.1.103 tracks/elixir/exercises/forth/forth.exs
trackler-2.2.1.102 tracks/elixir/exercises/forth/forth.exs
trackler-2.2.1.101 tracks/elixir/exercises/forth/forth.exs
trackler-2.2.1.100 tracks/elixir/exercises/forth/forth.exs
trackler-2.2.1.99 tracks/elixir/exercises/forth/forth.exs
trackler-2.2.1.98 tracks/elixir/exercises/forth/forth.exs
trackler-2.2.1.97 tracks/elixir/exercises/forth/forth.exs
trackler-2.2.1.96 tracks/elixir/exercises/forth/forth.exs
trackler-2.2.1.95 tracks/elixir/exercises/forth/forth.exs
trackler-2.2.1.94 tracks/elixir/exercises/forth/forth.exs
trackler-2.2.1.93 tracks/elixir/exercises/forth/forth.exs
trackler-2.2.1.92 tracks/elixir/exercises/forth/forth.exs
trackler-2.2.1.91 tracks/elixir/exercises/forth/forth.exs
trackler-2.2.1.90 tracks/elixir/exercises/forth/forth.exs