<commit_before>module Main where

import Parser
import Codegen

import Control.Monad.Trans
import System.Console.Haskeline
import Data.Maybe
import System.Process

serializeBlocks :: Codegen -> String
serializeBlocks codegen =
  globalBlock codegen ++
  concat (funcBlocks codegen) ++
  mainBlock codegen

process :: String -> IO ()
process line = do
  let res = parseToplevel line
  case res of
    Left err -> print err
    Right ex -> do
      putStrLn code
      writeFile "out.ll" code
      createProcess (proc "lli" ["out.ll"])
      return ()
      where code = serializeBlocks (codegen ex)

main :: IO ()
main = runInputT defaultSettings loop
  where
  loop = do
    minput <- liftIO $ readFile "in.gl"
    liftIO (process minput) -- >> loop<commit_msg>Disable REPL loop<commit_after>module Main where

import Parser
import Codegen

import Control.Monad.Trans
import System.Console.Haskeline
import Data.Maybe
import System.Process

serializeBlocks :: Codegen -> String
serializeBlocks codegen =
  globalBlock codegen ++
  concat (funcBlocks codegen) ++
  mainBlock codegen

process :: String -> IO ()
process line = do
  let res = parseToplevel line
  case res of
    Left err -> print err
    Right ex -> do
      putStrLn code
      writeFile "out.ll" code
      createProcess (proc "lli" ["out.ll"])
      return ()
      where code = serializeBlocks (codegen ex)

main :: IO ()
main = do
  minput <- readFile "in.gl"
  process minput
{'fraction_non_alphanumeric': 0.08707671043538355, 'fraction_numerical': 0.0, 'mean_word_length': 3.2215743440233235, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '5671166', 'n_tokens_mistral': 433, 'n_tokens_neox': 430, 'n_words': 151}