This file contains hidden or 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
| module Linker where | |
| import Control.Monad.State | |
| -- Relocation is either relative relocation (in current code block) or | |
| -- symbol relocation -- a symbol from external library | |
| type Relocation = Either Integer (String, String) | |
| type Symbol = (String, Integer) | |
| -- Whether a block of code is a library or not is stored in the memory |
This file contains hidden or 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
| module Test where | |
| data _≡_ {A : Set}(x : A) : A → Set where | |
| refl : x ≡ x | |
| data ℕ : Set where | |
| zero : ℕ | |
| succ : ℕ → ℕ | |
| data _≤_ : ℕ → ℕ → Set where |
This file contains hidden or 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
| main1 | |
| main1 = | |
| \ eta_Xq -> | |
| case lvl2_r1p5 of _ { I# ipv_aJd -> | |
| case lvl1_r1p2 of _ { I# ipv1_aJi -> | |
| letrec { | |
| $wloop_s1fC | |
| $wloop_s1fC = | |
| \ ww_s1f3 ww1_s1f9 ww2_s1fd -> | |
| case ww2_s1fd of wild3_aHE { |
This file contains hidden or 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
| data Blob = Blob { blobSize :: int } | |
| type Segment = Int | |
| type Section = Int | |
| data Elf = Elf | |
| { elfSegments :: [Segment] | |
| , elfSections :: [Section] | |
| , elfBlob :: Blob } |
This file contains hidden or 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
| #lang r5rs | |
| (define (append! x y) | |
| (set-cdr! (last-pair x) y) | |
| x) | |
| (define (last-pair x) | |
| (if (null? (cdr x)) | |
| x | |
| (last-pair (cdr x)))) |
This file contains hidden or 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
| module Main where | |
| import Data.Char | |
| import Data.Word | |
| import Control.Monad | |
| import Control.Monad.State | |
| import System.Environment | |
| data Expr = Var String | |
| | Int Word8 |
This file contains hidden or 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
| import Prelude hiding (Either(..)) | |
| import Debug.Trace | |
| import Control.Monad (mapM_) | |
| data Direction = Left | Right | Stay | |
| type State = Int | |
| type Letter = Char | |
| blank = ' ' |
This file contains hidden or 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
| import Prelude hiding (Either(..)) | |
| import Control.Monad (mapM_) | |
| data Direction = Left | Right | Stay | |
| type State = Int | |
| type Letter = Char | |
| type TMFunction = State -> Letter -> (State, Letter, Direction) | |
| data TM = TM | |
| { delta :: TMFunction, |
This file contains hidden or 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
| module Problem where | |
| data _≡_ {A : Set} (x : A) : A → Set where | |
| refl : x ≡ x | |
| trans : {A : Set}{x y z : A} → x ≡ y → y ≡ z → x ≡ z | |
| trans refl refl = refl | |
| sym : {A : Set}{x y : A} → x ≡ y → y ≡ x | |
| sym refl = refl |
This file contains hidden or 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
| getOtherSource = "getOtherSource = $\n\ngetSource = replace getOtherSource $ show getOtherSource\n\nmain = putStrLn getSource\n\nreplace = replace' [] where\n replace' acc (x:xs) what = case x of\n '$' -> reverse acc ++ what ++ xs\n _ -> replace' (x:acc) xs what" | |
| getSource = replace getOtherSource $ show getOtherSource | |
| main = putStrLn getSource | |
| replace = replace' [] where | |
| replace' acc (x:xs) what = case x of | |
| '$' -> reverse acc ++ what ++ xs | |
| _ -> replace' (x:acc) xs what |