enable #lang honu

This commit is contained in:
Jon Rafkind 2011-07-14 16:40:18 -06:00
parent 57a759c383
commit a29d64b44a
7 changed files with 66 additions and 10 deletions

View File

@ -1,5 +1,19 @@
#lang racket/base
(require "private/honu-typed-scheme.rkt"
"private/honu2.rkt"
(prefix-in literal: "private/literals.rkt"))
(provide #%top
#%datum
print
(rename-out [#%dynamic-honu-module-begin #%module-begin]
[honu-function function]
[literal:#%braces #%braces]
[literal:#%parens #%parens])
)
#|
(require (for-syntax racket/base))
(require (for-meta 2 racket/base))
(require racket/class)
@ -157,3 +171,4 @@
#;
(scheme-syntax scheme:syntax)
))
|#

View File

@ -460,7 +460,9 @@ Then, in the pattern above for 'if', 'then' would be bound to the following synt
(define-syntax (honu-unparsed-begin stx)
(emit-remark "Honu unparsed begin!" stx)
(debug "honu unparsed begin: ~a at phase ~a\n" (syntax->datum stx) (syntax-local-phase-level))
(honu-compile (honu-expand (stx-cdr stx))))
(define expanded (honu-expand (stx-cdr stx)))
(debug "expanded ~a\n" expanded)
expanded)
(define-syntax (#%dynamic-honu-module-begin stx)
(syntax-case stx ()

View File

@ -105,7 +105,10 @@
((syntax-local-value #'head) #'(head rest ...) #f)])
(with-syntax ([parsed parsed]
[rest unparsed])
(do-parse #'rest precedence (lambda (x) x) #'parsed)
(do-parse #'rest precedence (lambda (x)
(with-syntax ([x x])
#'(begin parsed x)))
(left current))
#;
#'(splicing-let-syntax ([more-parsing (lambda (stx)
(do-parse (stx-cdr stx)
@ -144,15 +147,18 @@
precedence left #'x)]
[(#%parens args ...)
(debug "function call ~a\n" left)
(with-syntax ([current current])
#'(current args ...))
(do-parse #'(rest ...)
0
(lambda (x) x)
(left (with-syntax ([current current])
#'(current args ...))))
#;
(error 'parse "function call")]
[else (error 'what "dont know ~a" #'head)])]
)]))
(do-parse input 0 (lambda (x) x) #f))
(do-parse input 0 (lambda (x) x) #'(void)))
(define (parse2 forms)
(debug "parse forms ~a\n" forms)

View File

@ -11,6 +11,7 @@
...))
(provide-module "core/main.rkt"
"private/struct.honu"
"private/function.honu"
"private/common.honu")
;;"private/struct.honu"
;;"private/function.honu"
;;"private/common.honu"
)

View File

@ -1,7 +1,5 @@
#lang honu
obj test(t, a, b){
if (a != b){
display(t);

View File

@ -0,0 +1,28 @@
#lang honu
/*
function test(t, a, b){
if (a != b){
display(t);
display(" failed!");
newline();
display("Got ");
display(a);
display(". Expected ");
display(b);
newline();
}
}
*/
function test1(){
print(5)
/*
var x = 3;
const y = 2;
test("x = 3", x, 3);
test("y = 2", y, 2);
*/
}
test1()

View File

@ -45,6 +45,12 @@
}))
(test 5))
(let ()
(fake-module-begin #hx(honu_function test(x){
print(x)
}
test(2))))
(let ()
(fake-module-begin #hx(1 honu_plus 1)))