guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Various syntax


From: Manuel Giraud
Subject: Various syntax
Date: 20 Sep 2001 10:05:14 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

Hi,

I've think about something that would be great to have not only in
guile but in Scheme in general. I'd like to define syntax that are not
only prefix and Lisp-ish syntax. For example, I may want to create a
C-like syntax. Here an example to be more explicit : 

;;; Defining a C-like if
(define-syntax if
  (syntax-rules ({ } else)
    ([if test { b1 } else { b2 }]     ; the pattern
     (if test b1 b2)                  ; rewriting rule
     )))

;;; Using it
if (= 6 7) {
  (* 6 7)
} else {
  (* 2 21)
}

Thinking a bit about that, leads me to the conclusion that it would
really complex : for example, each syntax defined may carry its own
lexer/parser; but how can I recognize a the syntax used before I've
already parse it ???

This mail exists just to initiate a discussion about the
feasibility/impossibility of this idea. If this is something already
discussed, pointer will be greatly appreciate.

-- 
"Never imagine yourself not to be otherwise than what it might appear
to others that what you were or might have been was not otherwise than
what you had been would have appeared to them to be otherwise"
  The Duchess

_Manuel Giraud_



reply via email to

[Prev in Thread] Current Thread [Next in Thread]