asdlGen
Reference Manual
: Input Syntax
: View Syntax
: Basic SyntaxViews are named and consist of series of entries. Each entry conceptually begins with a fully qualified type, constructor, or module name. Following that name is a key value pair. The meaning of the entry is to add a particular key value pair into an internal table associated with the type, constructor, or module. The type, constructor or module is referred to as the view entity the key is referred to as the view property. The value is an arbitrary string. In the grammar above the arbitrary string is represented with the lit-txt non-terminal. lit-txt is either a ":" followed by some arbitrary text that continues to the end of the line or a "%%" balanced by a "%%" at the beginning of a line by itself. Text include using the ":" notation will have trailing and leading whitespace removed. For example
view Doc {
module M <= doc_string
%%
Types for representing LISP s-expressions.
%%
M.sexpr <= doc_string : s-expressions
M.Int <= doc_string : s-expression constructor
M.Symbol <= doc_string : s-expression constructor
M.Cons <= doc_string : s-expression constructor
M.Nil <= doc_string : s-expression constructor
}
view Java {
M.sexpr <= source_name : Sexpr
M.sexpr <= base_class : MyClass
}
associates with the module M the type M.sexpr and the constructor M.Int
strings that will be added to the automatically generated documentation
produced by the --doc
command of asdlGen
. ( In future we'll
probably dump them in comments in the output code too.) The view named
Java
causes the type M.sexpr
to be renamed Sexpr
when
generating Java output, and causes the abstract class normally generated to
inherit from MyClass
.
There can be many views with the same name. The entries of two views with the same name are merged and consists of the union of the entries in both. It is an error, for two views of the same name to assign different values to the same property of an entity. Currently this error isn't checked for so you randomly get one or the other.
asdlGen
Reference Manual
: Input Syntax
: View Syntax
: Basic Syntax