-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement more of
Spec.t
initialization
Reduction initialization still isn't implemented, nor any reporting besides `prec`.
- Loading branch information
Jason Evans
committed
Mar 29, 2022
1 parent
3c0401f
commit 45b0097
Showing
17 changed files
with
578 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,22 @@ | ||
open Basis | ||
open Basis.Rudiments | ||
|
||
type type_ = { | ||
module_: string; | ||
type_: string; | ||
} | ||
|
||
type t = { | ||
index: uns; | ||
name: string; | ||
start: bool; | ||
type_: type_ option; | ||
prec: Prec.t option; | ||
prods: (Prod.t, Prod.cmper_witness) Ordset.t; | ||
stmt: Parse.nonterm; | ||
} | ||
|
||
include IdentifiableIntf.S with type t := t | ||
|
||
val init: index:uns -> name:string -> start:bool -> prec:Prec.t option | ||
-> prods:(Prod.t, Prod.cmper_witness) Ordset.t -> t | ||
val init: index:uns -> name:string -> start:bool -> type_:type_ option -> prec:Prec.t option | ||
-> prods:(Prod.t, Prod.cmper_witness) Ordset.t -> stmt:Parse.nonterm -> t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
open Basis | ||
open Basis.Rudiments | ||
|
||
module T = struct | ||
type type_ = { | ||
module_: string; | ||
type_: string; | ||
} | ||
|
||
type param = { | ||
name: string option; | ||
type_: type_; | ||
} | ||
|
||
type t = { | ||
index: uns; | ||
lhs: type_; | ||
rhs: param array; | ||
code: Parse.code option; | ||
} | ||
|
||
let hash_fold {index; _} state = | ||
Uns.hash_fold index state | ||
|
||
let cmp {index=index0; _} {index=index1; _} = | ||
Uns.cmp index0 index1 | ||
|
||
let pp_type {module_; type_} formatter = | ||
formatter | ||
|> Fmt.fmt "{module_=" |> String.pp module_ | ||
|> Fmt.fmt "; type_=" |> String.pp type_ | ||
|> Fmt.fmt "}" | ||
|
||
let pp_param {name; type_} formatter = | ||
formatter | ||
|> Fmt.fmt "{name=" |> (Option.pp String.pp) name | ||
|> Fmt.fmt "; type_=" |> pp_type type_ | ||
|> Fmt.fmt "}" | ||
|
||
let pp {index; lhs; rhs; code} formatter = | ||
formatter | ||
|> Fmt.fmt "{index=" |> Uns.pp index | ||
|> Fmt.fmt "; lhs=" |> pp_type lhs | ||
|> Fmt.fmt "; rhs=" |> (Array.pp pp_param) rhs | ||
|> Fmt.fmt "; code=" |> (Option.pp Parse.fmt_code) code | ||
|> Fmt.fmt "}" | ||
end | ||
include T | ||
include Identifiable.Make(T) | ||
|
||
let init ~index ~lhs ~rhs ~code = | ||
{index; lhs; rhs; code} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
open Basis | ||
open Basis.Rudiments | ||
|
||
type type_ = { | ||
module_: string; | ||
type_: string; | ||
} | ||
|
||
type param = { | ||
name: string option; | ||
type_: type_; | ||
} | ||
|
||
type t = { | ||
index: uns; | ||
lhs: type_; | ||
rhs: param array; | ||
code: Parse.code option; | ||
} | ||
|
||
include IdentifiableIntf.S with type t := t | ||
|
||
val init: index:uns -> lhs:type_ -> rhs:param array -> code:Parse.code option -> t |
Oops, something went wrong.