-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
yesss
- Loading branch information
Showing
4 changed files
with
40 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
module H ( Arch (..), run ) where | ||
|
||
import qualified As | ||
import CGen | ||
import Control.Exception (throwIO) | ||
import qualified Data.ByteString.Lazy as BSL | ||
import qualified Data.Text as T | ||
import qualified Nasm | ||
import P | ||
import Prettyprinter.Render.Text (hPutDoc) | ||
import System.IO (IOMode (WriteMode), withFile) | ||
|
||
data Arch = Aarch64 | X64 | ||
|
||
run :: (FilePath, Arch, T.Text) -> IO () | ||
run (fpϵ, a, n) = do | ||
contents <- BSL.readFile fpϵ | ||
t <- either throwIO (pure.fst) (getTy contents) | ||
ct <- either throwIO pure $ pCty n t | ||
let asm=case a of {X64 -> Nasm.writeO; Aarch64 -> As.writeO} | ||
asm n contents True | ||
withFile (T.unpack n <> ".h") WriteMode $ \h -> hPutDoc h ct |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters