freenode/#lisp - IRC Chatlog
Search
4:01:10
Berra
It feels frustrating, I would just like to be able to define a continuation to that evaluation and quote that.
4:01:37
Berra
But any evaluation that I try to quote obviously also quotes that evaluation. There must be something I'm missing.
4:05:02
Josh_2
Berra: I'm sorry but that's a bit above my pay grade xD If you wait a little while beach will probably be up and I'm sure he will be able to help if no one else has by then
4:20:52
Berra
Something like `',x works because the unescape still evaluates x because that's not prevented by the quote. But ``,x does not work, because the outermost quasiquote won't evaluate the escaped x because of the innermost one.
4:25:29
Berra
``,,x almost does what I want, but I don't understand why so I need to read more about quasiquote escapes..
4:49:01
Berra
It would be easy if I allowed myself to evaluate the quoting semantics in parsing, but that's incorrect, right?
4:52:59
no-defun-allowed
(let ((x 2)) `,x) would not work as the reader does not have access to the lexical environment.
4:53:33
no-defun-allowed
However, I don't think the representation of backquote is defined, so you could simplify it to (let ((x 2)) x).
4:53:45
Berra
What I'm trying to do is that I want to parse a Lisp and I want to parse it into an actual Lisp AST, since the parsing is done by a Lisp. But I'm running into this problem.
4:55:00
no-defun-allowed
Hm, so you'd like to read `x and get (quasiquote x) or something like that?
4:55:51
Berra
no-defun-allowed: Something like that, yes. But since `x represents the actual parsing of a datum (x) in this case, I need to evaluate x since the quote is not supposed to be quote x but instead that that datum is.
4:56:51
no-defun-allowed
I think what you're asking for is different than CL quasiquote then, and I barely understand that quasiquote.
4:57:30
Berra
Ok, that's my fault. I entered #lisp because yeah- but I'm actually writing the parser in a subset of Scheme
4:58:01
no-defun-allowed
And that quasiquote is the same as Scheme quasiquote, but the representation in Scheme is defined.
5:00:04
no-defun-allowed
Everyone that isn't Berra should mentally replace any `define` in that article with `defvar`, but it just describes what to translate in English to list building functions, so you should be okay.
5:05:17
Berra
no-defun-allowed: https://privatebin.net/?599c1f453ff0213a#95wHMhJ5YZ26eHnZbro7Wyu6aXVdj28twPHWhiTWX1zS
5:06:09
Berra
Problem is just those mappings really. But the representation is tripping me up. The article makes perfect sense from the perspective of interpretation and code generation, but I should refrain from such semantics in parsing right?
5:06:43
Berra
Maybe I cannot avoid doing either of two things. Either create an arbitrary representation for quotation that isn't the defacto one in the Lisp I'm wiring my parser in.
5:07:54
no-defun-allowed
You might write a macro for QUASIQUOTE which translates its body to that list building code.
5:11:50
Berra
Thinking more about it right now I'm thinking that I can't use any of the quotation semantics of the Lisp I'm parsing with.
5:31:24
Berra
no-defun-allowed: Well so yeah I think I need to forgo using quoting in my AST representation of the Lisp I'm parsing and just create my own symbols to represent quoting.
5:31:48
Berra
no-defun-allowed: But it still annoyed me a bit that I could figure out how to do the quoting as a continuation
8:19:32
thijso
bjorkintosh: yes, ECL on android, using EQL5-Android (port of EQL5 for android, which is Qt5 for CL). It works, mostly, but there are still a lot of issues with it (such as segfaults...)
11:36:35
flip214
how would a CFFI callback function refer to variables in some outer lisp function? I've got a void* available that gets passed around, but I see no mention in CFFI about getting a closure or so.
11:53:39
Shinmera
flip214: you'll want to keep a table of your own that lets you get an object from that pointer/whatever.
12:06:25
lxbarbosa
Python 3.8 is out and now it almost is becoming a subset of Lisp :D (positional only parameters and assignment expressions)
12:13:00
flip214
Shinmera: hmmm... no. CFFI could allow to use a void* to "get back" to the lisp closures (as long as the implementation supports that too, of course)
12:41:59
p_l
theoretically it could provide callback to a closure in general, but yeah, implementation support needed
15:32:30
ebrasca
p_l: Here what I have done for now https://github.com/ebrasca/Mezzano/blob/ppc64le/compiler/lap-ppc64le.lisp
15:35:39
p_l
usually, for stack, you just declare some location (usually register) to hold "top" of the stack
15:36:31
p_l
when you want to push something on the stack, you increment/decrement (depends on ABI) that register, and write data into new location
15:38:49
p_l
(add *stack-register* *stack-register* 4) (STORE *stack-register* #|Here used for its value as address!|# #XDEADBEEF)
15:47:19
p_l
https://www.pvk.ca/Blog/2014/03/15/sbcl-the-ultimate-assembly-code-breadboard/ <--- this shows simple FORTH implemented into native code, including actually loading instructions into memory etc.
15:47:36
p_l
it still uses SBCL's VOP framework, so it might be not exact, but it might shine some light
15:48:45
ebrasca
I have read this https://github.com/ebrasca/Mezzano/blob/ppc64le/compiler/backend/x86-64/codegen.lisp codegen.