diff --git a/bootstrap/src/hmc/Grammar.hmh b/bootstrap/src/hmc/Grammar.hmh new file mode 100644 index 00000000..81ad14a7 --- /dev/null +++ b/bootstrap/src/hmc/Grammar.hmh @@ -0,0 +1,9 @@ +open Basis +open! Basis.Rudiments + +type token_and = {source: Source.Slice.t} + +include hocc + token AND "and" of token_and + + start S ::= epsilon diff --git a/bootstrap/src/hmc/Grammar.hmhi b/bootstrap/src/hmc/Grammar.hmhi new file mode 100644 index 00000000..69a2c110 --- /dev/null +++ b/bootstrap/src/hmc/Grammar.hmhi @@ -0,0 +1,6 @@ +open Basis +open! Basis.Rudiments + +type token_and = {source: Source.Slice.t} + +include hocc diff --git a/bootstrap/src/hmc/dune b/bootstrap/src/hmc/dune index dd23e576..e3002e93 100644 --- a/bootstrap/src/hmc/dune +++ b/bootstrap/src/hmc/dune @@ -4,3 +4,13 @@ (libraries Basis) (synopsis "Hemlock bootstrap compiler library") ) + +; This rule calls an out-of-tree `hocc`, because the in-tree one depends on `Hmc`. +(rule + (deps + (glob_files Grammar.hmh*)) + (targets Grammar.mli Grammar.ml) + (action + (with-accepted-exit-codes + (or 0 1) + (system "hocc -v -a ielr1 -ml -s Grammar"))))