enable #lang honu
This commit is contained in:
parent
57a759c383
commit
a29d64b44a
|
@ -1,5 +1,19 @@
|
||||||
#lang racket/base
|
#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-syntax racket/base))
|
||||||
(require (for-meta 2 racket/base))
|
(require (for-meta 2 racket/base))
|
||||||
(require racket/class)
|
(require racket/class)
|
||||||
|
@ -157,3 +171,4 @@
|
||||||
#;
|
#;
|
||||||
(scheme-syntax scheme:syntax)
|
(scheme-syntax scheme:syntax)
|
||||||
))
|
))
|
||||||
|
|#
|
||||||
|
|
|
@ -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)
|
(define-syntax (honu-unparsed-begin stx)
|
||||||
(emit-remark "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))
|
(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)
|
(define-syntax (#%dynamic-honu-module-begin stx)
|
||||||
(syntax-case stx ()
|
(syntax-case stx ()
|
||||||
|
|
|
@ -105,7 +105,10 @@
|
||||||
((syntax-local-value #'head) #'(head rest ...) #f)])
|
((syntax-local-value #'head) #'(head rest ...) #f)])
|
||||||
(with-syntax ([parsed parsed]
|
(with-syntax ([parsed parsed]
|
||||||
[rest unparsed])
|
[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)
|
#'(splicing-let-syntax ([more-parsing (lambda (stx)
|
||||||
(do-parse (stx-cdr stx)
|
(do-parse (stx-cdr stx)
|
||||||
|
@ -144,15 +147,18 @@
|
||||||
precedence left #'x)]
|
precedence left #'x)]
|
||||||
[(#%parens args ...)
|
[(#%parens args ...)
|
||||||
(debug "function call ~a\n" left)
|
(debug "function call ~a\n" left)
|
||||||
(with-syntax ([current current])
|
(do-parse #'(rest ...)
|
||||||
#'(current args ...))
|
0
|
||||||
|
(lambda (x) x)
|
||||||
|
(left (with-syntax ([current current])
|
||||||
|
#'(current args ...))))
|
||||||
#;
|
#;
|
||||||
(error 'parse "function call")]
|
(error 'parse "function call")]
|
||||||
[else (error 'what "dont know ~a" #'head)])]
|
[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)
|
(define (parse2 forms)
|
||||||
(debug "parse forms ~a\n" forms)
|
(debug "parse forms ~a\n" forms)
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
...))
|
...))
|
||||||
|
|
||||||
(provide-module "core/main.rkt"
|
(provide-module "core/main.rkt"
|
||||||
"private/struct.honu"
|
;;"private/struct.honu"
|
||||||
"private/function.honu"
|
;;"private/function.honu"
|
||||||
"private/common.honu")
|
;;"private/common.honu"
|
||||||
|
)
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
#lang honu
|
#lang honu
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
obj test(t, a, b){
|
obj test(t, a, b){
|
||||||
if (a != b){
|
if (a != b){
|
||||||
display(t);
|
display(t);
|
||||||
|
|
28
collects/tests/honu/test.honu
Normal file
28
collects/tests/honu/test.honu
Normal 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()
|
|
@ -45,6 +45,12 @@
|
||||||
}))
|
}))
|
||||||
(test 5))
|
(test 5))
|
||||||
|
|
||||||
|
(let ()
|
||||||
|
(fake-module-begin #hx(honu_function test(x){
|
||||||
|
print(x)
|
||||||
|
}
|
||||||
|
test(2))))
|
||||||
|
|
||||||
|
|
||||||
(let ()
|
(let ()
|
||||||
(fake-module-begin #hx(1 honu_plus 1)))
|
(fake-module-begin #hx(1 honu_plus 1)))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user