Re: [racket] Metaprogramming with scheme

2010-06-25 Thread Valeriya Pudova
The errortrace library is good but for development time not for this case. Also it does not tell error location for each function anyway. Probably because continuation created not for each function. But I found another interesting thing. The error message in DrRake and command line rake are

Re: [racket] Metaprogramming with scheme

2010-06-25 Thread Valeriya Pudova
I suppose the errortrace library might give you more location information. I have never used it so I can't say much more than read the docs and/or hope someone else replies. HTH, N. The errortrace library is good but for development time not for this case. Also it does not tell error lo

Re: [racket] Metaprogramming with scheme

2010-06-23 Thread Noel Welsh
On Wed, Jun 23, 2010 at 1:44 PM, Valeriya Pudova wrote: > Looks not bad. But if error will be at the top level ... > (+ 1 "2") > > Then error message is not informative > > +: expects type as 2nd argument, given: "2"; other arguments were: > 1 > C:\Racket\collects\racket\private\map.rkt:45:11: fo

Re: [racket] Metaprogramming with scheme

2010-06-23 Thread Valeriya Pudova
On 23.06.2010 16:44, Valeriya Pudova wrote: In case if foo.ss will have (display (foo 1 2)) the error message will be should be text: In case if foo.ss will have (display (foo 1 "2")) the error message will be _ For list-related administrative ta

Re: [racket] Metaprogramming with scheme

