Go Back   Science Forums
View Single Post
Old 04-23-2009   #15 (permalink)
Pyrotex's Avatar
Pyrotex
Slaying Bad Memes


Location:
Houston, Texas
Latest blog entry:
 
Pyrotex has a reputation beyond reputePyrotex has a reputation beyond reputePyrotex has a reputation beyond reputePyrotex has a reputation beyond reputePyrotex has a reputation beyond reputePyrotex has a reputation beyond reputePyrotex has a reputation beyond reputePyrotex has a reputation beyond reputePyrotex has a reputation beyond reputePyrotex has a reputation beyond reputePyrotex has a reputation beyond repute
Send a message via MSN to Pyrotex
 



Not Ranked  0 score     
Re: Self-Referential Language?

Reminds me of something that happened long ago at Texas Instruments.

My co-workers and I programmed in straight assembler. But we wanted a higher level language to play with, hoping it would make us more productive. We all tried our hand at it, but our lead programmer came up with something novel -- he took the breakdown structure (BDS) of an existing language -- a very simple one -- and wrote a small assembly program that read in the BDS as input -- and then it would read in any program written in that higher level language, and reduce it to assembler.

I don't know what they call a BDS nowdays, but it looked something like this:

STATEMENT :== {ARITH_STATEMENT|IF_STATEMENT|LOOP_STATEMENT|begin |stop}
ARITH_STATEMENT :== {[SIGN] TOKEN OP ARITH_STR|ARITH_STR}
TOKEN :== {VARIABLE|INTEGER|REAL}
OP :== {+|-|*|/}
ARITH_STR :== {(ARITH_STR)|TOKEN|TOKEN OP TOKEN}
...

and so forth. Words in all upper caps are part of the BDS definition of the hi-level language. Actual key words in the hi-level language are lower case, like "begin", "stop", "call", "if" and so forth. The vertical bar, |, is read as "or". So, OP could be "+" or "-" or "*" or "/".

We got to playing with this, writing little routines in our new hi-level language (HLL) until somebody realized that the BDS text was in a buffer in the computer while executing the HLL. It was trivial then to make a small adjustment in the BDS. If I remember correctly, we modified this line:

TOKEN :== {VARIABLE|INTEGER|REAL|LANG}

A "LANG" as we called it, could be any line in the BDS definition!

Now, in our HLL, we could write statements such as:

BDS(7) = "OP :== {+|-|*|/|^}"
so that
OP :== {+|-|*|/}
became
OP :== {+|-|*|/|^}

We just added a new operator, ^ !!!!

This meant that in mid-program, we could change the rules of the language and use the new rules immediately.
Eventually, we got it so we could add or delete options from any given line of BSD without having to redefine the whole line. We did this by defining a few new lines of BSD which gave us operators for selecting a specific option within an existing BSD line, and for searching the BSD line by line, option by option.

We had a LOT of fun doing this, but it didn't come to much. We didn't have the time to spend all day experimenting with it, and producing something that wouldn't crash the whole computer was a really big challenge.

But the possibilities...


----------------
Hypography Forums Moderator
-- - - - - -
What concerns me is not the way things are, but rather the way people think things are.
Epictetus, Greek Philosopher
The map is NOT the territory.
Korzybski, Polish-American Philosopher

Last edited by Pyrotex; 04-23-2009 at 03:42 PM..
Reply With Quote
 
» Advertisement
» Current Poll
Who's the sexiest man alive? Johnny Depp or Robert Pattinson?
Johnny Depp - 30.00%
3 Votes
Robert Pattinson - 0%
0 Votes
Someone else (please specify) - 40.00%
4 Votes
I'm too macho to think a guy is sexy - 30.00%
3 Votes
Total Votes: 10
You may not vote on this poll.


All times are GMT -8. The time now is 04:29 PM.

Hypography?

Hypography [n.]: A combination of "hyperlink" and "bibliography" - ie, a list of links to electronic documents. Comparable to discography and bibliography, but not cartography.

We have been online since May 2000, and aim to be the best place to find and share science-related content of all kinds.

Share the love!

Please add more science to your life. Use our RSS feeds on your blog, your portal, or your favorite feedreader!


Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Copyright © 2000-2009 Hypography
Part of the Hypography - Science for Everyone Network