[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: for
> Sounds like es needs macros. Scheme has some good ideas on that score.
yes & yes. byron and i have been looking very hard at kent dybvig's
extend-syntax (or whatever the hygenic version is called) system for scheme
as a branching off point for es.
the central issue that distinguished what we want from current scheme state
of the art is that the macro systems from lisp derived language almost alway
want to work off atoms that appear in head position, where we're dealing
with some infix, some prefix, and some postfix forms.
what we're going to need are some rules that allow us to say
syntax a "|" b -> %pipe {a} 1 0 {b}
syntax cmd "&" -> %background {cmd}
syntax "for" "(" var "=" values ";" ... ")" body ->
let (var = ; ...)
while {} {
{
if {~ $#values 0} {
break
}
var = $values(1)
values = $values(2 ...)
} ...
body
}
but also add some precedence rules and have the grammar reconfigure itself
on the fly. i'd call it close to state of the art, as well as a substantial
redesign for our current yacc-driven interpreter.
paul
ps: pardon the ad hoc syntax; i'm making things up as i go along.