2010-06-23 Thread Valeriya Pudova
I want share the my current test code. But this code have one issue. (define-syntax (baz stx) (syntax-case stx () ((_ a b) #'(* a b (define (bar a b) (list (+ a b))) (define (foo a b) (car (bar a b))) (display (foo 1 2)) ;; can be (foo 1 "2") to produce exception (display (baz

Re: [racket] Metaprogramming with scheme

2010-06-23 Thread Valeriya Pudova
On 23.06.2010 14:13, Noel Welsh wrote: On Wed, Jun 23, 2010 at 5:39 AM, Valeriya Pudova wrote: Last quoestion. Is there any way to define error-display-handler to printout the back trace even if there are default exception case? I think I don't understand the question. Every except

Re: [racket] Metaprogramming with scheme

2010-06-23 Thread Noel Welsh
On Wed, Jun 23, 2010 at 5:39 AM, Valeriya Pudova wrote: > Last quoestion. Is there any way  to define error-display-handler to > printout the back trace even if there are default exception case? I think I don't understand the question. Every exception contains continuations marks, so it should be

Re: [racket] Metaprogramming with scheme

2010-06-22 Thread Valeriya Pudova
> (with-input-from-file "foo.ss" > (lambda () >(parameterize ([error-display-handler (lambda (name . stuff) > (printf "Got ~a ~a\n" name stuff))]) > (eval-syntax (read-syntax 'foo.ss) Last quoestion. Is there any way to define error-display-handler to printout the back trace eve

Re: [racket] Metaprogramming with scheme

2010-06-22 Thread Valeriya Pudova
On 22.06.2010 11:34, Eli Barzilay wrote: (define (foo3 x) (/ x "1")) (define (foo2 x) (foo3 x)) (define (foo1 x) (list (foo2 x))) (define (foo0 x) (car (foo1 x))) (+ 1 (foo0 3))

Re: [racket] Metaprogramming with scheme

2010-06-22 Thread Eli Barzilay
On Jun 22, Valeriya Pudova wrote: > > (define (foo a b) >(for-each (lambda (e) (display e)(newline)) > (continuation-mark-set->context (current-continuation-marks > > (define (bar a b) >(foo a b)) > > (bar 1 2) > [...] > > Interesting. There are no the function bar in the backtrace

Re: [racket] Metaprogramming with scheme

2010-06-22 Thread Valeriya Pudova
The continuation marks included in the exception are effectively a stack trace, and you can convert them into locations. See the docs. :) Reading about continuation marks. Great feature those continuation marks. But does not looks helpful this case. To be able to get mark i should set

Re: [racket] Metaprogramming with scheme

2010-06-22 Thread Noel Welsh
On Mon, Jun 21, 2010 at 4:25 PM, Valeriya Pudova wrote: > That the problem. The location will be location inside foo but not location > where foo was called from The continuation marks included in the exception are effectively a stack trace, and you can convert them into locations. See the docs.

Re: [racket] Metaprogramming with scheme

2010-06-22 Thread Valeriya Pudova
On 22.06.2010 10:40, Valeriya Pudova wrote: The continuation marks included in the exception are effectively a stack trace, and you can convert them into locations. See the docs. :) Reading about continuation marks. Great feature those continuation marks. But does not looks helpful thi

Re: [racket] Metaprogramming with scheme

2010-06-22 Thread Valeriya Pudova
On 22.06.2010 9:31, Noel Welsh wrote: On Mon, Jun 21, 2010 at 4:25 PM, Valeriya Pudova wrote: > That the problem. The location will be location inside foo but not location > where foo was called from The continuation marks included in the exception are effectively a stack trace, a

Re: [racket] Metaprogramming with scheme

2010-06-21 Thread Robby Findler
Actually it does but it is diasabled by default. But the point was that you would not do it that way but instead use the lang and macro system to implement your translation. Robby On Monday, June 21, 2010, Valeriya Pudova wrote: > On 21.06.2010 18:32, Robby Findler wrote: > > I haven't followed

Re: [racket] Metaprogramming with scheme

2010-06-21 Thread Valeriya Pudova
On 21.06.2010 18:25, Noel Welsh wrote: On Mon, Jun 21, 2010 at 2:41 PM, Valeriya Pudova wrote: There are two issues. First: what if the file foo.ss will have defined function foo. (define (foo a b) (+ a b))) (foo 1 2) It makes error: Got compile: unbound identifier (and no #%app syntax

Re: [racket] Metaprogramming with scheme

2010-06-21 Thread Valeriya Pudova
On 21.06.2010 18:32, Robby Findler wrote: I haven't followed this thread too closely but if you can tolerate your "a.ss" file having a "#lang" line at the top that may make your life overall much easier (the Racket tools all work better when you are explicit about the language you are programming

Re: [racket] Metaprogramming with scheme

2010-06-21 Thread Robby Findler
I haven't followed this thread too closely but if you can tolerate your "a.ss" file having a "#lang" line at the top that may make your life overall much easier (the Racket tools all work better when you are explicit about the language you are programming in). Robby ___

Re: [racket] Metaprogramming with scheme

2010-06-21 Thread Noel Welsh
On Mon, Jun 21, 2010 at 2:41 PM, Valeriya Pudova wrote: > There are two issues. > > First: > > what if the file foo.ss will have defined function foo. > > (define (foo a b) (+ a b))) > (foo 1 2) > > It makes error: > Got compile: unbound identifier (and no #%app syntax transformer is bound) > (#(s

Re: [racket] Metaprogramming with scheme

2010-06-21 Thread Valeriya Pudova
> > name space > > where are defined methods "define-fsm", "define-state", "on-event" and > "go" > > > > But this case each of those methods will not have the syntax object of > the > > evaluated expression. > > And in case if it will find and error it could not message about error's > > location.

Re: [racket] Metaprogramming with scheme

2010-06-21 Thread Noel Welsh
Please reply to the list; you'll get more help that way. (Also, I'll ignore your emails if you don't.) On Mon, Jun 21, 2010 at 12:29 PM, Valeriya Pudova wrote: > The question is: when in the eval-synax process there will be called some > function how that function can to reffer to the current syn

Re: [racket] Metaprogramming with scheme

2010-06-21 Thread Noel Welsh
Please reply to the list; you'll get more help that way. On Mon, Jun 21, 2010 at 12:14 PM, Valeriya Pudova wrote: > (eval-syntax (file->syntax "a.ss")) Look up read-syntax. > lets imagine the function 'define-fsm' was called. And "some-condition?" > informs that there are syntax error in the so

Re: [racket] Metaprogramming with scheme

2010-06-21 Thread Noel Welsh
On Sat, Jun 19, 2010 at 10:00 AM, Valeriya Pudova wrote: > The easiest way to do this task can be: Just evaluate the file "a.ss" in the > name space > where are defined methods "define-fsm", "define-state", "on-event" and "go" > > But this case each of those methods will not have the syntax object

[racket] Metaprogramming with scheme

2010-06-19 Thread Valeriya Pudova
Hello Good People I have the task to make the translator from metalanguage A to the metalanguage B. My app should open file "a.ss", parse and translate to the file "b.ss". At the translation time the app should: 1) Expand all macro definitions of the file "a.ss" and evaluate all definitions witch