# `Dmn.Compiler.Env`
[🔗](https://github.com/FeeJai/BDM/blob/dmn-v0.1.0/apps/dmn/lib/dmn/compiler/env.ex#L1)

What the compiler knows while it builds the syntax tree of one unit: the model, the types of its item definitions, and the names
that are in scope where it is.

`scope` is the `Feel.Scope` of the unit, the names it may read from outside with their declared types: the input data and
decisions it requires, the functions it invokes. `parse_scope` is that and the names that the boxed expressions around the
fragment bind (the entries of a context, the parameters of a function, the variable of a loop), which is what the parser of FEEL
needs to read a name of several words (`Feel.parse/2`). The analyzer finds the second kind itself, from the tree.

# `t`

```elixir
@type t() :: %Dmn.Compiler.Env{
  definitions: Feel.ItemDefinitions.t(),
  element: String.t(),
  external: %{optional(atom()) =&gt; String.t()},
  function_outputs: %{optional(String.t()) =&gt; String.t()},
  index: Feel.Syntax.ScopeIndex.t(),
  language: String.t() | nil,
  limits: Feel.Limits.t() | nil,
  model: Dmn.Model.t(),
  parse_scope: Feel.Scope.t(),
  scope: Feel.Scope.t()
}
```

# `bind`

```elixir
@spec bind(t(), [String.t()]) :: t()
```

The environment inside an expression that binds `names`: they are names for the parser, and are not typed (the analyzer types
them from the tree).

# `new`

```elixir
@spec new(
  Dmn.Model.t(),
  Feel.ItemDefinitions.t(),
  Feel.Scope.t(),
  String.t(),
  keyword()
) :: t()
```

The environment of the unit of `element`, with the scope of its requirements.

Options: `:limits`, `:external` (the kinds of external function that the extensions run, `Dmn.Extension.external_functions/1`), `:function_outputs` (the type each function item names for its output, `Dmn.Compiler.Types.function_outputs/1`), and `:base_index`, the index (`Feel.Syntax.ScopeIndex`) of a scope that has the types of the scope and no
name. The names of a unit are added to it, and the types, which are the size of the item definitions of the model, are not made
again for each unit.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
