You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 8, 2022. It is now read-only.
(define-language L
(entry Expr)
(terminals
(number (n)))
(Expr (e)
n
(someop e)))
(define-parser parse-L L)
(define-pass as-bin : L (ir global-ctx) -> L ()
( as-binary : Expr (ir [ctx global-ctx]) -> Expr ()
[,n (modulo n 2)]
[(someop ,[e? 'val-b-> e]) `(someop ,e)]))
; usage:; (as-bin (parse-L '(someop 4)) 'val-default); or; ((compose (curryr as-bin 'val-default) parse-L) '(someop 4))
But only the processor as-binary can have the default value, and I think It would be cool to be able to also write default values as the define statement does:
; ⬐---------here---------⬎
(define-pass as-bin : L (ir [global-ctx 'val-default]) -> L ()
( as-binary : Expr (ir [ctx global-ctx]) -> Expr ()
[,n (modulo n 2)]
[(someop ,[e? 'val-b-> e]) `(someop ,e)]))
; suggested usage:; (as-bin (parse-L '(someop 4))); or; ((compose as-bin parse-L) '(someop 4))
Note
The documentation does not say anything about default parameters:
formal is an identifier representing a formal argument.
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I think we can use default values for extra formal parameters in the define-pass form:
And the following code works:
But only the processor
as-binary
can have the default value, and I think It would be cool to be able to also write default values as thedefine
statement does:Note
The documentation does not say anything about default parameters:
The text was updated successfully, but these errors were encountered: