From ac3fba64cae9d130297c116f316510cfbda104d4 Mon Sep 17 00:00:00 2001 From: Jason Evans Date: Sun, 29 Sep 2024 08:28:43 -0700 Subject: [PATCH] Start work on `Hmc.Grammar` --- bootstrap/src/hmc/Grammar.hmh | 9 +++++++++ bootstrap/src/hmc/Grammar.hmhi | 6 ++++++ bootstrap/src/hmc/dune | 10 ++++++++++ 3 files changed, 25 insertions(+) create mode 100644 bootstrap/src/hmc/Grammar.hmh create mode 100644 bootstrap/src/hmc/Grammar.hmhi diff --git a/bootstrap/src/hmc/Grammar.hmh b/bootstrap/src/hmc/Grammar.hmh new file mode 100644 index 000000000..81ad14a74 --- /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 000000000..69a2c1105 --- /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 dd23e5768..e3002e93c 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"))))