qute

A software analysis framework built around the QBE intermediate language

git clone https://git.8pit.net/qute.git

 1-- SPDX-FileCopyrightText: 2026 Sören Tempel <soeren+git@soeren-tempel.net>
 2--
 3-- SPDX-License-Identifier: GPL-3.0-only
 4
 5module Util where
 6
 7import Control.Exception (throwIO)
 8import Data.Archive (Object, parse, qbeArchive)
 9import Language.QBE (Program)
10import System.FilePath ((</>))
11
12readArchive :: FilePath -> IO [Object]
13readArchive fileName = do
14  content <- readFile $ "test" </> "testdata" </> fileName
15  case Data.Archive.parse fileName content of
16    Right objs -> pure objs
17    Left err -> throwIO err
18
19parseArchive :: FilePath -> IO [Program]
20parseArchive fileName =
21  qbeArchive ("test" </> "testdata" </> fileName)