BPsite Forums
November 21, 2024, 05:10:56 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: BPSITE FOREVER!
 
   Home   Help Search Members Login Register  
Pages: 1 [2]
  Print  
Author Topic: Compiler  (Read 20802 times)
smi256
Hero Member
*****
Offline Offline

Posts: 2287



View Profile
« Reply #15 on: March 28, 2008, 02:43:39 AM »

What an unhappy SS.  What would you like to have for a language?
Logged

*was here
SS
Administrator
Hero Member
*****
Offline Offline

Posts: 10393



View Profile WWW
« Reply #16 on: March 28, 2008, 08:34:17 PM »

Code that is more self-explanatory, and easier to read without putting silly "//end if" style comments in.

Like when you've got stuff like this:
Code:
for (x=0;x<=10;x++)
{
    if (x == something)
    {
        for (y=0;y<=whatever;y++)
        {

            doStuff()

            if (x == y)
            {
                doMoreStuff()
            }

        }

    }
    else
    {
        while (x < y)
        {
            doEvenMoreStuff()
        }
    }
}



It'd be easier to read if it was more like this:

Code:
x:loop(0..10)

    if (x = something)

        y:loop(0..whatever)

            doStuff()

            if (x = y)
                doMoreStuff()
            /if

        /y:loop

    else
        while (x < y)
            doEvenMoreStuff()
        /while
    /if
/x:loop



And similar things to that.

Syntax that is intuitive and sensible, and thought out properly.
Logged

Peter 'SpectralShadows' Boughton,
Seeker of Perfection, BPsite Sitelord.

Till shade is gone, till water is gone, into the Shadow with teeth bared, screaming
defiance with the last breath, to spit in the Sightblinder's eye on the Last Day.
smi256
Hero Member
*****
Offline Offline

Posts: 2287



View Profile
« Reply #17 on: March 31, 2008, 01:05:26 AM »

It might be fun to write an interpreter to convert your syntax to C syntax, then just feed that to a normal C compiler.  The problem is that you'd still have to declare data types (maybe make everything type int, and rewrite the libraries...), and make the distinction between assignments and comparisons.
/me remembers how many sleepless nights he spent because of his compilers class  :ph34r:  
Logged

*was here
SS
Administrator
Hero Member
*****
Offline Offline

Posts: 10393



View Profile WWW
« Reply #18 on: March 31, 2008, 07:10:31 PM »

Quote
and make the distinction between assignments and comparisons.
It does already.
Comparisons use Equals signs, because that's what the equals sign is for.
Assignment use Colons, because it's the simplest valid single character.

SheepAreAnimals : Sheep.Type = "Animal"

Go write me a super compiler that lets me use good syntax to write C stuff. Cheesy
Logged

Peter 'SpectralShadows' Boughton,
Seeker of Perfection, BPsite Sitelord.

Till shade is gone, till water is gone, into the Shadow with teeth bared, screaming
defiance with the last breath, to spit in the Sightblinder's eye on the Last Day.
smi256
Hero Member
*****
Offline Offline

Posts: 2287



View Profile
« Reply #19 on: March 31, 2008, 11:32:35 PM »

I wonder if this will be one of my "projects" this "quarter"  Wink
Sounds interesting, I'll try it.

 :sheep:  
Logged

*was here
SS
Administrator
Hero Member
*****
Offline Offline

Posts: 10393



View Profile WWW
« Reply #20 on: April 02, 2008, 11:42:17 PM »

Have you done it yet? Cheesy
Logged

Peter 'SpectralShadows' Boughton,
Seeker of Perfection, BPsite Sitelord.

Till shade is gone, till water is gone, into the Shadow with teeth bared, screaming
defiance with the last breath, to spit in the Sightblinder's eye on the Last Day.
smi256
Hero Member
*****
Offline Offline

Posts: 2287



View Profile
« Reply #21 on: April 04, 2008, 12:35:07 AM »

I'm still unpacking!! gosh!! Shocked
 Tongue
I'll make a converter; though I am wondering how much error checking I'm going to have to check.  I'll find out the further I get into this. :-)
« Last Edit: April 04, 2008, 12:36:57 AM by smi256 » Logged

*was here
SS
Administrator
Hero Member
*****
Offline Offline

Posts: 10393



View Profile WWW
« Reply #22 on: May 16, 2008, 08:01:55 PM »

Any progress? Smiley
Logged

Peter 'SpectralShadows' Boughton,
Seeker of Perfection, BPsite Sitelord.

Till shade is gone, till water is gone, into the Shadow with teeth bared, screaming
defiance with the last breath, to spit in the Sightblinder's eye on the Last Day.
Pages: 1 [2]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!