[plt-scheme] displaying errors in custom language levels

From: Robby Findler (robby at cs.uchicago.edu)
Date: Wed Jan 25 22:16:13 EST 2006

I, for one, am not able to guess what's going wrong from what you  
write below. But if you can produce a simple tool or perhaps produce  
a small example just using `eval' in the graphical language, I may be  
able to spot what's going wrong.

For general edification, DrScheme's red arrows and stacktrace in the  
bug icon window in the debugging languages work by using the  
errortrace annotations. In the non-debugging languages, they work by  
extracting the information that mzscheme records for the stack traces  
(see the mz manual for those details).

Are you talking about those errors or some other kind of errors?  
Syntax errors, perhaps? Those work by extracting fields from the exn  


On Jan 25, 2006, at 7:25 PM, Dave Herman wrote:

> The errors in my custom DrScheme language level aren't displaying  
> correctly. They're being reported at the #' expressions in my code  
> generator (unless I byte-compile the compiler, in which case  
> there's no location indicated). Errors should be reported at the  
> source location of the original source code. Ideally, I'd love to  
> have those nifty red arrows pointing out the control trace, but  
> most importantly I just want the error messages to highlight the  
> appropriate source.
> I'm not sure what information DrScheme needs in order to display  
> this information. Is the following incorrect?
> I generate code with source location information via datum->syntax- 
> object:
>     ;; has the `syntax-original?' property
>     (define original-stx
>       (read-syntax #f (open-input-string "here")))
>     ;; location->stx : loc -> syntax
>     (define (location->stx loc)
>       ...)
>     ;; build-syntax : syntax * loc -> syntax
>     (define (build-syntax stx location)
>       (datum->syntax-object #f stx (loc->stx loc ) original-stx))
>     ;; compile : Expr -> syntax
>     (define (compile expr)
>       (match expr
>         ...
>         [($ IfExpr loc t c a)
>          (with-syntax ([te (compile t)]
>                        [ce (compile c)]
>                        [ae (compile a)])
>            (build-syntax #'(if te ce ae) loc))]
>         ...))
> All the code generated by my compiler is built using build-syntax,  
> so that it all has source location information and the `syntax- 
> original?' property. I'm not sure if this is the correct approach.  
> Is this any different from using syntax/loc instead? When should/ 
> n't the syntax objects be original?
> I've had no luck with the docs so far, and I'm a little lost in the  
> algol-60 and profj examples.
> Thanks,
> Dave
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme

Posted on the users mailing list.