Created
March 24, 2016 06:09
-
-
Save endobson/e165edf224b4028db48d to your computer and use it in GitHub Desktop.
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 racket | |
(struct variant-val (variant-name fields) #:transparent) | |
(struct bytes-val (v) #:transparent) | |
(define form | |
#' | |
(define (parse-function-definition2692 sexp2785) | |
(match | |
sexp2785 | |
((variant-val | |
'node | |
(list | |
(variant-val | |
'cons | |
(list | |
(variant-val 'symbol-sexp (list (bytes-val #"define"))) | |
(variant-val | |
'cons | |
(list | |
(variant-val 'node (list type-vars2790)) | |
(variant-val | |
'cons | |
(list | |
(variant-val | |
'node | |
(list | |
(variant-val | |
'cons | |
(list | |
(variant-val 'symbol-sexp (list function-name2789)) | |
args2788)))) | |
(variant-val | |
'cons | |
(list | |
(variant-val 'symbol-sexp (list (bytes-val #":"))) | |
(variant-val | |
'cons | |
(list | |
result-type2787 | |
(variant-val | |
'cons | |
(list body2786 (variant-val 'empty (list)))))))))))))))) | |
(match | |
(let-values (((temp2837) (map147 parse-arg-type2693 args2788))) | |
(#%app leftmost-error2703 temp2837)) | |
((variant-val 'left (list v2791)) (left4 v2791)) | |
((variant-val 'right (list arg-types2794)) | |
(match | |
(let-values (((temp2832) (map147 parse-arg-name2694 args2788))) | |
(#%app leftmost-error2703 temp2832)) | |
((variant-val 'left (list v2795)) (left4 v2795)) | |
((variant-val 'right (list arg-names2798)) | |
(match | |
(let-values (((temp2827) | |
(map147 parse-type-var-symbol2691 type-vars2790))) | |
(#%app leftmost-error2703 temp2827)) | |
((variant-val 'left (list v2799)) (left4 v2799)) | |
((variant-val 'right (list type-vars2802)) | |
(match | |
(parse-pre-type2699 result-type2787) | |
((variant-val 'left (list v2803)) (left4 v2803)) | |
((variant-val 'right (list result-type2806)) | |
(match | |
(parse-expression2697 body2786) | |
((variant-val 'left (list v2807)) (left4 v2807)) | |
((variant-val 'right (list expression2810)) | |
(let-values (((temp2812) | |
(let-values (((temp2815) | |
(fun-pre-type2631 | |
type-vars2802 | |
arg-types2794 | |
result-type2806))) | |
(#%app | |
function-definition2638 | |
function-name2789 | |
temp2815 | |
arg-names2798 | |
expression2810)))) | |
(#%app right6 temp2812))))))))))))) | |
((variant-val | |
'node | |
(list | |
(variant-val | |
'cons | |
(list | |
(variant-val 'symbol-sexp (list (bytes-val #"define"))) | |
(variant-val | |
'cons | |
(list | |
(variant-val | |
'node | |
(list | |
(variant-val | |
'cons | |
(list | |
(variant-val 'symbol-sexp (list function-name2844)) | |
args2843)))) | |
(variant-val | |
'cons | |
(list | |
(variant-val 'symbol-sexp (list (bytes-val #":"))) | |
(variant-val | |
'cons | |
(list | |
result-type2842 | |
(variant-val | |
'cons | |
(list body2841 (variant-val 'empty (list)))))))))))))) | |
(match | |
(let-values (((temp2883) (map147 parse-arg-type2693 args2843))) | |
(#%app leftmost-error2703 temp2883)) | |
((variant-val 'left (list v2845)) (left4 v2845)) | |
((variant-val 'right (list arg-types2848)) | |
(match | |
(let-values (((temp2878) (map147 parse-arg-name2694 args2843))) | |
(#%app leftmost-error2703 temp2878)) | |
((variant-val 'left (list v2849)) (left4 v2849)) | |
((variant-val 'right (list arg-names2852)) | |
(match | |
(parse-pre-type2699 result-type2842) | |
((variant-val 'left (list v2853)) (left4 v2853)) | |
((variant-val 'right (list result-type2856)) | |
(match | |
(parse-expression2697 body2841) | |
((variant-val 'left (list v2857)) (left4 v2857)) | |
((variant-val 'right (list expression2860)) | |
(let-values (((temp2862) | |
(let-values (((temp2865) | |
(let-values (((temp2869) (empty146))) | |
(#%app | |
fun-pre-type2631 | |
temp2869 | |
arg-types2848 | |
result-type2856)))) | |
(#%app | |
function-definition2638 | |
function-name2844 | |
temp2865 | |
arg-names2852 | |
expression2860)))) | |
(#%app right6 temp2862))))))))))) | |
(_ | |
(let-values (((temp2888) (bytes-val '#"Not a valid function definition"))) | |
(#%app left4 temp2888)))))) | |
(define-namespace-anchor anchor) | |
(define ns (namespace-anchor->empty-namespace anchor)) | |
(parameterize ([current-namespace ns]) | |
(namespace-require 'racket/base)) | |
(for ([i (in-range 5)]) | |
(time (expand form))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment