Module Parse

Parse

include Parse__.Syntax
type arg =
| Atom of string * arg list

atom. e.g. a(X, Y)

| ProcCtx of string

unary process context. e.g. $p

| IntData of int

int. e.g. 1

argument of an atom

type proc =
| Zero

null.

| Graph of arg

atom. e.g. a(Y, b(X))

| Mol of proc * proc

molecule. e.g. (P, Q)

| Rule of string option * proc * proc * proc

rule. e.g. P :- G1, ..., Gn | Q.

process

type atom_name_associativity =
| AscLeft
| AscNone
| AscRight

associativity of operators

type atom_name_precedence = int

precedence of operators

  • >= 1 for an operator atom name
  • 0 for a normal symbol atom name
  • -1 for a quoted atom name
type atom_name_type =
| ANOp of atom_name_associativity * int

operator

| ANSymbol

symbol atom

| ANQuoted

failed to parse

Types of atom names

include Parse__.Pretty
val analyze_atom_name : string -> Parse__.Syntax.atom_name_type

analyze atom name and obtain associativity and precedence

val string_of_arg : int -> Parse__.Syntax.arg -> string

アトムの引数部分の pretty printer

val string_of_list : Parse__.Syntax.arg -> Parse__.Syntax.arg -> string

リストの略記法の pretty printer

val string_of_atom : Parse__.Syntax.arg -> string

アトムの pretty printer

val string_of_guard : Parse__.Syntax.arg list -> string

ガードの pretty printer. ただし,これはアトムのリストになっているガードのための pretty printer で, 構文解析直後に得られるガード(プロセスとして構文解析される)のためのものではない.

val string_of_proc : int -> Parse__.Syntax.proc -> string

プロセスの pretty printer

val string_of_proc : Parse__.Syntax.proc -> string
val parse : string -> Parse__.Syntax.proc
returns

AST of defshape

val pretty : Parse__.Syntax.proc -> string

pretty printer for a process