Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Languages, Programmingk, Geeky Question

Options
  • 08-11-2007 5:26pm
    #1
    Closed Accounts Posts: 345 ✭✭


    What are programming languages themselves written in ?


Comments

  • Registered Users Posts: 1,028 ✭✭✭Hellm0


    Haxx0r, or "L33t".

    also http://en.wikipedia.org/wiki/Compiler


  • Closed Accounts Posts: 345 ✭✭FindingNemo


    Hellm0 wrote: »

    I mean, what was the original C language for instance writtin in ?!
    Am I making sense

    what was assembly language written in,
    at some point does it boil down to ones and zeros, and when is that ?
    how does it get translated from 1's and 0's to assembly language


  • Registered Users Posts: 1,028 ✭✭✭Hellm0


    I mean, what was the original C language for instance writtin in ?!
    Am I making sense

    what was assembly language written in,
    at some point does it boil down to ones and zeros, and when is that ?
    how does it get translated from 1's and 0's to assembly language

    God dont make me remember computer architechture. C was written in assembler, if I remember correctly. Assembler itself is basically just above binary, it uses basic commands like "push","mov" etc to manipulate memory addresses etc. I'm no expert on the subject so feel free to do a little research yourself.

    But at the most basic level all the CPU deals with can be reduced to binary, so yes it is all 1's and 0's.


  • Registered Users Posts: 68,317 ✭✭✭✭seamus


    What are programming languages themselves written in ?
    Boringly enough, programming languages aren't really "written" so much as "designed".

    Some people get together and decide on the syntax for the language, the data types, how the language interacts with its operating environment, and all of the minutae you need to know before you can implement a programming language. No programming actually takes place in writing a language, most of it probably goes into a succession of large and boring documents.

    Once the language has been defined, then the programmers get to work on building a compiler that converts the human-readable language as specified in the above documents, into code readable by the computer or interpreter.

    I don't know a whole pile about compilers themselves. Many compilers are written in assembly code, many others are written in other languages (such as C). Then the compiler is compiled. :)
    It's not a chicken-and-egg scenario. The first compilers (to compile assembly) would have been written in binary. Programs written in binary wouldn't need to be compiled. You just try to run them and hope they do what they're supposed to. Scary times.


  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    Don't listen to them: computers are actually controlled by numkulls. Brainy runs the cpu. The language you code in is tells them what to do.


  • Advertisement
  • Registered Users Posts: 1,028 ✭✭✭Hellm0


    seamus wrote: »
    It's not a chicken-and-egg scenario. The first compilers (to compile assembly) would have been written in binary. Programs written in binary wouldn't need to be compiled. You just try to run them and hope they do what they're supposed to. Scary times.

    Brings to mind that episode of the simpsons where apu lets bart look at his "tick tac to" program, written in punch cards. Scary is too bloody right! Makes you appreciate debuggers lol.


  • Closed Accounts Posts: 345 ✭✭FindingNemo


    I'm really going to bug you guys.

    so assembly code like "push" and "move" ....

    something must have been written to say "if push is typed, push the fookin file" :-)

    I'd like to know what that something was and the something that wrote that and the something that wrote that and the something that wrote that and the something that wrote that and the something that wrote that and the something that wrote that

    and then jesus was born

    the big bang theory

    gravity

    macdonalds

    :-)


  • Registered Users Posts: 1,028 ✭✭✭Hellm0


    I think I know what your getting at Nemo. Its all very math based when you get down to the level of Binary. Stuff like number bases and boolean logic start to raise their ugly heads!

    Best just to think of them as "magic boxes"!


  • Registered Users Posts: 68,317 ✭✭✭✭seamus


    No, you've got it all wrong. Gravity came *after* the big bang. :)

    In reality though, binary is a series of ones and zeros that basically tell the CPU, "Do this with 1000". "Now do that with 10".

    If you want to know how the CPU interprets 1000111000110101 as "move 10" (for example), then you're getting out of software engineering and into electronic engineering.


  • Closed Accounts Posts: 345 ✭✭FindingNemo


    Hellm0 wrote: »
    I think I know what your getting at Nemo. Its all very math based when you get down to the level of Binary. Stuff like number bases and boolean logic start to raise their ugly heads!

    Best just to think of them as "magic boxes"!


    yeah, Just curious,
    for arguments sake if I wanted to write a programming language from scratch,
    where would you start.
    Would you go in search for an old pc from 1951 so you can write your stuff..
    or would you write one in c++ or something and have some type of mediation devide that translates c++ code into your code.

    for instance.

    if rs.recordcount <> 5 then
    msgbox "Number is not 5"
    end if


    to be

    if your recordset is not 5 then
    tell_the_user it's not fookin 5
    end bleedin if


  • Advertisement
  • Closed Accounts Posts: 345 ✭✭FindingNemo


    seamus wrote: »
    No, you've got it all wrong. Gravity came *after* the big bang. :)

    In reality though, binary is a series of ones and zeros that basically tell the CPU, "Do this with 1000". "Now do that with 10".

    If you want to know how the CPU interprets 1000111000110101 as "move 10" (for example), then you're getting out of software engineering and into electronic engineering.

    now that's interesting
    you freak :p


  • Registered Users Posts: 68,317 ✭✭✭✭seamus


    That's just a random series of ones and zeros by the way. :) It probably does nothing.


  • Closed Accounts Posts: 345 ✭✭FindingNemo


    seamus wrote: »
    That's just a random series of ones and zeros by the way. :) It probably does nothing.



    hehe..and I was just about to compile it...
    it's all very da vinci codish ...


  • Registered Users Posts: 1,636 ✭✭✭henbane


    You may find this zip file interesting. Also, the history of C.


  • Closed Accounts Posts: 345 ✭✭FindingNemo


    henbane wrote: »
    You may find this zip file interesting. Also, the history of C.

    very sweet, thanks for that,
    wife will love to see this as bed time reading ! :cool:


  • Registered Users Posts: 1,028 ✭✭✭Hellm0


    yeah, Just curious,
    for arguments sake if I wanted to write a programming language from scratch,
    where would you start.
    Would you go in search for an old pc from 1951 so you can write your stuff..
    or would you write one in c++ or something and have some type of mediation devide that translates c++ code into your code.

    for instance.

    if rs.recordcount <> 5 then
    msgbox "Number is not 5"
    end if


    to be

    if your recordset is not 5 then
    tell_the_user it's not fookin 5
    end bleedin if

    Hehe the man is right, once you get down to the binary your really moving into the electronic engineering area's.

    If you want to design your own language thats cool, there were no PC's back in the 50's, just very very big calculators, so thats not really a good place to start;P

    Without a degree in electronic engineering or a very low level oriented software degree your going to find it hard going to be honest. Is there a particular reason your looking to make one? There are alot of open source and ongoing projects on the web for new languages and I'm sure if you ask around in some of these communities you could get some good advice.


  • Closed Accounts Posts: 345 ✭✭FindingNemo


    Hellm0 wrote: »
    Hehe the man is right, once you get down to the binary your really moving into the electronic engineering area's.

    If you want to design your own language thats cool, there were no PC's back in the 50's, just very very big calculators, so thats not really a good place to start;P

    Without a degree in electronic engineering or a very low level oriented software degree your going to find it hard going to be honest. Is there a particular reason your looking to make one? There are alot of open source and ongoing projects on the web for new languages and I'm sure if you ask around in some of these communities you could get some good advice.



    Nah, no intention of writing my own mate, I was just curious that's all....
    end of day, nearly home time, weekend coming up ..
    it all adds up to me just been odd, or should I say 10101111.
    over and out


  • Registered Users Posts: 9,557 ✭✭✭DublinWriter


    What are programming languages themselves written in ?
    I think the correct way to phrase your question is "what are compilers for programming languages themselves written in?".

    Traditionally compilers were written in assembly language. Then when C/C++ came along, you could build better C/C++ compilers using C/C++ itself.

    I'm fairly certain the core VB compiler was written in C up to about VB6. Dunno what M$ are using for Visual Studio dot-feckin-net nowadays.

    Also, about 60% of Delphi was written with Delphi from V.3 and up.


  • Registered Users Posts: 2,150 ✭✭✭dazberry


    Also, about 60% of Delphi was written with Delphi from V.3 and up.

    The Delphi IDE is written in Delphi, the actually compiler is written in C or C++ (presumably the latter?). I think I'm one of the few Delphi programmers left on the planet :(

    D.


  • Registered Users Posts: 184 ✭✭stylers


    Compilers are complex beasts. compiler design is all about parsing strings and tokens into basic programming constructs and which can then be converted into assembly language nmemonics and thus into a binary format suitable for the cpu in question. The first compilers for C, basic, fortran etc. would have been coded in pure assembly, while later higher level languages would have been done in C, e.g. java. With the advent of home constructed computers and kits in the 70's, there were no suitable or easily available compilers for the CPU's involved, e.g. the 6502, 8080, z80 etc, so they had to be programmed in pure asembly in hex using a hex keypad and a couple of seven segment displays !. Then along came basic (albeit very basic).
    You can still program in assembler if you want. Most of todays RISC (reduced instruction set) microcontrollers such as the PIC are still sometimes programmed in assembly due to the relatively small amount of code and data memory available (think 4K of flash EEPROM and 256 bytes of RAM for a typical PIC16F874 device). normal C and other compilers would normally produce a several Kb's of code for a program that might fit a few hundred bytes of assembler if coded well. but there are now C and basic compilers which are designed to produce small efficient assembly..
    go on.. give it a try.. you know you've always wanted to get back to basics :D


  • Advertisement
  • Registered Users Posts: 1,726 ✭✭✭gerryk


    Dunno what M$ are using for Visual Studio dot-feckin-net nowadays.

    In an eating their own dogfood sort of way, it's developed using .NET itself, or C++ with .NET for the managed bits.

    One of the signs of a successful language is using it to write its own compiler.


  • Moderators, Technology & Internet Moderators Posts: 1,335 Mod ✭✭✭✭croo


    if you are interested in how 1s & 0s becomes useful logic I would recommend looking at [alan] Turing machines ... I came across this many years ago reading a great booked called "the emperors new mind". That was in the days before the web but I'm sure there is lots on this subject available via google.


  • Closed Accounts Posts: 71 ✭✭Mach


    Ok the simple asnswe is assemble lanuage , which hads a one to one relationship with the machine that the 1s and 0s, -5v +5v that switich on an off the tansistors in processor.


  • Registered Users Posts: 11,196 ✭✭✭✭Crash


    well, NEARLY a 1 to 1 relationship. for instance on a 68k processor, the command add.l r1, r2 will have a specific binary sequence associated with it - usually being first n number of digits are the OP code, specifying, in this case, that the command add is being used.

    then another sequence would specifiy the size of the items being operated on - byte, word or longword in 68k (in the case of the above example .l stands for longword) then areas in which to specify which of the cpu registers to use.

    This will then be interpreted using boolean logic AND's, OR's, XOR's etc. what will recieve a 1 or a 0, and thus responses will be returned using the same boolean logic.


  • Registered Users Posts: 428 ✭✭Joneser


    here you go, thought you might want to try this out, doesnt really explain much but gives you an idea http://www.paulschou.com/tools/xlate/


  • Closed Accounts Posts: 461 ✭✭markf909


    for arguments sake if I wanted to write a programming language from scratch,
    where would you start.

    if rs.recordcount <> 5 then
    msgbox "Number is not 5"
    end if

    Ok, step one would be to define the syntax, i.e the basic sentances that are legal in the language.

    This is done by defining a grammar (typically a context-free grammar) and this specifies how individual words (tokens in compiler lingo) are build up to form sentences.

    So from your example,
    [PHP]
    Tokens = [IF, THEN, END, <>, DOT , IDENTIFIER, STRING, NUMBER]
    [/PHP]

    You would then use a program like lex to write a lexical analyser that intrepretes the individual tokens.

    However the tokens on their own are no use unless they can be parsed into something more useful, so the next step would be to take the grammar and feed it to a program like yacc ( yet another compiler compiler ).

    So from your example,
    [PHP]
    program ::= if_statement;

    if_statement ::= IF expr THEN statement END IF

    expr ::= IDENTIFIER <> NUMBER

    statement ::= IDENTIFIER STRING
    [/PHP]

    From the grammar, the yacc program is capable of reading the program and building up a tree in memory of the structure of the program.

    Once the tree is built up, the meaning of the program can be gleamed.
    This is known as semantic analysis and figures out what exactly the program means.

    Once semantic analysis is complete, the code generation stage begins where the output of the semantic analysis is generated into assembly code which is about as low level as any program will get.

    Playing with compilers is a lot of fun :D

    EDIT : Some slides from the Dragon Book on compilers here for those that care
    http://dragonbook.stanford.edu/


Advertisement