<commit_before>module Main where
import AST
import CPS
import ClosureConvert
import CodeGen
import Parser
import Language.C.DSL (pretty)
import System.Environment

compile :: [SDec UserPrim] -> String
compile = ("#include <stdlib.h>\n#include \"rts.h\"\n"++)
          . unlines
          . map (show . pretty)
          . codegen
          . convert
          . cpsifySDec
          . (prims++)

prims :: [SDec UserPrim]
prims = [ --Def (SVar "+") $ Lam [a, b] [Plus # [a', b']]
        --, Def (SVar "-") $ Lam [a, b] [Sub #  [a', b']]
        --, Def (SVar "*") $ Lam [a, b] [Mult # [a', b']]
        --, Def (SVar "/") $ Lam [a, b] [Div #  [a', b']]
        --, Def (SVar "eq?") $ Lam [a, b] [Eq # [a', b']]
        --, Def (SVar "cons") $ Lam [a, b] [Cons # [a', b']]
         Def (SVar "display") $ Lam [a] [Display # [a']]]
        --, Def (SVar "car") $ Lam [a] [Car # [a']]
        --, Def (SVar "cdr") $ Lam [a] [Cdr # [a']]]
  where a = SVar "a"
        b = SVar "b"
        a' = Var a
        b' = Var b
        f # args = App (Prim f) args

main :: IO ()
main = do
  [file] <- getArgs
  res <- parseFile file<commit_msg>Added full set of primitives back into compilation<commit_after>module Main where
import AST
import CPS
import ClosureConvert
import CodeGen
import Parser
import Language.C.DSL (pretty)
import System.Environment

compile :: [SDec UserPrim] -> String
compile = ("#include <stdlib.h>\n#include \"rts.h\"\n"++)
          . unlines
          . map (show . pretty)
          . codegen
          . convert
          . cpsifySDec
          . (prims++)

prims :: [SDec UserPrim]
prims = [ Def (SVar "+") $ Lam [a, b] [Plus # [a', b']]
        , Def (SVar "-") $ Lam [a, b] [Sub #  [a', b']]
        , Def (SVar "*") $ Lam [a, b] [Mult # [a', b']]
        , Def (SVar "/") $ Lam [a, b] [Div #  [a', b']]
        , Def (SVar "eq?") $ Lam [a, b] [Eq # [a', b']]
        , Def (SVar "cons") $ Lam [a, b] [Cons # [a', b']]
        , Def (SVar "display") $ Lam [a] [Display # [a']]
        , Def (SVar "car") $ Lam [a] [Car # [a']]
        , Def (SVar "cdr") $ Lam [a] [Cdr # [a']]]
  where a = SVar "a"
        b = SVar "b"
        a' = Var a
        b' = Var b
        f # args = App (Prim f) args

main :: IO ()
main = do
  [file] <- getArgs
  res <- parseFile file
{'fraction_non_alphanumeric': 0.20463489287275907, 'fraction_numerical': 0.0, 'mean_word_length': 1.9333333333333333, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '854954', 'n_tokens_mistral': 883, 'n_tokens_neox': 869, 'n_words': 280}