Reader Macros in Common Lisp (2014)
lisper.in
Reader Macros in Common Lisp (2014)
1–10 of 37 posts
Re: Reader Macros in Common Lisp (2014)
#2Or is Gödel rolling in his grave for such insolent heresy?
Re: Reader Macros in Common Lisp (2014)
#3My goal is to create the barest-metal Lisp OS (basically Lisp REPL with full ring-0 access, the OS) with an asm reader macro to write low level assembly opcodes you can jmp into.
(defn add1 (x)
(declare x int64)
#asm(
mov rax, %x
add rax, 1
))
(Just thought of this syntax on the spot, I'm a few dozen hours away from that still.)Re: Reader Macros in Common Lisp (2014)
#4Great timing. It's my turn to write a Lisp, and I was just thinking about implementing reader macros this morning :-) My goal is to create the barest-metal Lisp OS (basically Lisp REPL with full ring-0 access, the OS) with an asm reader macro to write low level assembly opcodes you can jmp into. (defn add1 (x) (declare x int64) #asm( mov rax, %x add rax, 1 )) (Just thought of this syntax on the spot, I'm a few dozen…
Re: Reader Macros in Common Lisp (2014)
#5Apropos. Is there reader macro definitions for "(" and ")" ? Or is Gödel rolling in his grave for such insolent heresy?
Re: Reader Macros in Common Lisp (2014)
#6Great timing. It's my turn to write a Lisp, and I was just thinking about implementing reader macros this morning :-) My goal is to create the barest-metal Lisp OS (basically Lisp REPL with full ring-0 access, the OS) with an asm reader macro to write low level assembly opcodes you can jmp into. (defn add1 (x) (declare x int64) #asm( mov rax, %x add rax, 1 )) (Just thought of this syntax on the spot, I'm a few dozen…
1970's calling. Been there. Done that: https://news.ycombinator.com/item?id=33517092#33517797
Got more details/links to study?
Re: Reader Macros in Common Lisp (2014)
#7Apropos. Is there reader macro definitions for "(" and ")" ? Or is Gödel rolling in his grave for such insolent heresy?
(get-macro-character #\() => SB-IMPL::READ-LIST
(get-macro-character #\)) => SB-IMPL::READ-RIGHT-PAREN (that one just signals an error, the read-list one picks up the closing #\))
Re: Reader Macros in Common Lisp (2014)
#8Great timing. It's my turn to write a Lisp, and I was just thinking about implementing reader macros this morning :-) My goal is to create the barest-metal Lisp OS (basically Lisp REPL with full ring-0 access, the OS) with an asm reader macro to write low level assembly opcodes you can jmp into. (defn add1 (x) (declare x int64) #asm( mov rax, %x add rax, 1 )) (Just thought of this syntax on the spot, I'm a few dozen…
Re: Reader Macros in Common Lisp (2014)
#9Earlier quoted context omitted.
1970's calling. Been there. Done that: https://news.ycombinator.com/item?id=33517092#33517797
Thanks for the inspiration. The fact that you've already done it won't stop me. Got more details/links to study?
Keyword is the line
(dos-eval '(debug NUL))
("mapc" and "map" had their parameters in wrong order, which annoys me even today)Re: Reader Macros in Common Lisp (2014)
#10Apropos. Is there reader macro definitions for "(" and ")" ? Or is Gödel rolling in his grave for such insolent heresy?
It would be a noop. A reader macro that takes a s-expr bounded by parentheses, and returns a s-expr, literally is just the identity function^Hmacro.