User: Password:
|
|
Subscribe / Log in / New account

Writing an Interpreter with PyPy, Part 1

Andrew Brown has posted the first part of a tutorial on how to use PyPy to create an interpreter for a new language. "Wouldn't it be nice if you could write your language in an existing high level language like, for example, Python? That sure would be ideal, you'd get all the advantages of a high level language like automatic memory management and rich data types at your disposal. Oh, but an interpreted language interpreting another language would be slow, right? That's twice as much interpreting going on. As you may have guessed, PyPy solves this problem."
(Log in to post comments)

Writing an Interpreter with PyPy, Part 1

Posted Apr 5, 2011 15:39 UTC (Tue) by JohnLenz (subscriber, #42089) [Link]

Here is an older blog post that somewhat explains what specializers like PyPy are doing.

Writing an Interpreter with PyPy, Part 1

Posted Apr 5, 2011 17:30 UTC (Tue) by robert_s (subscriber, #42402) [Link]

"Wouldn't it be nice if you could write your language in an existing high level language like, for example, Python?"

Keep in mind that if someone's writing their own language, it's probably because they can't stand any of the existing high level languages.

Writing an Interpreter with PyPy, Part 1

Posted Apr 5, 2011 17:44 UTC (Tue) by liljencrantz (guest, #28458) [Link]

As somebody who has been writing his own languages on and off for more than a decade, I can attest to this.

Writing an Interpreter with PyPy, Part 1

Posted Apr 6, 2011 2:04 UTC (Wed) by bk (guest, #25617) [Link]

NIH continues.

"It's like Python, only less mature and totally broken with bad syntax..."

Writing an Interpreter with PyPy, Part 1

Posted Apr 6, 2011 5:16 UTC (Wed) by wahern (subscriber, #37304) [Link]

There's a special kind of smugness that can only be enjoyed by people who have reinvented the wheel. And its highly addictive. I wrote a virtual machine for running SPF/DNS queries, and I'm still in awe of the thing.

That first step

Posted Apr 6, 2011 9:22 UTC (Wed) by ncm (subscriber, #165) [Link]

Hating every existing language is the first glimmer of awareness.

The second comes when you have started inventing languages meant to be better, and find that they are all worse, except the ones that are far, far worse. They share almost all the fundamental flaws of the language you hate most, but with extra fundamental flaws of your own. If you are perceptive enough, you discover that you have no idea what really makes a language useful.

The third comes when you realize that no one language is right for everything or everybody. You begin to think your only hope is a completely specialized language, such as one uniquely suited for left-handed color-blind cartoonists, or for cats. ("No one could reject a language made just for them!" But they do.) Real problems refuse to confine themselves to what your language is supposed to be best at, and keep washing over into where it is worst. ("But it has first-order functions, and it's case insensitive! Who really needs speed anyway?")

The fourth is when you realize that ideology works no better in language design than in governance, and let real problems constrain the design. Creativity thrives on constraints. Discovering what are the real problems turns out to be way harder, even, than getting a language to help solve them without itself becoming a worse problem. Poisonous complexity emerges at every turn. Formalisms stubbornly refuse to solve problems all by themselves, or prevent them.

Finally you realize that while luck is the lion's share of what makes a language successful, failure can always be traced to fatal flaws the designer was (and usually still is) blind to. First your language has to be good enough, which is nearly impossible, and then it has to be impossibly lucky on top of that. Then you have to work hard, too.

People use languages despite every detail, not because of them.

That first step

Posted Apr 11, 2011 16:33 UTC (Mon) by stevem (subscriber, #1512) [Link]

Well said :-)


Copyright © 2011, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds