Thread: How did they write the C and C++ languages?

  1. #16
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    couldn't tell ya. I wouldn't mess with writing a compiler right now. why reinvent the wheel on that one. Besides I'd have to learn too much about Intel instruction set. No thanks.
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  2. #17
    Banned Troll_King's Avatar
    Join Date
    Oct 2001
    Posts
    1,784
    In additon I don't know the C++ Object Model. I just have the books. Nice covers. D&E has some trees painted on the cover, as I remember it last time I noticed it in my forest of books.

  3. #18
    Shadow12345
    Guest
    Well I mean...why not? It doesn't seem as impossible as I used to think...I used to believe compilers were the most difficult thing to design, but now that I think about it it doesn't seem all that hard. I mean I could think of a syntax, and then write a simple console app that does things based on what is written...you said there were compilers built with C for C, so why not make one wiht C++ for C++

    It actually just seems like wrapper or shell now that I think about it, and doesnt seem hard

  4. #19
    Banned Troll_King's Avatar
    Join Date
    Oct 2001
    Posts
    1,784
    Originally posted by FillYourBrain
    couldn't tell ya. I wouldn't mess with writing a compiler right now. why reinvent the wheel on that one. Besides I'd have to learn too much about Intel instruction set. No thanks.
    There is not enough standards in the computer industy. That's why someone like me has to kiss the Monopolies ass somewhat, but not entirely. I'm not going to bother with any API unless it is a nice one.

  5. #20
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    Originally posted by Shadow12345
    ...and doesnt seem hard
    more power to ya!

    seriously though. You'll find that just the parsing itself will be a pretty good challenge. Not impossible at all but it'll take you quite some time. The machine language step may not be too bad once you know the instruction set. If you choose to do any optimization, good luck.
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  6. #21
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    I would try to write an assembler first if I were you.
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  7. #22
    Shadow12345
    Guest
    an assembler...uhh...how is that different from a compiler, I mean compiler and assembler are synonomous to each other to most people

  8. #23
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    Assembly is a much more strict language. easier to parse. Also much easier to convert to machine language as it is just a readable interpretation of machine language. high level languages such as C++ need a lot of instructions to represent a given line of code.
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  9. #24
    Banned Troll_King's Avatar
    Join Date
    Oct 2001
    Posts
    1,784
    It would be great to write your own langauge, but it seems that writing a non trivial language would be difficult. You would definatley have to understand the software and hardware architectures that you are building upon. What was this about intel?

  10. #25
    Banned Troll_King's Avatar
    Join Date
    Oct 2001
    Posts
    1,784
    Better yet, don't just write a compiler, write an OS. Wait a minute, what comes first. Oh and when you write a compiler, make sure to write a framework that utilized an intermediate language.

  11. #26
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Technically, you dont need a licene to make a compiler for an M$ system....System calls are made from dlls....nothing too sinister....you load the dll....find the function...issue a call statement.....

    As I see it, as long as the exe you produce gives the loader what info it wants, your away!! (of course I guess its a lot more complex in implmentation.. ::jeez...a lot more complex:: )

    Look up FASM...it's a 32 bit assembler written by a guy called Privolov....he hangs around Win32ASM and updates the product as how the FASM users on the board want it......he isnt Microsoft and he as far as I know, he doesnt have access to the code but his assembler produces Windows programs....

    There are somethings that I guess M$, Borland and the other vendors do get together for. If you read Matt Pietrek's article on Structured Exception Handling, he says that it was a feature implements by both Boraland and M$ in thier tools, it worked the same, but it was undocumented (the only way people saw how it was implemented in assembler was to dissassemble). But even then, I doubt Borland was allowed full access to the windows source......only what M$ wanted to give...

  12. #27
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    well certainly MS had to get borland a version of MFC. You couldn't support that without microsoft's help.
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  13. #28
    Shadow12345
    Guest
    okay, wow, um. slow down martha...I understand why an assembler would best to write. In fact I think that is what i was thinking of all along, a more 'strict language', or lower level language, seems much more realistic than something compared to C. I just didn't know the term assembler, but now I do.


    Troll_King what do you mean by 'it seems that writing a non trivial language would be difficult' what do you mean non trivial? Is an assembly language non trivial? Does that mean it can't use conditional statements (such as ifs and whiles?)

    I don't know any asm.

    And what do you mean write a framework that utilizes an intermediate language...do you mean like databasing with SQL? SQL is kind of like an intermediate/simple language used for controlling how data is accessed from databases.

  14. #29
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    shadow I think he was being sarcastic with all that talk. TK gets that way sometimes. occasionally you just have to ignore one or two TK posts. He's been pretty informative for the most part though in this thread.

    and yes, assembly would be trivial in that there isn't much abstraction to it.
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  15. #30
    Banned Troll_King's Avatar
    Join Date
    Oct 2001
    Posts
    1,784
    I imagine that some people can get their hands on the Microsoft source, but changing the implimentation would be illegal. Sure, all you would need is Win32 since that is the only way to run a process 'safely', but you might also need a deeper knowledge than the interface desciption provide on MSDN.

    I agree, Microsoft is not the platform to use for writing your own systems, at least not compiler. With Linux it is a different story. A programmer has unlimited access to the implementation as well as the freedom to understand and adapt it to his needs.

Popular pages Recent additions subscribe to a feed