Expected and actual results in test-parse are now in sync again. Introduced reset-make-label-counter to do so.

This commit is contained in:
Jens Axel Søgaard 2014-08-13 20:22:40 +02:00
parent f6b5582ccc
commit f1df1e080f
2 changed files with 23 additions and 3 deletions

View File

@ -163,11 +163,24 @@
(define current-short-labels? (make-parameter #t))
(define make-label-counter 0)
(: reset-make-label-counter (-> Void))
(define (reset-make-label-counter)
(set! make-label-counter 0))
(: make-label (Symbol -> Symbol))
(define make-label
#;(define make-label
(let ([n 0])
(lambda (l)
(set! n (add1 n))
(if (current-short-labels?)
(string->symbol (format "_~a" n))
(string->symbol (format "~a~a" l n))))))
(define (make-label l)
(set! make-label-counter (+ make-label-counter 1))
(define n make-label-counter)
(if (current-short-labels?)
(string->symbol (format "_~a" n))
(string->symbol (format "~a~a" l n))))

View File

@ -1,10 +1,17 @@
#lang racket/base
(require "../parser/baby-parser.rkt"
(require (rename-in "../parser/baby-parser.rkt"
[parse baby-parse])
"../compiler/lexical-structs.rkt"
"../compiler/expression-structs.rkt"
(for-syntax racket/base))
(define (parse x)
(parameterize ([current-short-labels? #f])
(reset-make-label-counter)
(baby-parse x)))
(printf "test-parse.rkt\n");
; Test out the compiler, using the simulator.