Discuss My own programming language in the Other Programming Languages forum on Dev Shed. My own programming language A place for discussing programming languages not covered in specific forums such as Assembler, COBOL, etc. - you get the idea.
Posts: 2
Time spent in forums: 51 m 29 sec
Reputation Power: 0
Other Language - My own programming language
I have a question. I think I can make my own programming language in C#, though how can I compile that language, into something like html, javascript, or any other language? Can that be done with Microsoft Visual C#? If it cannot, then what can I use for that. I also have experience with C/C++.
Posts: 2
Time spent in forums: 51 m 29 sec
Reputation Power: 0
Quote:
Originally Posted by MrFujin
Can i ask why you want to create your own programming language, instead of using one that already exists?
Well, basically I would really like to learn how to make one, I really have a lot of time in my hands. Plus I think that it might be quite useful for specific aplications that may not need certain things.
Posts: 1,936
Time spent in forums: 1 Month 1 Week 2 h 12 m 42 sec
Reputation Power: 1312
Quote:
Originally Posted by freetrader0000
I have a question. I think I can make my own programming language in C#, though how can I compile that language, into something like html, javascript, or any other language? Can that be done with Microsoft Visual C#? If it cannot, then what can I use for that. I also have experience with C/C++.
Thanks in advance!
I have no idea what you're asking. You want to compile your programming language into HTML? What does that even mean?
Posts: 1,759
Time spent in forums: 1 Month 2 Weeks 2 Days 3 h 38 m 3 sec
Reputation Power: 1568
Compiler design is a fairly large project in and of itself; I would recommend learning about compilers with some subset of an existing language before going ahead with trying anything novel. This is a fairly standard project for an undergrad CS course on compilers (with the grad class being more of the same in more depth); there are several textbooks on the topic, with the Compilers: Principles, Techniques, and Tools being the one used by most courses. In the US at least, most public and university libraries have at least book on the subject.
There are also several online tutorials and pages on the subject floating around, of varying quality. Fortunately, there are several ways of doing this, so even an bad tutorial can be insightful.
Compiler Design in Python - a Linux Gazette article (though is should apply to any OS just fine), a bit sparse but it should prove helpful
Linkers and Loaders - freely available pre-release version of a textbook covering executable file formats, not directly relevant but useful to understand
You may also want to see the Compiler and Language Wiki, though that seems to be very much a work in progress.
To get you started:
compiling generally has three main stages, Lexical analysis (breaking the source code into a stream of tokens), parsing (processing the token stream for it's grammatical structure), and code generation (the resulting output, whether as an executable file or a source file for a different language). Most compilers use some sort of intermediate stage between the parser and the code generator (to separate the parts specific to the language from the parts specific to the target system, making it easier to re-target the compiler to a different system), and many have some sort of optimizer either between the parser and the code generator, or after the code generator, or both.
Adding OS design on top of that... that way madness lies. I of all people know that. Hasn't stopped me from working on and off on it for 15 years, and I doubt it will stop you, either, but I thought I'd at least warn you about the open-ended time sink such a project can become.
This thread describes part of a compiler I wrote for a course I took last year, including an attachment with the compiler source code (in Python) for you to look at, if you'd like. HTH.
EDIT: Fixed the links and markup. sigh This is what I get for rushing to post this before leaving.
FOR SALE: One ShapeSystem 2300 CMD, extensively modified for human use. Includes s/w for anthro, transgender, sex-appeal enhance, & Gillian Anderson and Jason D. Poit clone forms. Some wear. $4500 obo. tverres@et.ins.gov
Last edited by Schol-R-LEA : August 27th, 2009 at 11:57 AM.
Reason: Fixed broken links and markup
Posts: 1,759
Time spent in forums: 1 Month 2 Weeks 2 Days 3 h 38 m 3 sec
Reputation Power: 1568
Sorry 'bout that, Nathanpc. I've fixed that bad markup, and added some more information and links that I hadn't had time to include the first time through.