<commit_before><commit_msg>a python module to meta-interp pycket internally<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-

from pycket.config import get_testing_config
from pycket.entry_point import make_entry_point, target, get_additional_config_options

from rpython.jit.metainterp.test.support import LLJitMixin
from rpython.jit.metainterp.warmspot import get_stats
from pycket.racket_entry import dev_mode_metainterp

# 1

LLJitMixin().meta_interp(dev_mode_metainterp, [], listcomp=True, listops=True, backendopt=True)

# 2
from rpython.translator.driver import TranslationDriver
from rpython.config.translationoption import get_combined_translation_config

# pypy targetpycket.py --linklets --verbose 2 -I racket/kernel/init -e "1"
entry_flags_1 = ['--linklets', '--verbose', '2', '-I', 'racket/kernel/init', '-e', '1']

def interp_w_1():
    # driver = TranslationDriver()
    # optiondescr = get_additional_config_options()
    # config = get_combined_translation_config(
    #             optiondescr,
    #             existing_config=driver.config,
    #             translating=True)
    # driver.config = config
    # f, _1, _2  = target(driver, [])
    # f(['--linklets', '--verbose', '2', '-I', 'racket/kernel/init', '-e', '1'])

    ## sys.argv = ['--linklets', '--verbose', '2', '-I', 'racket/kernel/init', '-e', '1']
    # from pycket.__main__ import main
    # main()

    make_entry_point(get_testing_config())(entry_flags_1)

## LLJitMixin().meta_interp(interp_w_1, [], listcomp=True, listops=True, backendopt=True)


# 3

# pypy targetpycket.py --linklets --dev
entry_flags_2 = ['--linklets', '--dev']

def interp_w_2():
    make_entry_point(get_testing_config())(entry_flags_2)

## LLJitMixin().meta_interp(interp_w_2, [], listcomp=True, listops=True, backendopt=True)
{'fraction_non_alphanumeric': 0.14919578480310594, 'fraction_numerical': 0.012201885745978924, 'mean_word_length': 4.401197604790419, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7518798', 'n_tokens_mistral': 652, 'n_tokens_neox': 630, 'n_words': 120}