{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE DataKinds #-}

module BNFC.Backend.OCaml where

import BNFC.CF
import BNFC.Prelude

import BNFC.Options.GlobalOptions
import BNFC.Options.Target

import BNFC.Backend.CommonInterface.Backend

import Control.Monad.Except
import Control.Monad.State

import Options.Applicative

instance Backend 'TargetOCaml where
  type BackendOptions 'TargetOCaml = OcamlBackendOptions
  type BackendState 'TargetOCaml = OcamlBackendState
  parseOpts      :: Parser OcamlBackendOptions
  parseOpts :: Parser OcamlBackendOptions
parseOpts      = Parser OcamlBackendOptions
forall a. HasCallStack => a
undefined
  initState      :: LBNF ->GlobalOptions -> BackendOptions 'TargetOCaml -> Except String (BackendState 'TargetOCaml)
  initState :: LBNF
-> GlobalOptions
-> BackendOptions 'TargetOCaml
-> Except String (BackendState 'TargetOCaml)
initState      = LBNF
-> GlobalOptions
-> BackendOptions 'TargetOCaml
-> Except String (BackendState 'TargetOCaml)
forall a. HasCallStack => a
undefined
  abstractSyntax :: LBNF -> State (BackendState 'TargetOCaml) Result
  abstractSyntax :: LBNF -> State (BackendState 'TargetOCaml) Result
abstractSyntax = LBNF -> State (BackendState 'TargetOCaml) Result
forall a. HasCallStack => a
undefined
  printer        :: LBNF -> State (BackendState 'TargetOCaml) Result
  printer :: LBNF -> State (BackendState 'TargetOCaml) Result
printer        = LBNF -> State (BackendState 'TargetOCaml) Result
forall a. HasCallStack => a
undefined
  lexer          :: LBNF -> State (BackendState 'TargetOCaml) Result
  lexer :: LBNF -> State (BackendState 'TargetOCaml) Result
lexer          = LBNF -> State (BackendState 'TargetOCaml) Result
forall a. HasCallStack => a
undefined
  parser         :: LBNF -> State (BackendState 'TargetOCaml) Result
  parser :: LBNF -> State (BackendState 'TargetOCaml) Result
parser         = LBNF -> State (BackendState 'TargetOCaml) Result
forall a. HasCallStack => a
undefined
  parserTest     :: LBNF -> State (BackendState 'TargetOCaml) Result
  parserTest :: LBNF -> State (BackendState 'TargetOCaml) Result
parserTest     = LBNF -> State (BackendState 'TargetOCaml) Result
forall a. HasCallStack => a
undefined
  makefile       :: LBNF -> State (BackendState 'TargetOCaml) Result
  makefile :: LBNF -> State (BackendState 'TargetOCaml) Result
makefile       = LBNF -> State (BackendState 'TargetOCaml) Result
forall a. HasCallStack => a
undefined

newtype OcamlBackendOptions = OcamlOpts Bool

ocamlOptionsParser :: Parser OcamlBackendOptions
ocamlOptionsParser :: Parser OcamlBackendOptions
ocamlOptionsParser = Bool -> OcamlBackendOptions
OcamlOpts (Bool -> OcamlBackendOptions)
-> Parser Bool -> Parser OcamlBackendOptions
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Parser Bool
oMenhir
  where

    -- menhir option
    oMenhir :: Parser Bool
oMenhir =
      Mod FlagFields Bool -> Parser Bool
switch
        ( String -> Mod FlagFields Bool
forall (f :: * -> *) a. HasName f => String -> Mod f a
long String
"menhir"
       Mod FlagFields Bool -> Mod FlagFields Bool -> Mod FlagFields Bool
forall a. Semigroup a => a -> a -> a
<> String -> Mod FlagFields Bool
forall (f :: * -> *) a. String -> Mod f a
help String
"Output OCaml code for use with ocamllex and menhir"
        )

data OcamlBackendState