-- |
-- Module      : Lfr
-- Description : Lambda Free Representation.
module Transformations.Ll.Lfr where

import Trees.Common

data Program = Program [GlobalDeclaration] IdCnt
  deriving (Int -> Program -> ShowS
[Program] -> ShowS
Program -> String
(Int -> Program -> ShowS)
-> (Program -> String) -> ([Program] -> ShowS) -> Show Program
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Program -> ShowS
showsPrec :: Int -> Program -> ShowS
$cshow :: Program -> String
show :: Program -> String
$cshowList :: [Program] -> ShowS
showList :: [Program] -> ShowS
Show, Program -> Program -> Bool
(Program -> Program -> Bool)
-> (Program -> Program -> Bool) -> Eq Program
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Program -> Program -> Bool
== :: Program -> Program -> Bool
$c/= :: Program -> Program -> Bool
/= :: Program -> Program -> Bool
Eq)

data GlobalDeclaration
  = GlobVarDecl VarDeclaration
  | GlobFunDecl Identifier' [Identifier'] Expression
  deriving (Int -> GlobalDeclaration -> ShowS
[GlobalDeclaration] -> ShowS
GlobalDeclaration -> String
(Int -> GlobalDeclaration -> ShowS)
-> (GlobalDeclaration -> String)
-> ([GlobalDeclaration] -> ShowS)
-> Show GlobalDeclaration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GlobalDeclaration -> ShowS
showsPrec :: Int -> GlobalDeclaration -> ShowS
$cshow :: GlobalDeclaration -> String
show :: GlobalDeclaration -> String
$cshowList :: [GlobalDeclaration] -> ShowS
showList :: [GlobalDeclaration] -> ShowS
Show, GlobalDeclaration -> GlobalDeclaration -> Bool
(GlobalDeclaration -> GlobalDeclaration -> Bool)
-> (GlobalDeclaration -> GlobalDeclaration -> Bool)
-> Eq GlobalDeclaration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GlobalDeclaration -> GlobalDeclaration -> Bool
== :: GlobalDeclaration -> GlobalDeclaration -> Bool
$c/= :: GlobalDeclaration -> GlobalDeclaration -> Bool
/= :: GlobalDeclaration -> GlobalDeclaration -> Bool
Eq)

data VarDeclaration = VarDecl Identifier' Expression
  deriving (Int -> VarDeclaration -> ShowS
[VarDeclaration] -> ShowS
VarDeclaration -> String
(Int -> VarDeclaration -> ShowS)
-> (VarDeclaration -> String)
-> ([VarDeclaration] -> ShowS)
-> Show VarDeclaration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> VarDeclaration -> ShowS
showsPrec :: Int -> VarDeclaration -> ShowS
$cshow :: VarDeclaration -> String
show :: VarDeclaration -> String
$cshowList :: [VarDeclaration] -> ShowS
showList :: [VarDeclaration] -> ShowS
Show, VarDeclaration -> VarDeclaration -> Bool
(VarDeclaration -> VarDeclaration -> Bool)
-> (VarDeclaration -> VarDeclaration -> Bool) -> Eq VarDeclaration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: VarDeclaration -> VarDeclaration -> Bool
== :: VarDeclaration -> VarDeclaration -> Bool
$c/= :: VarDeclaration -> VarDeclaration -> Bool
/= :: VarDeclaration -> VarDeclaration -> Bool
Eq)

data Expression
  = ExprId Identifier'
  | ExprPrimVal PrimitiveValue
  | ExprBinOp BinaryOperator Expression Expression
  | ExprUnOp UnaryOperator Expression
  | ExprApp Expression Expression
  | ExprIte Expression Expression Expression
  | ExprLetIn VarDeclaration Expression
  deriving (Int -> Expression -> ShowS
[Expression] -> ShowS
Expression -> String
(Int -> Expression -> ShowS)
-> (Expression -> String)
-> ([Expression] -> ShowS)
-> Show Expression
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Expression -> ShowS
showsPrec :: Int -> Expression -> ShowS
$cshow :: Expression -> String
show :: Expression -> String
$cshowList :: [Expression] -> ShowS
showList :: [Expression] -> ShowS
Show, Expression -> Expression -> Bool
(Expression -> Expression -> Bool)
-> (Expression -> Expression -> Bool) -> Eq Expression
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Expression -> Expression -> Bool
== :: Expression -> Expression -> Bool
$c/= :: Expression -> Expression -> Bool
/= :: Expression -> Expression -> Bool
Eq)