[MUD-Dev] Storing tokens with flex & bison
J C Lawrence
claw at kanga.nu
Tue Jan 18 01:02:09 New Zealand Daylight Time 2000
On Sun, 2 Jan 2000 10:58:02 -0700
cg <cg at ami-cg.GraySage.Edmonton.AB.CA> wrote:
> [J C Lawrence:]
>> I've used recursive decent parsing for all my micro-languages for
>> the simple reason that I was never willing to confront lex/yacc
>> or their derivatives and I'd done all my interesting language
>> work before I ran across PCCTS et al.
> I'm in a similar situation - I did my first language before I'd
> heard of lex/yacc, let alone ANTLR/PCCTS. So, I've never learned
> any of those tools. This includes doing an ANSI C compiler at work
> several years ago.
Oooo! Pre- or post- ANSI? I made a stab at doing a pre-ANSI K&R
compiler once. It wasn't pretty. Harbison & Steele's pain was not
> JCL: why do you say recursive descent makes it hard to put a VM
> under a language?
<ponder> In an absolute sense it probably isn't. In practice
however I've found it to be, most likely because I tend to take
rather opportunistic advantage of shortcuts that I see en route that
don't map well to any sort of regular VM structure (and I'm big on
regularity). Additionally most of my experience has been doing
language for which there was no concept of doing a VM until very
late in the day, at which time I'd already ensured (as above) that
it was going to be painful...
Shoving a VM under a parser when the parser was not written with a
VM in mind is not fun. Yup.
> Byte-code execution really only makes sense, I believe, for a
> strongly typed language. If run-time checks and conversions are
> needed, they will likely cost far more time than the basic
> interpretation of the code, and so going to byte-code instead of
> staying with something more direct, could be a waste of time, in
> that byte-code won't speed execution up much.
This is one of those implementation dependent generalities that I
suspect is impossible to argue. In some cases, yes, I bet it will
give no or negative gain. I have little doubt however that in
others it will come out just fine.
Certainly cases on either side of the fence can be contrived.
That said: Python, Tcl, Perl, and REXX are all weakly typed, and all
now are byte-coded. I suspect that they saw some advantage.
J C Lawrence Home: claw at kanga.nu
----------(*) Other: coder at kanga.nu
--=| A man is as sane as he is dangerous to his environment |=--
MUD-Dev maillist - MUD-Dev at kanga.nu
More information about the MUD-Dev