From 4f86d0b68cb2e1e509d6b22e9ab24fde2505a983 Mon Sep 17 00:00:00 2001 From: Xavier Mitault Date: Sat, 6 Jan 2024 22:37:26 +0100 Subject: [PATCH 1/4] Add start implementation --- lvtc/lvtc.cabal | 1 + lvtc/src/WatLike.hs | 114 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 115 insertions(+) create mode 100644 lvtc/src/WatLike.hs diff --git a/lvtc/lvtc.cabal b/lvtc/lvtc.cabal index 04ee4ee..2255193 100644 --- a/lvtc/lvtc.cabal +++ b/lvtc/lvtc.cabal @@ -33,6 +33,7 @@ library Parser ParseUtil ShuntingYard + WatLike other-modules: Paths_lvtc autogen-modules: diff --git a/lvtc/src/WatLike.hs b/lvtc/src/WatLike.hs new file mode 100644 index 0000000..06317f1 --- /dev/null +++ b/lvtc/src/WatLike.hs @@ -0,0 +1,114 @@ +{- +-- EPITECH PROJECT, 2023 +-- Leviator compiler +-- File description: +-- WatLike +-} + +module WatLike +( + +) where + +import AST + +data WatLikeState = WLS [(Int, String)] [(Int, String)] [Instruction] [Instruction] + +instance Eq WatLikeState where + (==) (WLS y z) (WLS y' z') = y == y' && z == z' + +instance Show WatLikeState where + show (WLS y z) = "WLS[< " ++ show y ++ " >< " ++ show z ++ " >]" + +getRegisterIndex' :: Int -> String -> [(Int, String)] -> [(Int, String), Int] +getRegisterIndex' maxInd var [] = ([(maxInd, var)], maxInd) +getRegisterIndex' maxInd var (x:xs) + | var == snd x = ((x:xs), fst x) + | maxInd > fst x = getRegisterIndex' (maxInd) var xs + | otherwise = getRegisterIndex' ((fst x) + 1) var xs + +getRegisterIndex :: String -> [(Int, String)] -> ([(Int, String)], Int) +getRegisterIndex var indexes = getRegisterIndex' 0 var indexes + +getIndex :: String -> [(Int, String)] -> Maybe Int +getIndex var [] = Nothing +getIndex var (x:xs) + | var == snd x = Just (fst x) + | otherwise = getIndex var xs + +registerAllFuncs :: [FuncDeclaration] -> [(Int, String)] -> [(Int, String)] +registerAllFuncs [] indexes = indexes +registerAllFuncs (((fName, _, _), _):xs) indexes = + registerAllFuncs xs indexes' + where + (indexes', _) = getRegisterIndex fName indexes + +registerAllVars :: [Instruction] -> [(Int, String)] -> [(Int, String)] +registerAllVars [] indexes = indexes +registerAllVars ((Declaration ((vName, _), _)):xs) indexes = + registerAllVars xs indexes' + where + (indexes', _) = getRegisterIndex vName indexes + +------------------------------------------------------------------------------ + +-- TODO: take a value, and split in multiple instruction to get the final value +-- return the final value under the form (Var ind) with the variable to where +-- the value will be +-- TODO: use the pattern matching of InstructionToWatLike +ValueToWatLike :: Value -> WatLikeState -> (WatLikeState, [Instruction], Value) +ValueToWatLike + +-- TODO: remove pattern matching for the value part and call ValueToWatLike +InstructionToWatLike :: Instruction -> WatLikeState -> (WatLikeState, [Instruction]) +InstructionToWatLike + (Declaration ((vName, vTyp), FuncValue x)) + (WLS varsIndex funcsIndex oldFunc newFunc) = +InstructionToWatLike + (Assignation (vName, FuncValue x)) + (WLS varsIndex funcsIndex oldFunc newFunc) = +InstructionToWatLike + (Function x) + (WLS varsIndex funcsIndex oldFunc newFunc) = +InstructionToWatLike + (Return (FuncValue x)) + (WLS varsIndex funcsIndex oldFunc newFunc) = +InstructionToWatLike + (Cond ()) + + +FuncToWatLike' :: FuncDeclaration -> WatLikeState -> (WatLikeState, FuncDeclaration) +FuncToWatLike' ((fName, fParams, fRet), []) wls = (wls, ((fName, fParams, fRet), [])) +FuncToWatLike' ((fName, fParams, fRet), (x:xs)) + (WLS varsIndex funcsIndex oldFunc newFunc) = + +FuncToWatLike :: FuncDeclaration -> WatLikeState -> WatLikeState +FuncToWatLike ((fName, fParams, fRet), fInss) + (WLS varsIndex funcsIndex oldFunc newFunc) = + WLS varsIndex funcsIndex oldFunc newFunc' + where + varsIndex' = registerAllVars fInss varsIndex + (WLS _ _ _ newFunc') = + FuncToWatLike' + ((fName, fParams, fRet), fInss) + (WLS varsIndex' funcsIndex oldFunc newFunc) + +------------------------------------------------------------------------------ + +ASTToWatLike' :: [FuncDeclaration] -> WatLikeState -> WatLikeState +ASTToWatLike' [] (WLS varsIndex funcsIndex oldFunc newFunc) = WLS varsIndex funcsIndex oldFunc newFunc +ASTToWatLike' (((fName, fParams, fRet), fInss):xs) + (WLS varsIndex funcsIndex oldFunc newFunc) = + ASTToWatLike' xs (WLS varsIndex funcsIndex'' oldFunc newFunc') + where + (funcsIndex', indFunc) = getRegisterIndex fName funcsIndex + (WLS _ funcsIndex'' _ newFunc') = + FuncToWatLike + ((show indFunc, fParams, fRet), fInss) + (WLS varsIndex funcsIndex' oldFunc newFunc) + +ASTToWatLike :: [FuncDeclaration] -> [FuncDeclaration] +ASTToWatLike funcs = newFunc + where + funcsIndex = registerAllFuncs funcs [] + (WLS _ _ _ newFunc) = ASTToWatLike' funcs (WLS [] funcsIndex funcs []) From 9cc4bc6841fa1717431755c3946e6dff0a635ad9 Mon Sep 17 00:00:00 2001 From: Xavier Mitault Date: Sun, 7 Jan 2024 22:19:58 +0100 Subject: [PATCH 2/4] Add first part of watlike --- lvtc/app/Main.hs | 12 ++ lvtc/lvtc.cabal | 2 + lvtc/src/Builtins.hs | 22 +++ lvtc/src/WatLike.hs | 333 +++++++++++++++++++++++++++++++---------- lvtc/test/Spec.hs | 4 +- lvtc/test/UTWatLike.hs | 120 +++++++++++++++ 6 files changed, 411 insertions(+), 82 deletions(-) create mode 100644 lvtc/src/Builtins.hs create mode 100644 lvtc/test/UTWatLike.hs diff --git a/lvtc/app/Main.hs b/lvtc/app/Main.hs index 13e878a..6f98a16 100644 --- a/lvtc/app/Main.hs +++ b/lvtc/app/Main.hs @@ -11,6 +11,8 @@ import Expression (parseExpresion, parseAllExpression) import Parser (runParser) import Alias (proceedAlias) import ParseLvt (parseInstruction, parseInstructions) +import WatLike (aSTToWatLike) +import AST test1 :: String test1 = "if (a)\n{\nb(0);\n};\n" @@ -40,6 +42,15 @@ text = aliasInt ++ aliasRetValue ++ funcMain aliasRetValue = "alias retValue 0;\n" funcMain = "fn main () -> int \n{\n <- retValue;\n};\n" +test7 :: [FuncDeclaration] +test7 = + [ + ( + ("add", [("a", "Int"), ("b", "Int")], "Int"), + [Return (FuncValue ("+", [Var "a", Var "b"]))] + ) + ] + main :: IO () main = print (runParser parseInstruction test1) @@ -49,3 +60,4 @@ main = >> print (runParser parseInstruction test5) >> print (runParser parseInstruction test6) >> print (runParser (proceedAlias <$> parseAllExpression) text) + >> print (aSTToWatLike test7) diff --git a/lvtc/lvtc.cabal b/lvtc/lvtc.cabal index 2255193..c2f388d 100644 --- a/lvtc/lvtc.cabal +++ b/lvtc/lvtc.cabal @@ -27,6 +27,7 @@ library exposed-modules: Alias AST + Builtins Expression Lib ParseLvt @@ -65,6 +66,7 @@ test-suite lvtc-test other-modules: UTParseLvt UTShuntingYard + UTWatLike Paths_lvtc autogen-modules: Paths_lvtc diff --git a/lvtc/src/Builtins.hs b/lvtc/src/Builtins.hs new file mode 100644 index 0000000..3508b42 --- /dev/null +++ b/lvtc/src/Builtins.hs @@ -0,0 +1,22 @@ +{- +-- EPITECH PROJECT, 2023 +-- Leviator compiler +-- File description: +-- WatLike +-} + +module Builtins +( + getBuiltinsFunc +) where + +import AST + +getBuiltinsFunc :: [FuncDeclaration] +getBuiltinsFunc = + [ + (("+", [("x", "Int"), ("y", "Int")], "Int"), []), + (("-", [("x", "Int"), ("y", "Int")], "Int"), []), + (("*", [("x", "Int"), ("y", "Int")], "Int"), []), + (("/", [("x", "Int"), ("y", "Int")], "Int"), []) + ] diff --git a/lvtc/src/WatLike.hs b/lvtc/src/WatLike.hs index 06317f1..8fe64ec 100644 --- a/lvtc/src/WatLike.hs +++ b/lvtc/src/WatLike.hs @@ -7,108 +7,279 @@ module WatLike ( - + FuncDeclare + , Index + , aSTToWatLike ) where import AST +import Builtins -data WatLikeState = WLS [(Int, String)] [(Int, String)] [Instruction] [Instruction] +import Data.Int (Int32) +import Data.Char (ord) -instance Eq WatLikeState where - (==) (WLS y z) (WLS y' z') = y == y' && z == z' +------------------------------------------------------------------------------ +-- Named Index Vars / Func -instance Show WatLikeState where - show (WLS y z) = "WLS[< " ++ show y ++ " >< " ++ show z ++ " >]" +type Index = (Int, String) +type FuncDeclare = (FuncDeclaration, [Index]) -getRegisterIndex' :: Int -> String -> [(Int, String)] -> [(Int, String), Int] +getRegisterIndex' :: Int -> String -> [Index] -> ([Index], Int) getRegisterIndex' maxInd var [] = ([(maxInd, var)], maxInd) getRegisterIndex' maxInd var (x:xs) - | var == snd x = ((x:xs), fst x) - | maxInd > fst x = getRegisterIndex' (maxInd) var xs - | otherwise = getRegisterIndex' ((fst x) + 1) var xs + | var == snd x = (x:xs, fst x) + | maxInd > fst x = (x : inds, ind) + | otherwise = (x : inds', ind') + where + (inds, ind) = getRegisterIndex' maxInd var xs + (inds', ind') = getRegisterIndex' (fst x + 1) var xs + +getRegisterIndex :: String -> [Index] -> ([Index], Int) +getRegisterIndex = getRegisterIndex' 0 -getRegisterIndex :: String -> [(Int, String)] -> ([(Int, String)], Int) -getRegisterIndex var indexes = getRegisterIndex' 0 var indexes +newIndex' :: Int -> [Index] -> ([Index], Int) +newIndex' maxInd [] = ([(maxInd, "_tmpValue")], maxInd) +newIndex' maxInd (x:xs) + | maxInd > fst x = (x : inds, ind) + | otherwise = (x : inds', ind') + where + (inds, ind) = newIndex' maxInd xs + (inds', ind') = newIndex' (fst x + 1) xs -getIndex :: String -> [(Int, String)] -> Maybe Int -getIndex var [] = Nothing -getIndex var (x:xs) - | var == snd x = Just (fst x) - | otherwise = getIndex var xs +newIndex :: [Index] -> ([Index], Int) +newIndex = newIndex' 0 -registerAllFuncs :: [FuncDeclaration] -> [(Int, String)] -> [(Int, String)] -registerAllFuncs [] indexes = indexes -registerAllFuncs (((fName, _, _), _):xs) indexes = - registerAllFuncs xs indexes' +modifyAllValue :: [Value] -> [Index] -> [Index] -> ([Value], [Index], [Index]) +modifyAllValue [] varsIndex funcsIndex = ([], varsIndex, funcsIndex) +modifyAllValue (x:xs) varsIndex funcsIndex = (val:vals, varsIndex'', funcsIndex'') where - (indexes', _) = getRegisterIndex fName indexes + (val, varsIndex', funcsIndex') = modifyAll' x varsIndex funcsIndex + (vals, varsIndex'', funcsIndex'') = modifyAllValue xs varsIndex' funcsIndex' -registerAllVars :: [Instruction] -> [(Int, String)] -> [(Int, String)] -registerAllVars [] indexes = indexes -registerAllVars ((Declaration ((vName, _), _)):xs) indexes = - registerAllVars xs indexes' +modifyAll' :: Value -> [Index] -> [Index] -> (Value, [Index], [Index]) +modifyAll' (FuncValue (fName, vals)) varsIndex funcsIndex = (newFunc, varsIndex'', funcsIndex'') where - (indexes', _) = getRegisterIndex vName indexes + (funcsIndex', indFunc) = getRegisterIndex fName funcsIndex + (vals', varsIndex'', funcsIndex'') = modifyAllValue vals varsIndex funcsIndex' + newFunc = FuncValue (show indFunc, vals') +modifyAll' (Var vName) varsIndex funcsIndex = (newVar, varsIndex', funcsIndex) + where + (varsIndex', indVar) = getRegisterIndex vName varsIndex + newVar = Var (show indVar) +modifyAll' x varsIndex funcsIndex = (x, varsIndex, funcsIndex) + +modifyAll :: [Instruction] -> [Index] -> [Index] -> ([Instruction], [Index], [Index]) +modifyAll [] varsIndex funcsIndex = ([], varsIndex, funcsIndex) +modifyAll ((Function (fName, vals)):xs) varsIndex funcsIndex = + (newFunc:ins', varsIndex''', funcsIndex''') + where + (funcsIndex', indFunc) = getRegisterIndex fName funcsIndex + (vals', varsIndex'', funcsIndex'') = modifyAllValue vals varsIndex funcsIndex' + newFunc = Function (show indFunc, vals') + (ins', varsIndex''', funcsIndex''') = modifyAll xs varsIndex'' funcsIndex'' +modifyAll ((Return vValue):xs) varsIndex funcsIndex = + (newReturn:ins', varsIndex'', funcsIndex'') + where + (vValue', varsIndex', funcsIndex') =modifyAll' vValue varsIndex funcsIndex + newReturn = Return vValue' + (ins', varsIndex'', funcsIndex'') = modifyAll xs varsIndex' funcsIndex' +modifyAll ((Declaration ((vName, vTyp), vValue)):xs) varsIndex funcsIndex = + (newDeclaration : ins', varsIndex'', funcsIndex'') + where + (varsIndex', ind) = getRegisterIndex vName varsIndex + newDeclaration = Declaration ((show ind, vTyp), vValue) + (ins', varsIndex'', funcsIndex'') = modifyAll xs varsIndex' funcsIndex +modifyAll ((Assignation (vName, vValue)):xs) varsIndex funcsIndex = + (newAssignation:ins', varsIndex''', funcsIndex''') + where + (varsIndex', ind) = getRegisterIndex vName varsIndex + (vValue', varsIndex'', funcsIndex'') = modifyAll' vValue varsIndex' funcsIndex + newAssignation = Assignation (show ind, vValue') + (ins', varsIndex''', funcsIndex''') = modifyAll xs varsIndex'' funcsIndex'' +modifyAll ((Cond (vValue, insIf, insElse)):xs) varsIndex funcsIndex = + (newCond:ins', varsIndex'''', funcsIndex'''') + where + (vValue', varsIndex', funcsIndex') = modifyAll' vValue varsIndex funcsIndex + (insIf', varsIndex'', funcsIndex'') = modifyAll insIf varsIndex' funcsIndex' + (insElse', varsIndex''', funcsIndex''') = modifyAll insElse varsIndex'' funcsIndex'' + newCond = Cond (vValue', insIf', insElse') + (ins', varsIndex'''', funcsIndex'''') = modifyAll xs varsIndex''' funcsIndex''' + +transformType :: Type -> Type +transformType "Void" = "Int" +transformType "Char" = "Int" +transformType "Bool" = "Int" +transformType x = x + +registerParams :: FuncDeclare -> FuncDeclare +registerParams (((fName, [], typ), ins), varsIndex) = + (((fName, [], transformType typ), ins), varsIndex) +registerParams (((fName, (pName, pTyp):vParams, typ), ins), varsIndex) = + (((fName', (show indVar, transformType pTyp):vParams', vTyp'), ins), varsIndex'') + where + (varsIndex', indVar) = getRegisterIndex pName varsIndex + (((fName', vParams', vTyp'), _), varsIndex'') = registerParams (((fName, vParams, typ), ins), varsIndex') + +registerAllFuncs :: [FuncDeclaration] -> [Index] -> [Index] +registerAllFuncs [] funcsIndex = funcsIndex +registerAllFuncs (((fName, _, _), _):xs) funcsIndex = funcsIndex'' + where + (funcsIndex', _) = getRegisterIndex fName funcsIndex + funcsIndex'' = registerAllFuncs xs funcsIndex' + +changeIndexes :: [FuncDeclaration] -> [Index] -> ([FuncDeclare], [Index]) +changeIndexes [] funcsIndex = ([], funcsIndex) +changeIndexes (((fName, vars, typ), ins):xs) funcsIndex = + (newFunc:funcs, funcsIndex''') + where + (funcsIndex', indFunc) = getRegisterIndex fName funcsIndex + (((_, vars', typ'), ins'), varsIndex) = registerParams (((fName, vars, typ), ins), []) + (ins'', varsIndex'', funcsIndex'') = modifyAll ins' varsIndex funcsIndex' + newFunc = (((show indFunc, vars', typ'), ins''), varsIndex'') + (funcs, funcsIndex''') = changeIndexes xs funcsIndex'' ------------------------------------------------------------------------------ --- TODO: take a value, and split in multiple instruction to get the final value --- return the final value under the form (Var ind) with the variable to where --- the value will be --- TODO: use the pattern matching of InstructionToWatLike -ValueToWatLike :: Value -> WatLikeState -> (WatLikeState, [Instruction], Value) -ValueToWatLike - --- TODO: remove pattern matching for the value part and call ValueToWatLike -InstructionToWatLike :: Instruction -> WatLikeState -> (WatLikeState, [Instruction]) -InstructionToWatLike - (Declaration ((vName, vTyp), FuncValue x)) - (WLS varsIndex funcsIndex oldFunc newFunc) = -InstructionToWatLike - (Assignation (vName, FuncValue x)) - (WLS varsIndex funcsIndex oldFunc newFunc) = -InstructionToWatLike - (Function x) - (WLS varsIndex funcsIndex oldFunc newFunc) = -InstructionToWatLike - (Return (FuncValue x)) - (WLS varsIndex funcsIndex oldFunc newFunc) = -InstructionToWatLike - (Cond ()) - - -FuncToWatLike' :: FuncDeclaration -> WatLikeState -> (WatLikeState, FuncDeclaration) -FuncToWatLike' ((fName, fParams, fRet), []) wls = (wls, ((fName, fParams, fRet), [])) -FuncToWatLike' ((fName, fParams, fRet), (x:xs)) - (WLS varsIndex funcsIndex oldFunc newFunc) = - -FuncToWatLike :: FuncDeclaration -> WatLikeState -> WatLikeState -FuncToWatLike ((fName, fParams, fRet), fInss) - (WLS varsIndex funcsIndex oldFunc newFunc) = - WLS varsIndex funcsIndex oldFunc newFunc' - where - varsIndex' = registerAllVars fInss varsIndex - (WLS _ _ _ newFunc') = - FuncToWatLike' - ((fName, fParams, fRet), fInss) - (WLS varsIndex' funcsIndex oldFunc newFunc) +data WatLikeState = WLS [Index] [FuncDeclare] [FuncDeclare] + +instance Eq WatLikeState where + (==) (WLS x y z) (WLS x' y' z') = x == x' && y == y' && z == z' + +instance Show WatLikeState where + show (WLS x y z) = "WLS[[ " ++ show x ++ " ][ " ++ show y ++ " ][ " ++ show z ++ " ]]" ------------------------------------------------------------------------------ -ASTToWatLike' :: [FuncDeclaration] -> WatLikeState -> WatLikeState -ASTToWatLike' [] (WLS varsIndex funcsIndex oldFunc newFunc) = WLS varsIndex funcsIndex oldFunc newFunc -ASTToWatLike' (((fName, fParams, fRet), fInss):xs) - (WLS varsIndex funcsIndex oldFunc newFunc) = - ASTToWatLike' xs (WLS varsIndex funcsIndex'' oldFunc newFunc') +getPrototype :: String -> [FuncDeclare] -> FuncPrototype +getPrototype _ [] = undefined +getPrototype fName ((((fName', vars, typ), _), _):xs) + | fName == fName' = (fName', vars, typ) + | otherwise = getPrototype fName xs + +------------------------------------------------------------------------------ + +funcCallToWatLike :: FuncCall -> ([FuncDeclare], [Index]) -> [Index] -> ([Index], [Instruction], FuncCall) +funcCallToWatLike (fName, []) _ varsIndex = (varsIndex, [], (fName, [])) +funcCallToWatLike (fName, vVal:vVals) oldFuncs varsIndex = + (varsIndex'', ins ++ inss, (fName, vVal':vVals')) where - (funcsIndex', indFunc) = getRegisterIndex fName funcsIndex - (WLS _ funcsIndex'' _ newFunc') = - FuncToWatLike - ((show indFunc, fParams, fRet), fInss) - (WLS varsIndex funcsIndex' oldFunc newFunc) + (varsIndex', ins, vVal') = valueToWatLike vVal oldFuncs varsIndex + (varsIndex'', inss, (_, vVals')) = funcCallToWatLike (fName, vVals) oldFuncs varsIndex' + +valueToWatLike :: Value -> ([FuncDeclare], [Index]) -> [Index] -> ([Index], [Instruction], Value) +valueToWatLike (FuncValue x) (oldFuncs, funcsIndex) varsIndex = + (varsIndex'', ins ++ [newDeclaration], Var (show indVar)) + where + (varsIndex', ins, (fName, vVals)) = funcCallToWatLike x (oldFuncs, funcsIndex) varsIndex + (varsIndex'', indVar) = newIndex varsIndex' + (_, _, typ) = getPrototype fName oldFuncs + newDeclaration = Declaration ((show indVar, typ), FuncValue (fName, vVals)) +valueToWatLike (Boolean True) _ varsIndex = + (varsIndex', [newDeclaration], Var (show indVar)) + where + (varsIndex', indVar) = newIndex varsIndex + newDeclaration = Declaration ((show indVar, "Int"), Integer 1) +valueToWatLike (Boolean False) _ varsIndex = + (varsIndex', [newDeclaration], Var (show indVar)) + where + (varsIndex', indVar) = newIndex varsIndex + newDeclaration = Declaration ((show indVar, "Int"), Integer 0) +valueToWatLike (Character x) _ varsIndex = + (varsIndex', [newDeclaration], Var (show indVar)) + where + (varsIndex', indVar) = newIndex varsIndex + newDeclaration = Declaration ((show indVar, "Int"), Integer (read (show (ord x)) :: Int32)) +valueToWatLike (StringView _) _ _ = undefined +valueToWatLike Void _ varsIndex = + (varsIndex', [newDeclaration], Var (show indVar)) + where + (varsIndex', indVar) = newIndex varsIndex + newDeclaration = Declaration ((show indVar, "Int"), Integer 0) +valueToWatLike (Integer x) _ varsIndex = + (varsIndex', [newDeclaration], Var (show indVar)) + where + (varsIndex', indVar) = newIndex varsIndex + newDeclaration = Declaration ((show indVar, "Int"), Integer x) +valueToWatLike (Var x) _ varsIndex = (varsIndex, [], Var x) + +instructionToWatLike :: Instruction -> ([FuncDeclare], [Index]) -> [Index] -> ([Index], [Instruction]) +instructionToWatLike + (Declaration ((vName, vTyp), vValue)) oldFuncs varsIndex = + (varsIndex', ins' ++ [newDeclaration]) + where + (varsIndex', ins', vValue') = valueToWatLike vValue oldFuncs varsIndex + newDeclaration = Declaration ((vName, vTyp), vValue') +instructionToWatLike + (Assignation (vName, vValue)) oldFuncs varsIndex = + (varsIndex', ins' ++ [newAssignation]) + where + (varsIndex', ins', vValue') = valueToWatLike vValue oldFuncs varsIndex + newAssignation = Assignation (vName, vValue') +instructionToWatLike + (Function (fName, fParams)) oldFuncs varsIndex = + (varsIndex', ins' ++ [newFunction]) + where + (varsIndex', ins', (_, fParams')) = funcCallToWatLike (fName, fParams) oldFuncs varsIndex + newFunction = Function (fName, fParams') +instructionToWatLike + (Return vValue) oldFuncs varsIndex = + (varsIndex', ins' ++ [newReturn]) + where + (varsIndex', ins', vValue') = valueToWatLike vValue oldFuncs varsIndex + newReturn = Return vValue' +instructionToWatLike + (Cond (vValCond, vInsTrue, vInsFalse)) oldFuncs varsIndex = + (varsIndex''', insCond ++ [newCond]) + where + (varsIndex', insCond, vValCond') = valueToWatLike vValCond oldFuncs varsIndex + (varsIndex'', vInsTrue') = instructionsToWatLike vInsTrue oldFuncs varsIndex' + (varsIndex''', vInsFalse') = instructionsToWatLike vInsFalse oldFuncs varsIndex'' + newCond = Cond (vValCond', vInsTrue', vInsFalse') + +instructionsToWatLike :: [Instruction] -> ([FuncDeclare], [Index]) -> [Index] -> ([Index], [Instruction]) +instructionsToWatLike [] _ varsIndex = (varsIndex, []) +instructionsToWatLike (x:xs) oldFuncs varsIndex = + (varsIndex'', ins ++ inss) + where + (varsIndex', ins) = instructionToWatLike x oldFuncs varsIndex + (varsIndex'', inss) = instructionsToWatLike xs oldFuncs varsIndex' + +------------------------------------------------------------------------------ + +funcToWatLike' :: FuncDeclare -> ([FuncDeclare], [Index]) -> FuncDeclare +funcToWatLike' (((fName, fParams, fRet), []), varsIndex) _ = (((fName, fParams, fRet), []), varsIndex) +funcToWatLike' (((fName, fParams, fRet), ins:inss), varsIndex) oldFuncs = + (((fName, fParams, fRet), ins' ++ inss'), varsIndex'') + where + (varsIndex', ins') = instructionToWatLike ins oldFuncs varsIndex + (((_, _, _), inss'), varsIndex'') = funcToWatLike' (((fName, fParams, fRet), inss), varsIndex') oldFuncs + +funcToWatLike :: FuncDeclare -> WatLikeState -> WatLikeState +funcToWatLike (((fName, fParams, fRet), fInss), varsIndex) + (WLS funcsIndex oldFuncs newFunc) = + WLS funcsIndex oldFuncs (newFunc ++ [fFunc]) + where + fFunc = funcToWatLike' + (((fName, fParams, fRet), fInss), varsIndex) + (oldFuncs, funcsIndex) + +------------------------------------------------------------------------------ + +aSTToWatLike' :: [FuncDeclare] -> WatLikeState -> WatLikeState +aSTToWatLike' [] (WLS funcsIndex oldFunc newFunc) = WLS funcsIndex oldFunc newFunc +aSTToWatLike' (func:xs) + (WLS funcsIndex oldFunc newFunc) = + aSTToWatLike' xs (WLS funcsIndex' oldFunc newFunc') + where + (WLS funcsIndex' _ newFunc') = + funcToWatLike + func + (WLS funcsIndex oldFunc newFunc) -ASTToWatLike :: [FuncDeclaration] -> [FuncDeclaration] -ASTToWatLike funcs = newFunc +aSTToWatLike :: [FuncDeclaration] -> [FuncDeclare] +aSTToWatLike funcs = newFunc where - funcsIndex = registerAllFuncs funcs [] - (WLS _ _ _ newFunc) = ASTToWatLike' funcs (WLS [] funcsIndex funcs []) + allFuncs = getBuiltinsFunc ++ funcs + funcsIndex = registerAllFuncs allFuncs [] + (funcs', funcsIndex') = changeIndexes allFuncs funcsIndex + (WLS _ _ newFunc) = aSTToWatLike' funcs' (WLS funcsIndex' funcs' []) diff --git a/lvtc/test/Spec.hs b/lvtc/test/Spec.hs index c0054a1..2693713 100644 --- a/lvtc/test/Spec.hs +++ b/lvtc/test/Spec.hs @@ -14,6 +14,7 @@ import Alias import UTParseLvt import UTShuntingYard +import UTWatLike main :: IO () main = defaultMain tests @@ -25,7 +26,8 @@ tests = testGroup "Leviator Tests - Compiler" utParserExpressions, utParserLvt, utShuntingYard, - utAlias + utAlias, + utWatLike ] testParserHelper :: String -> String -> Expression -> IO () diff --git a/lvtc/test/UTWatLike.hs b/lvtc/test/UTWatLike.hs new file mode 100644 index 0000000..aed5f57 --- /dev/null +++ b/lvtc/test/UTWatLike.hs @@ -0,0 +1,120 @@ +module UTWatLike ( + utWatLike +) where + +import Test.Tasty +import Test.Tasty.HUnit + +import WatLike +import AST + +builtinsWat :: [FuncDeclare] +builtinsWat = + [ + ( + (("0", [("0", "Int"), ("1", "Int")], "Int"), []), + [(0, "x"), (1, "y")] + ), + ( + (("1", [("0", "Int"), ("1", "Int")], "Int"), []), + [(0, "x"), (1, "y")] + ), + ( + (("2", [("0", "Int"), ("1", "Int")], "Int"), []), + [(0, "x"), (1, "y")] + ), + ( + (("3", [("0", "Int"), ("1", "Int")], "Int"), []), + [(0, "x"), (1, "y")] + ) + ] + +utWatLike :: TestTree +utWatLike = testGroup "Wat Like" + [ + testCase "basic" $ + assertEqual "Basic" + basic1_rep + (aSTToWatLike [basic1]) + , testCase "basic basic" $ + assertEqual "Basic Basic" + basic2_rep + (aSTToWatLike basic2) + , testCase "basic basic basic" $ + assertEqual "Basic Basic Basic" + basic3_rep + (aSTToWatLike [basic3]) + ] + where + basic1 = + ( + ("add", [("a", "Int"), ("b", "Int")], "Int"), + [Return (FuncValue ("+", [Var "a", Var "b"]))] + ) + basic1_rep = + builtinsWat ++ [ + ( + ( + ("4", [("0", "Int"), ("1", "Int")], "Int"), + [ + Declaration (("2", "Int"), FuncValue ("0", [Var "0", Var "1"])), + Return (Var "2") + ] + ), + [(0, "a"), (1, "b"), (2, "_tmpValue")] + ) + ] + basic2 = + [ + ( + ("add", [("a", "Int"), ("b", "Int")], "Int"), + [Return (FuncValue ("+", [Var "a", Var "b"]))] + ), + ( + ("start", [], "Int"), + [Return (FuncValue ("add", [Integer 1, Integer 2]))] + ) + ] + basic2_rep = + builtinsWat ++ [ + ( + ( + ("4", [("0", "Int"), ("1", "Int")], "Int"), + [ + Declaration (("2", "Int"), FuncValue ("0", [Var "0", Var "1"])), + Return (Var "2") + ] + ), + [(0, "a"), (1, "b"), (2, "_tmpValue")] + ), + ( + ( + ("5", [], "Int"), + [ + Declaration (("0", "Int"), Integer 1), + Declaration (("1", "Int"), Integer 2), + Declaration (("2", "Int"), FuncValue ("4", [Var "0", Var "1"])), + Return (Var "2") + ] + ), + [(0, "_tmpValue"), (1, "_tmpValue"), (2, "_tmpValue")] + ) + ] + basic3 = + ( + ("getC", [], "Char"), + [Return (Character 'a')] + ) + basic3_rep = + builtinsWat ++ [ + ( + ( + ("4", [], "Int"), + [ + Declaration (("0", "Int"), Integer 97), + Return (Var "0") + ] + ), + [(0, "_tmpValue")] + ) + ] From 55cb491528cdab679a2272c14fb6cb6b4202e370 Mon Sep 17 00:00:00 2001 From: Xavier Mitault Date: Sun, 7 Jan 2024 22:31:13 +0100 Subject: [PATCH 3/4] Fix norm --- lvtc/src/WatLike.hs | 106 ++++++++++++++++++++++++++++---------------- 1 file changed, 68 insertions(+), 38 deletions(-) diff --git a/lvtc/src/WatLike.hs b/lvtc/src/WatLike.hs index 8fe64ec..afd13ab 100644 --- a/lvtc/src/WatLike.hs +++ b/lvtc/src/WatLike.hs @@ -51,16 +51,20 @@ newIndex = newIndex' 0 modifyAllValue :: [Value] -> [Index] -> [Index] -> ([Value], [Index], [Index]) modifyAllValue [] varsIndex funcsIndex = ([], varsIndex, funcsIndex) -modifyAllValue (x:xs) varsIndex funcsIndex = (val:vals, varsIndex'', funcsIndex'') +modifyAllValue (x:xs) varsIndex funcsIndex = + (val:vals, varsIndex'', funcsIndex'') where (val, varsIndex', funcsIndex') = modifyAll' x varsIndex funcsIndex - (vals, varsIndex'', funcsIndex'') = modifyAllValue xs varsIndex' funcsIndex' + (vals, varsIndex'', funcsIndex'') = + modifyAllValue xs varsIndex' funcsIndex' modifyAll' :: Value -> [Index] -> [Index] -> (Value, [Index], [Index]) -modifyAll' (FuncValue (fName, vals)) varsIndex funcsIndex = (newFunc, varsIndex'', funcsIndex'') +modifyAll' (FuncValue (fName, vals)) varsIndex funcsIndex = + (newFunc, varsIndex'', funcsIndex'') where (funcsIndex', indFunc) = getRegisterIndex fName funcsIndex - (vals', varsIndex'', funcsIndex'') = modifyAllValue vals varsIndex funcsIndex' + (vals', varsIndex'', funcsIndex'') = + modifyAllValue vals varsIndex funcsIndex' newFunc = FuncValue (show indFunc, vals') modifyAll' (Var vName) varsIndex funcsIndex = (newVar, varsIndex', funcsIndex) where @@ -68,19 +72,25 @@ modifyAll' (Var vName) varsIndex funcsIndex = (newVar, varsIndex', funcsIndex) newVar = Var (show indVar) modifyAll' x varsIndex funcsIndex = (x, varsIndex, funcsIndex) -modifyAll :: [Instruction] -> [Index] -> [Index] -> ([Instruction], [Index], [Index]) +--- + +modifyAll :: [Instruction] -> [Index] -> [Index] + -> ([Instruction], [Index], [Index]) modifyAll [] varsIndex funcsIndex = ([], varsIndex, funcsIndex) modifyAll ((Function (fName, vals)):xs) varsIndex funcsIndex = (newFunc:ins', varsIndex''', funcsIndex''') where (funcsIndex', indFunc) = getRegisterIndex fName funcsIndex - (vals', varsIndex'', funcsIndex'') = modifyAllValue vals varsIndex funcsIndex' + (vals', varsIndex'', funcsIndex'') = + modifyAllValue vals varsIndex funcsIndex' newFunc = Function (show indFunc, vals') - (ins', varsIndex''', funcsIndex''') = modifyAll xs varsIndex'' funcsIndex'' + (ins', varsIndex''', funcsIndex''') = + modifyAll xs varsIndex'' funcsIndex'' modifyAll ((Return vValue):xs) varsIndex funcsIndex = (newReturn:ins', varsIndex'', funcsIndex'') where - (vValue', varsIndex', funcsIndex') =modifyAll' vValue varsIndex funcsIndex + (vValue', varsIndex', funcsIndex') = + modifyAll' vValue varsIndex funcsIndex newReturn = Return vValue' (ins', varsIndex'', funcsIndex'') = modifyAll xs varsIndex' funcsIndex' modifyAll ((Declaration ((vName, vTyp), vValue)):xs) varsIndex funcsIndex = @@ -93,17 +103,19 @@ modifyAll ((Assignation (vName, vValue)):xs) varsIndex funcsIndex = (newAssignation:ins', varsIndex''', funcsIndex''') where (varsIndex', ind) = getRegisterIndex vName varsIndex - (vValue', varsIndex'', funcsIndex'') = modifyAll' vValue varsIndex' funcsIndex + (vValue', varsIndex'', funcsIndex'') = + modifyAll' vValue varsIndex' funcsIndex newAssignation = Assignation (show ind, vValue') - (ins', varsIndex''', funcsIndex''') = modifyAll xs varsIndex'' funcsIndex'' -modifyAll ((Cond (vValue, insIf, insElse)):xs) varsIndex funcsIndex = - (newCond:ins', varsIndex'''', funcsIndex'''') + (ins', varsIndex''', funcsIndex''') = + modifyAll xs varsIndex'' funcsIndex'' +modifyAll ((Cond (vValue, insIf, insElse)):xs) vsInd fsInd = + (newCond:ins', vsInd'''', fsInd'''') where - (vValue', varsIndex', funcsIndex') = modifyAll' vValue varsIndex funcsIndex - (insIf', varsIndex'', funcsIndex'') = modifyAll insIf varsIndex' funcsIndex' - (insElse', varsIndex''', funcsIndex''') = modifyAll insElse varsIndex'' funcsIndex'' + (vValue', vsInd', fsInd') = modifyAll' vValue vsInd fsInd + (insIf', vsInd'', fsInd'') = modifyAll insIf vsInd' fsInd' + (insElse', vsInd''', fsInd''') = modifyAll insElse vsInd'' fsInd'' newCond = Cond (vValue', insIf', insElse') - (ins', varsIndex'''', funcsIndex'''') = modifyAll xs varsIndex''' funcsIndex''' + (ins', vsInd'''', fsInd'''') = modifyAll xs vsInd''' fsInd''' transformType :: Type -> Type transformType "Void" = "Int" @@ -115,10 +127,12 @@ registerParams :: FuncDeclare -> FuncDeclare registerParams (((fName, [], typ), ins), varsIndex) = (((fName, [], transformType typ), ins), varsIndex) registerParams (((fName, (pName, pTyp):vParams, typ), ins), varsIndex) = - (((fName', (show indVar, transformType pTyp):vParams', vTyp'), ins), varsIndex'') + (((fName', newParams:vParams', vTyp'), ins), varsIndex'') where (varsIndex', indVar) = getRegisterIndex pName varsIndex - (((fName', vParams', vTyp'), _), varsIndex'') = registerParams (((fName, vParams, typ), ins), varsIndex') + (((fName', vParams', vTyp'), _), varsIndex'') = + registerParams (((fName, vParams, typ), ins), varsIndex') + newParams = (show indVar, transformType pTyp) registerAllFuncs :: [FuncDeclaration] -> [Index] -> [Index] registerAllFuncs [] funcsIndex = funcsIndex @@ -133,8 +147,10 @@ changeIndexes (((fName, vars, typ), ins):xs) funcsIndex = (newFunc:funcs, funcsIndex''') where (funcsIndex', indFunc) = getRegisterIndex fName funcsIndex - (((_, vars', typ'), ins'), varsIndex) = registerParams (((fName, vars, typ), ins), []) - (ins'', varsIndex'', funcsIndex'') = modifyAll ins' varsIndex funcsIndex' + (((_, vars', typ'), ins'), varsIndex) = + registerParams (((fName, vars, typ), ins), []) + (ins'', varsIndex'', funcsIndex'') = + modifyAll ins' varsIndex funcsIndex' newFunc = (((show indFunc, vars', typ'), ins''), varsIndex'') (funcs, funcsIndex''') = changeIndexes xs funcsIndex'' @@ -146,7 +162,8 @@ instance Eq WatLikeState where (==) (WLS x y z) (WLS x' y' z') = x == x' && y == y' && z == z' instance Show WatLikeState where - show (WLS x y z) = "WLS[[ " ++ show x ++ " ][ " ++ show y ++ " ][ " ++ show z ++ " ]]" + show (WLS x y z) = + "WLS[[ " ++ show x ++ " ][ " ++ show y ++ " ][ " ++ show z ++ " ]]" ------------------------------------------------------------------------------ @@ -158,22 +175,27 @@ getPrototype fName ((((fName', vars, typ), _), _):xs) ------------------------------------------------------------------------------ -funcCallToWatLike :: FuncCall -> ([FuncDeclare], [Index]) -> [Index] -> ([Index], [Instruction], FuncCall) +funcCallToWatLike :: FuncCall -> ([FuncDeclare], [Index]) -> [Index] + -> ([Index], [Instruction], FuncCall) funcCallToWatLike (fName, []) _ varsIndex = (varsIndex, [], (fName, [])) funcCallToWatLike (fName, vVal:vVals) oldFuncs varsIndex = (varsIndex'', ins ++ inss, (fName, vVal':vVals')) where (varsIndex', ins, vVal') = valueToWatLike vVal oldFuncs varsIndex - (varsIndex'', inss, (_, vVals')) = funcCallToWatLike (fName, vVals) oldFuncs varsIndex' + (varsIndex'', inss, (_, vVals')) = + funcCallToWatLike (fName, vVals) oldFuncs varsIndex' -valueToWatLike :: Value -> ([FuncDeclare], [Index]) -> [Index] -> ([Index], [Instruction], Value) +valueToWatLike :: Value -> ([FuncDeclare], [Index]) -> [Index] + -> ([Index], [Instruction], Value) valueToWatLike (FuncValue x) (oldFuncs, funcsIndex) varsIndex = (varsIndex'', ins ++ [newDeclaration], Var (show indVar)) where - (varsIndex', ins, (fName, vVals)) = funcCallToWatLike x (oldFuncs, funcsIndex) varsIndex + (varsIndex', ins, (fName, vVals)) = + funcCallToWatLike x (oldFuncs, funcsIndex) varsIndex (varsIndex'', indVar) = newIndex varsIndex' (_, _, typ) = getPrototype fName oldFuncs - newDeclaration = Declaration ((show indVar, typ), FuncValue (fName, vVals)) + newDeclaration = + Declaration ((show indVar, typ), FuncValue (fName, vVals)) valueToWatLike (Boolean True) _ varsIndex = (varsIndex', [newDeclaration], Var (show indVar)) where @@ -188,7 +210,8 @@ valueToWatLike (Character x) _ varsIndex = (varsIndex', [newDeclaration], Var (show indVar)) where (varsIndex', indVar) = newIndex varsIndex - newDeclaration = Declaration ((show indVar, "Int"), Integer (read (show (ord x)) :: Int32)) + ordChar = read (show (ord x)) :: Int32 + newDeclaration = Declaration ((show indVar, "Int"), Integer ordChar) valueToWatLike (StringView _) _ _ = undefined valueToWatLike Void _ varsIndex = (varsIndex', [newDeclaration], Var (show indVar)) @@ -202,7 +225,8 @@ valueToWatLike (Integer x) _ varsIndex = newDeclaration = Declaration ((show indVar, "Int"), Integer x) valueToWatLike (Var x) _ varsIndex = (varsIndex, [], Var x) -instructionToWatLike :: Instruction -> ([FuncDeclare], [Index]) -> [Index] -> ([Index], [Instruction]) +instructionToWatLike :: Instruction -> ([FuncDeclare], [Index]) -> [Index] + -> ([Index], [Instruction]) instructionToWatLike (Declaration ((vName, vTyp), vValue)) oldFuncs varsIndex = (varsIndex', ins' ++ [newDeclaration]) @@ -219,7 +243,8 @@ instructionToWatLike (Function (fName, fParams)) oldFuncs varsIndex = (varsIndex', ins' ++ [newFunction]) where - (varsIndex', ins', (_, fParams')) = funcCallToWatLike (fName, fParams) oldFuncs varsIndex + (varsIndex', ins', (_, fParams')) = + funcCallToWatLike (fName, fParams) oldFuncs varsIndex newFunction = Function (fName, fParams') instructionToWatLike (Return vValue) oldFuncs varsIndex = @@ -228,15 +253,17 @@ instructionToWatLike (varsIndex', ins', vValue') = valueToWatLike vValue oldFuncs varsIndex newReturn = Return vValue' instructionToWatLike - (Cond (vValCond, vInsTrue, vInsFalse)) oldFuncs varsIndex = - (varsIndex''', insCond ++ [newCond]) + (Cond (vValCond, vInsTrue, vInsFalse)) oldFuncs vsInd = + (vsInd''', insCond ++ [newCond]) where - (varsIndex', insCond, vValCond') = valueToWatLike vValCond oldFuncs varsIndex - (varsIndex'', vInsTrue') = instructionsToWatLike vInsTrue oldFuncs varsIndex' - (varsIndex''', vInsFalse') = instructionsToWatLike vInsFalse oldFuncs varsIndex'' + (vsInd', insCond, vValCond') = valueToWatLike vValCond oldFuncs vsInd + (vsInd'', vInsTrue') = instructionsToWatLike vInsTrue oldFuncs vsInd' + (vsInd''', vInsFalse') = + instructionsToWatLike vInsFalse oldFuncs vsInd'' newCond = Cond (vValCond', vInsTrue', vInsFalse') -instructionsToWatLike :: [Instruction] -> ([FuncDeclare], [Index]) -> [Index] -> ([Index], [Instruction]) +instructionsToWatLike :: [Instruction] -> ([FuncDeclare], [Index]) + -> [Index] -> ([Index], [Instruction]) instructionsToWatLike [] _ varsIndex = (varsIndex, []) instructionsToWatLike (x:xs) oldFuncs varsIndex = (varsIndex'', ins ++ inss) @@ -247,12 +274,14 @@ instructionsToWatLike (x:xs) oldFuncs varsIndex = ------------------------------------------------------------------------------ funcToWatLike' :: FuncDeclare -> ([FuncDeclare], [Index]) -> FuncDeclare -funcToWatLike' (((fName, fParams, fRet), []), varsIndex) _ = (((fName, fParams, fRet), []), varsIndex) +funcToWatLike' (((fName, fParams, fRet), []), varsIndex) _ = + (((fName, fParams, fRet), []), varsIndex) funcToWatLike' (((fName, fParams, fRet), ins:inss), varsIndex) oldFuncs = (((fName, fParams, fRet), ins' ++ inss'), varsIndex'') where (varsIndex', ins') = instructionToWatLike ins oldFuncs varsIndex - (((_, _, _), inss'), varsIndex'') = funcToWatLike' (((fName, fParams, fRet), inss), varsIndex') oldFuncs + thisFunc = (((fName, fParams, fRet), inss), varsIndex') + (((_, _, _), inss'), varsIndex'') = funcToWatLike' thisFunc oldFuncs funcToWatLike :: FuncDeclare -> WatLikeState -> WatLikeState funcToWatLike (((fName, fParams, fRet), fInss), varsIndex) @@ -266,7 +295,8 @@ funcToWatLike (((fName, fParams, fRet), fInss), varsIndex) ------------------------------------------------------------------------------ aSTToWatLike' :: [FuncDeclare] -> WatLikeState -> WatLikeState -aSTToWatLike' [] (WLS funcsIndex oldFunc newFunc) = WLS funcsIndex oldFunc newFunc +aSTToWatLike' [] (WLS funcsIndex oldFunc newFunc) = + WLS funcsIndex oldFunc newFunc aSTToWatLike' (func:xs) (WLS funcsIndex oldFunc newFunc) = aSTToWatLike' xs (WLS funcsIndex' oldFunc newFunc') From 84af1a617a74238ee4b737ea76abf16b32108440 Mon Sep 17 00:00:00 2001 From: Xavier Mitault Date: Mon, 8 Jan 2024 11:54:26 +0100 Subject: [PATCH 4/4] Add header --- lvtc/src/Builtins.hs | 2 +- lvtc/test/UTParseLvt.hs | 7 +++++++ lvtc/test/UTShuntingYard.hs | 7 +++++++ lvtc/test/UTWatLike.hs | 7 +++++++ 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/lvtc/src/Builtins.hs b/lvtc/src/Builtins.hs index 3508b42..387c7fc 100644 --- a/lvtc/src/Builtins.hs +++ b/lvtc/src/Builtins.hs @@ -2,7 +2,7 @@ -- EPITECH PROJECT, 2023 -- Leviator compiler -- File description: --- WatLike +-- Builtins -} module Builtins diff --git a/lvtc/test/UTParseLvt.hs b/lvtc/test/UTParseLvt.hs index d419fe2..302fb0c 100644 --- a/lvtc/test/UTParseLvt.hs +++ b/lvtc/test/UTParseLvt.hs @@ -1,3 +1,10 @@ +{- +-- EPITECH PROJECT, 2023 +-- Leviator compiler +-- File description: +-- UTParseLvt +-} + module UTParseLvt ( utParserLvt ) where diff --git a/lvtc/test/UTShuntingYard.hs b/lvtc/test/UTShuntingYard.hs index 1a82f1a..d8c15c3 100644 --- a/lvtc/test/UTShuntingYard.hs +++ b/lvtc/test/UTShuntingYard.hs @@ -1,3 +1,10 @@ +{- +-- EPITECH PROJECT, 2023 +-- Leviator compiler +-- File description: +-- UTShuntingYard +-} + module UTShuntingYard ( utShuntingYard ) where diff --git a/lvtc/test/UTWatLike.hs b/lvtc/test/UTWatLike.hs index aed5f57..f0085d2 100644 --- a/lvtc/test/UTWatLike.hs +++ b/lvtc/test/UTWatLike.hs @@ -1,3 +1,10 @@ +{- +-- EPITECH PROJECT, 2023 +-- Leviator compiler +-- File description: +-- UTWatLike +-} + module UTWatLike ( utWatLike ) where