rearranged some functions,

added check for multiple definitions
changed naming of attributes in haskell
This commit is contained in:
Macocian Adrian Radu
2022-02-24 12:05:53 +01:00
parent a84f433667
commit edee037aa3
7 changed files with 58 additions and 27 deletions

View File

@@ -6,6 +6,7 @@ import Semantic.ExpressionChecker
import Semantic.TypeChecker
import Data.Either
import Data.Char
import Utils.Utils
-- |Checks if all the inputs and the output of a function call have valid types, and then checks that the assign-output expression is valid
checkFunction :: ([Type], [Symbol]) -> Function -> Either [TypeCheckError] Function
@@ -16,7 +17,7 @@ checkFunction (definedTypes, symbols) (MakeFunction name desc inp out ex)
Left err -> Left [err]
| otherwise = Left $ lefts [checkedOut] ++ lefts checkedIn ++ lefts [checkedEx]
where
checkedIn = checkAttributes definedTypes inp
localEnv = addVariables symbols inp
checkedEx = checkExpression localEnv ex
checkedIn = checkAttributes definedTypes inp
checkedOut = head $ checkAttributes definedTypes [out]