Re: New bytecode assembly language to play with
- From: nottysymbaz@xxxxxxxx
- Date: 14 Apr 2007 10:22:20 -0700
On Apr 14, 6:52 am, "cr88192" <cr88...@xxxxxxxxxxxxxxxxxx> wrote:
an example would be that of eliminating many chars (commas, semicolons,
function braces, ...) in cases where they are not useful. in my lang, I had
typically partly filled this void by using whitespace-sensitivity instead.
ie, this is valid:
x={1 2 -3 -5}
as is:
fib(x) if(x>2)fib(x-1)+fib(x-2) else 1;
I've thought about this one a lot. Essentially a function body is an
expression (either a single expression or a {} block which is also an
expression). IMO, it's easier from a programmer's point of view to
have one consistent way to write function bodies. Suppose a function
isn't working properly so we want to temporarily insert some debugging
stuff:
fib(x) = print(x); if ...
Ideally, it would be nice to have consistent notation for if-else and
loop bodies as well.
On the other hand, I agree that begin/end, {}, etc. are sometimes are
visual clutter, and are not needed to make programs human readable or
parsable.
(albeit this example often includes types as my script VM could optimize for
known types in many cases).
now, what would imo threaten readability is if some do like some langs have
done, and strip it down beyond what is reasonable, ie something like:
fib x = if x>2 fib x-1 + fib x-2 1
which imo hurts readability because it is no longer visually obvious what is
going on.
That's not only less readable, but less parsable. The parser has to
look up the arity of fib (is the last part "fib(x-2, 1)" or "fib(x-2)
then 1"). Now the grammar is context-sensitive. Maybe a human can
figure it out for the fib example, but what about using a library
someone else wrote. How would it handle optional/rest arguments? I
thought Logo had a nice, user-friendly syntax until I played with it a
bit and discovered it has this annnoying property.
Still searching for a programmer-friendly and parser-friendly syntax
model. Maybe python-style significant indentation is the way for me to
go. But what to do with the damn TAB character?
Brad.
.
- Follow-Ups:
- Re: New bytecode assembly language to play with
- From: cr88192
- Re: New bytecode assembly language to play with
- From: Robbert Haarman
- Re: New bytecode assembly language to play with
- References:
- Re: New bytecode assembly language to play with
- From: Chapter33
- Re: New bytecode assembly language to play with
- From: Marco van de Voort
- Re: New bytecode assembly language to play with
- From: Chapter33
- Re: New bytecode assembly language to play with
- From: Robbert Haarman
- Re: New bytecode assembly language to play with
- From: Chapter33
- Re: New bytecode assembly language to play with
- From: Torben Ægidius Mogensen
- Re: New bytecode assembly language to play with
- From: cr88192
- Re: New bytecode assembly language to play with
- From: Marco van de Voort
- Re: New bytecode assembly language to play with
- From: cr88192
- Re: New bytecode assembly language to play with
- Prev by Date: Re: New bytecode assembly language to play with
- Next by Date: Re: New bytecode assembly language to play with
- Previous by thread: Re: New bytecode assembly language to play with
- Next by thread: Re: New bytecode assembly language to play with
- Index(es):
Relevant Pages
|