1{- 2 SockeyeParser.hs: Parser for Sockeye 3 4 Part of Sockeye 5 6 Copyright (c) 2018, ETH Zurich. 7 8 All rights reserved. 9 10 This file is distributed under the terms in the attached LICENSE file. 11 If you do not find this file, copies can be found by writing to: 12 ETH Zurich D-INFK, CAB F.78, Universitaetstrasse 6, CH-8092 Zurich, 13 Attn: Systems Group. 14-} 15 16{-# LANGUAGE MultiParamTypeClasses #-} 17{-# LANGUAGE FlexibleInstances #-} 18 19module SockeyeChecker 20 (checkSockeye) where 21 22import SockeyeChecks 23 24import SockeyeASTMeta 25import qualified SockeyeParserAST as ParseAST 26import qualified SockeyeSymbolTable as ST 27import qualified SockeyeAST as AST 28 29data CheckFail 30 = NotYetImplemented 31 32instance CheckFailure CheckFail where 33 errorLines NotYetImplemented = ["Sockeye Checker not yet implemented"] 34 35checkSockeye :: ST.Sockeye -> ParseAST.Sockeye -> Either (FailedChecks CheckFail) AST.Sockeye 36checkSockeye symTable ast = runChecks $ check symTable ast 37 38{- This should have a similar structure as the SymbolTableBuilder, see also transformations in old compiler -} 39class Checkable a b where 40 check :: ST.Sockeye -> a -> Checks CheckFail b 41 42instance Checkable ParseAST.Sockeye AST.Sockeye where 43 check symTable ast = return AST.Sockeye 44