Diesel.Dsl behaviour (diesel v0.1.0)
Defines the syntax provided by a DSL.
DSLs built with Diesel:
- are documents. They look like HTML.
- define tags
- can be compiled
- can be extended via packages and code generators
Simple usage:
defmodule Latex.Dsl do
use Diesel.Dsl,
otp_app: :my_app,
root: :latex,
tags: [
:document,
:package,
:section,
:subsection
]
end
A DSL can be extended via packages:
defmodule Latex.Dsl do
use Diesel.Dsl,
...
packages: [
Latex.Dsl.Music
]
end
Packages allow you to define extra tags, as well as compiler rules.
Additional packages can be specified via application environment.
These will be appended to the list of packages already declared in the module:
config :latex, Latex.Dsl,
packages: [
OtherApp.Latex.Dsl.Math
]
Summary
Callbacks
Link to this callback
compile(node, ctx)
Link to this callback
locals_without_parens()
@callback locals_without_parens() :: keyword()
Link to this callback
root()
@callback root() :: atom()
Link to this callback
tags()
@callback tags() :: [atom()]