So I'm writing a custom parser so that I can read in code written in another language and translate it into Gambit (of course, not to textual S-expression, but consing together a data structure to feed to the Gambit interpreter or compiler).
How to I attach line numbers to the consed code so that the interpreter will be able to write line numbers from the original source code in error messages?
-- hendrik
Afficher les réponses par date
There is a format for this.
Once you deciphered it please document it here on the list.
Also Black Hole works with it. I guess the easiest thing is to follow |load|'s code path. and see what structure it actually passes on to eval or its functional equivalent.
(Also a route is using source objects.)
Mikael
2013/7/28 Hendrik Boom hendrik@topoi.pooq.com
So I'm writing a custom parser so that I can read in code written in another language and translate it into Gambit (of course, not to textual S-expression, but consing together a data structure to feed to the Gambit interpreter or compiler).
How to I attach line numbers to the consed code so that the interpreter will be able to write line numbers from the original source code in error messages?
-- hendrik
Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
Please see this message:
https://mercure.iro.umontreal.ca/pipermail/gambit-list/2013-June/006774.html
Marc
On 2013-07-27, at 4:26 PM, Hendrik Boom hendrik@topoi.pooq.com wrote:
So I'm writing a custom parser so that I can read in code written in another language and translate it into Gambit (of course, not to textual S-expression, but consing together a data structure to feed to the Gambit interpreter or compiler).
How to I attach line numbers to the consed code so that the interpreter will be able to write line numbers from the original source code in error messages?
-- hendrik
Gambit-list mailing list Gambit-list@iro.umontreal.ca https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
On Sat, Jul 27, 2013 at 09:36:50PM -0500, Marc Feeley wrote:
Please see this message:
https://mercure.iro.umontreal.ca/pipermail/gambit-list/2013-June/006774.html
Marc
I guess now I get to ask what ##source?, ##source-code, and ##source are.
And why in the test case, (< x 0) gets wrapped all at once, instead of wrapping <, x, and 0 separately. Is it just to test whether that big wrapping works as well as multiple little wrappings, or is something more subtle going on?
-- hendrik
On 2013-07-28, at 4:49 AM, Hendrik Boom hendrik@topoi.pooq.com wrote:
On Sat, Jul 27, 2013 at 09:36:50PM -0500, Marc Feeley wrote:
Please see this message:
https://mercure.iro.umontreal.ca/pipermail/gambit-list/2013-June/006774.html
Marc
I guess now I get to ask what ##source?, ##source-code, and ##source are.
And why in the test case, (< x 0) gets wrapped all at once, instead of wrapping <, x, and 0 separately. Is it just to test whether that big wrapping works as well as multiple little wrappings, or is something more subtle going on?
It shows that non-atomic forms are recursively tagged with the same source location.
Marc
On 2013-07-28, at 5:49 AM, Hendrik Boom hendrik@topoi.pooq.com wrote:
I guess now I get to ask what ##source?, ##source-code, and ##source are.
A "source" object represents a source S-expression tagged with location information. A source object has a source "code" (extracted with the ##source-code procedure) and a source "location" (extracted with the ##source-locat procedure). The reader (the read procedure) can be configured to return a source object for the datum that is read rather that the usual representation. For an example, see the end of this message:
https://mercure.iro.umontreal.ca/pipermail/gambit-list/2013-February/006424....
Marc