KanZen wrote:
> You guys might find this amusing...
>
> http://www.onboard.jetbrains.com/articles/04/10/lop/
This (from page 3) is priceless:
...text-based programming languages are very difficult to extend. If
programs are stored as text, you need an unambiguous grammar to parse
the program. As features are added to the language, it becomes
increasingly difficult to add new extensions without making the language
ambiguous. We would need to invent more types of brackets, operators,
keywords, rules of ordering, nesting, etc.
I guess I've been fooling myself with DEFMACRO all along...
David Sletten
David Sletten <·····@slytobias.com> writes:
> KanZen wrote:
>
> > You guys might find this amusing...
> > http://www.onboard.jetbrains.com/articles/04/10/lop/
>
> This (from page 3) is priceless:
> ...text-based programming languages are very difficult to extend. If
> programs are stored as text, you need an unambiguous grammar to parse
> the program. As features are added to the language, it becomes
> increasingly difficult to add new extensions without making the
> language ambiguous. We would need to invent more types of brackets,
> operators, keywords, rules of ordering, nesting, etc.
>
> I guess I've been fooling myself with DEFMACRO all along...
No. He's right on the point. When your source is text, you need a lot
of syntax. When your source is sexps, you only need parentheses.
Remember, your macros don't work on:
"(if (eq a b) (print a) (setf b (read)))"
They work on:
+-----------------------------------------------------------------------+
| |
| +---+---+ +---+---+ +---+---+ +---+---+ |
| | * | * |-->| * | * |-->| * | * |-->| * |NIL| |
| +---+---+ +---+---+ +---+---+ +---+---+ |
| | | | | |
| v | | v |
| +----+ | | +---+---+ +---+---+ +---+---+ |
| | IF | | | | * | * |-->| * | * |-->| * |NIL| |
| +----+ | | +---+---+ +---+---+ +---+---+ |
| | | | | | |
| | | v v v |
| | | +------+ +---+ +---+---+ |
| | | | SETF | | B | | * |NIL| |
| | | +------+ +---+ +---+---+ |
| | | | |
| | | v |
| | | +------+ |
| | | | READ | |
| | | +------+ |
| | v |
| | +---+---+ +---+---+ |
| | | * | * |-->| * |NIL| |
| | +---+---+ +---+---+ |
| | | | |
| | v v |
| | +-------+ +---+ |
| | | PRINT | | A | |
| | +-------+ +---+ |
| v |
| +---+---+ +---+---+ +---+---+ |
| | * | * |-->| * | * |-->| * |NIL| |
| +---+---+ +---+---+ +---+---+ |
| | | | |
| v v v |
| +----+ +---+ +---+ |
| | EQ | | A | | B | |
| +----+ +---+ +---+ |
+-----------------------------------------------------------------------+
--
__Pascal Bourguignon__ http://www.informatimago.com/
The world will now reboot; don't bother saving your artefacts.