Create a new programming language?
-
Nagy Vilmos wrote:
Not many modern languages are domain specific
Yeah, except the one that the entire Web is built on (HTML). And the one we use to access databases (SQL), and the one's we use to script (PowerShell, BASH, ...), and ...
HTML isn't a programming language. It isn't Turing complete, and thus can't be used to implement arbitrary algorithms.
-
Is there a way to create a programming language without using an existing programming language? or to create it from scratch or create it in machine/binary code or assembly code? Also some other questions that are optional that you may answer: - Is there a way for a programming language to be "all-purpose"? (for example this programming language can be used to make games, models, simple applications (like calculators) or anything and EVERYTHING you can imagine) - Is there a way for a programming language to be "self-sustained"? (for example you don't need more than one language like "Lua" to run a massive game like "World of Warcraft" or "Command and Conquer" or any of those games out there or this language does not need support of any kind to run) Any answers will be fully-appreciated. :) Regards, Brandon Proud Member of "The Code Project"
-
Member 8331185 wrote:
for every value in the statement Hello my name is john count the number of spaces
this would return 4This stretches the capabilities of a compiler beyond reason. If I count the number of spaces in the statement, it comes to 15. That's because I am only seeing one continuous run-on statement.
Member 8331185 wrote:
The disadvantages - its quite terse and takes a lot of typing.
Actually, it's quite verbose. "get answer:Hello my name is john" is terse and also requires psychic capabilities. :) (Get me the answer I want, not the answer to the question I ask. Intuitively know I meant "it's" when I wrote "its". Come to think about it, WORD is pretty good at that now.)
-
Is there a way to create a programming language without using an existing programming language? or to create it from scratch or create it in machine/binary code or assembly code? Also some other questions that are optional that you may answer: - Is there a way for a programming language to be "all-purpose"? (for example this programming language can be used to make games, models, simple applications (like calculators) or anything and EVERYTHING you can imagine) - Is there a way for a programming language to be "self-sustained"? (for example you don't need more than one language like "Lua" to run a massive game like "World of Warcraft" or "Command and Conquer" or any of those games out there or this language does not need support of any kind to run) Any answers will be fully-appreciated. :) Regards, Brandon Proud Member of "The Code Project"
There is a relatively short and cheap bootstrapping chain: 1) Implement the simplest Forth on top of machine codes. With a bit of experience it can be done in several days. 2) On top of this Forth, implement a simple Lisp interpeter 3) Using the Lisp interpreter, implement Lisp compiler and re-bootstrap it 4) Grow this Lisp using macros to the stage when it is easy to implement any kind of compilers. This will include building parser generators (e.g., something similar to Parsec), tree visitor generator (in line with Haskell library "Scrap your boilerplate"), number of graph algorithms (e.g., dominator tree building, etc.) 5) Implement an intermediate VM using that Lisp, something similar to LLVM (i.e., SSA-based), implement a native backend for this VM. 6) Implement any language you like on top of that VM All the steps are relatively trivial and well-defined, and there is a lot of papers and books that will help on each stage.
-
Do you know any books or references about binary or machine code? or perhaps assembly code? Like lets say a book that says a line of 1's and 0's for each command(s)...
What language would you like that book in - would binary suit you? ;) But seriously: machine code is, as the name implies, machine dependend. Or, more to the point, dependent on the CPU. AMD and Intel have different machine code, as does the PowerPC line, or the various risk processors. New multicore processors have commands that none of the older have, simply because they don't have multiple cores. Basically, every CPU that comes with a new feature, comes with a new machine command, or several of them. So, if you have a specific CPU in mind, like that in your own computer, find out it's precise name, and look for books or articles on that CPU. I think I still somewhere have an MC 68000 Assembler book for the like-named processor, back from the time when I owned an AMIGA. ;)
-
Is there a way to create a programming language without using an existing programming language? or to create it from scratch or create it in machine/binary code or assembly code? Also some other questions that are optional that you may answer: - Is there a way for a programming language to be "all-purpose"? (for example this programming language can be used to make games, models, simple applications (like calculators) or anything and EVERYTHING you can imagine) - Is there a way for a programming language to be "self-sustained"? (for example you don't need more than one language like "Lua" to run a massive game like "World of Warcraft" or "Command and Conquer" or any of those games out there or this language does not need support of any kind to run) Any answers will be fully-appreciated. :) Regards, Brandon Proud Member of "The Code Project"
A guy on a forum I frequently browse is building his own programming language mainly for web development as an experiment. It doesn't fit your "without using an existing programming language" criteria (as it is written in Java and will run on top of the Java Virtual Machine), but still an interesting topic. http://webdevrefinery.com/forums/topic/9856-tangle/
-
I have always wanted to see a language based on the English language but without all the grammatical bollocks so that you could program almost as easily as you would speak I.E. for every value in the statement Hello my name is john count the number of spaces this would return 4 what is the length of the statement Hello my name is john this would return 21 add 5 to the length of the statement Hello my name is john and store the result in container name this would store the value 26 in the variable called name add 36 to the container name would result in 62 being stored in the variable called name. Empty the container name. would clear out the variable called name Empty all containers would clear the contents of all variables in memory. You get the idea...... The disadvantages - its quite terse and takes a lot of typing. The advantages - any idiot can walk up to a PC and provided they can read and write in the English language they should be able to begin programming. It stops the leaning towards the txt spk shortening of the English language used by mobile phone users and might actually stem the tide a wee bit. Its completely readable and pretty much self commenting, again if you can read in the english language you can read a program. It should be relatively easy to write a compiler for due to the ease of the syntax. Your thoughts?
Member 8331185 wrote:
for every value in the statement Hello my name is john count the number of spaces
The problem with such a statement is that a parser would need to distinguish between specific commands and properties such as 'for every', 'count' or 'spaces' and the data that is to be processed, i. e. 'Hello my name is john'. If you made that data part slightly different, such as 'that I do not name here', it would become impossible to resolve. At the very least you must somehow mark the data part. Also you have to be very careful about what constitutes a key phrase that describes the operation. In the above example 'for every' seems an appropriate key phrase, but you could also phrase something like: Every time I press the key down button, move the cursor one line down. Here, 'every time' is a key phrase, making 'every' by itself ambiguous. So when we parse a phrase, we cannot just investigate each word individually, we must also watch for specific phrases of words that subtly changes the meaning. It's doable, but it's incredibly complex. Google for 'Siri' to find an advanced system that might be able to tackle such problems.
Member 8331185 wrote:
any idiot can walk up to a PC and provided they can read and write in the English language they should be able to begin programming
Looking at forums I have some serious doubts about the ability of 'some idiot' to write proper english. Hell, often *I* have trouble understanding what they are saying...
-
What language would you like that book in - would binary suit you? ;) But seriously: machine code is, as the name implies, machine dependend. Or, more to the point, dependent on the CPU. AMD and Intel have different machine code, as does the PowerPC line, or the various risk processors. New multicore processors have commands that none of the older have, simply because they don't have multiple cores. Basically, every CPU that comes with a new feature, comes with a new machine command, or several of them. So, if you have a specific CPU in mind, like that in your own computer, find out it's precise name, and look for books or articles on that CPU. I think I still somewhere have an MC 68000 Assembler book for the like-named processor, back from the time when I owned an AMIGA. ;)
Yes, binary would best suit me, I'm desperately interested in it as you can see. My computer at home using an Intel quadcore processor, but I do not know what it is exactly or "precisely" called.
-
PIEBALDconsult wrote:
Only within certain limits. Make it do what you need it to do and then add features as needed or requested
I disagree - the most successful general purpose programming languages have a minimal set of features but allow libraries to extend the language to a degree. C, Smalltalk and LISP spring to mind.
I was thinking more along the lines of the features added to C# like generics and Linq, or adding OOP to Pascal.
-
Brandon-hbx12000 wrote:
Is there a way to create a programming language without using an existing programming language?
No, because God gave us the first programming language, and he saw that it was good...
Somebody in an online forum wrote:
INTJs never really joke. They make a point. The joke is just a gift wrapper.
It's all in how you bang the rocks together, guys.
-
Yes, binary would best suit me, I'm desperately interested in it as you can see. My computer at home using an Intel quadcore processor, but I do not know what it is exactly or "precisely" called.
Windows give more info about your processor (for instance on Windows 7, you may open the
Control Panel->System
). Anyway Intel processors are AFAIK backward compatible so you may start with a machine code written for an older CPU.If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Don't worry about it. The regulars think this one's fine.
Forgive your enemies - it messes with their heads
"Mind bleach! Send me mind bleach!" - Nagy Vilmos
My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility
Right with ya!
"To alcohol! The cause of, and solution to, all of life's problems" - Homer Simpson
-
1: DON'T ask programming questions. 2: We don't do homework. 3: see 1.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair. nils illegitimus carborundum me, me, me
1: It's not a programming question. 2: We do courtesy 3: Join us
"To alcohol! The cause of, and solution to, all of life's problems" - Homer Simpson
-
Is there a way to create a programming language without using an existing programming language? or to create it from scratch or create it in machine/binary code or assembly code? Also some other questions that are optional that you may answer: - Is there a way for a programming language to be "all-purpose"? (for example this programming language can be used to make games, models, simple applications (like calculators) or anything and EVERYTHING you can imagine) - Is there a way for a programming language to be "self-sustained"? (for example you don't need more than one language like "Lua" to run a massive game like "World of Warcraft" or "Command and Conquer" or any of those games out there or this language does not need support of any kind to run) Any answers will be fully-appreciated. :) Regards, Brandon Proud Member of "The Code Project"
Brandon-hbx12000 wrote:
Is there a way to create a programming language without using an existing programming language? or to create it from scratch or create it in machine/binary code or assembly code?
To really create a language from scratch (no assembly or anything) you'd need to create on a hardware level. Your hardware would have to be your compiler and you should program logical circuits to interpret bits of data, those bits of data could be the character representation of your language. It's a very daunting task and worth only on very specific scenarios, like for chip manufacturers. And it's a good thing our fellow computer engineers of the past have already done that for us.
"To alcohol! The cause of, and solution to, all of life's problems" - Homer Simpson
-
Is there a way to create a programming language without using an existing programming language? or to create it from scratch or create it in machine/binary code or assembly code? Also some other questions that are optional that you may answer: - Is there a way for a programming language to be "all-purpose"? (for example this programming language can be used to make games, models, simple applications (like calculators) or anything and EVERYTHING you can imagine) - Is there a way for a programming language to be "self-sustained"? (for example you don't need more than one language like "Lua" to run a massive game like "World of Warcraft" or "Command and Conquer" or any of those games out there or this language does not need support of any kind to run) Any answers will be fully-appreciated. :) Regards, Brandon Proud Member of "The Code Project"
You can do it. Probably the easiest language to write in machine code is FORTH, which (a) is very simple internally, and (b) is mostly written in itself: I think only something like three of its default words are machine code primitives. So if you can get the basic framework of the thing going, (handling the dictionary, getting the environment to work, etc.) and write the machine code words in it ("emit" is one of them, for example) writing the rest of it can be done in your FORTH environment itself. I actually did this at one point, just to see if I could: it turned out to be much easier than I thought it would be.
-
Is there a way to create a programming language without using an existing programming language? or to create it from scratch or create it in machine/binary code or assembly code? Also some other questions that are optional that you may answer: - Is there a way for a programming language to be "all-purpose"? (for example this programming language can be used to make games, models, simple applications (like calculators) or anything and EVERYTHING you can imagine) - Is there a way for a programming language to be "self-sustained"? (for example you don't need more than one language like "Lua" to run a massive game like "World of Warcraft" or "Command and Conquer" or any of those games out there or this language does not need support of any kind to run) Any answers will be fully-appreciated. :) Regards, Brandon Proud Member of "The Code Project"
Sure, invent an entirely new symbol set for arithmetical operators. Choose another logical operator besides if/then for alternation. You can't completely escape looping or recursion, but I'm sure you could express them in a way that has never been seen before. Actually, this was done at least once. See the programming language APL. It's easy to make a programming language general purpose. Just make it as rich as a natural language and then build a compiler that is approximately as smart as a software developer to render it down to efficient machine lnaguage. Such a programming language would be very high level. You'd feed it programs that looked like, "I need an inventory management system." or "Construct a massively mulltiplayer online game that attracts at least 100000 users and generates revenue of $15 million per year." Be aware that since you could also ask the system, "Write a program that solves the Halting Problem" that your compile times may be extremely long. Kinda like working with human developers, it may not get done in a reasonable time.
-
Is there a way to create a programming language without using an existing programming language? or to create it from scratch or create it in machine/binary code or assembly code? Also some other questions that are optional that you may answer: - Is there a way for a programming language to be "all-purpose"? (for example this programming language can be used to make games, models, simple applications (like calculators) or anything and EVERYTHING you can imagine) - Is there a way for a programming language to be "self-sustained"? (for example you don't need more than one language like "Lua" to run a massive game like "World of Warcraft" or "Command and Conquer" or any of those games out there or this language does not need support of any kind to run) Any answers will be fully-appreciated. :) Regards, Brandon Proud Member of "The Code Project"
-
Ambiguity of identifiers would be a big concern for me. How would the system know what you meant by a container? Or where a statement started or ended without punctuation?
-
Member 8331185 wrote:
for every value in the statement Hello my name is john count the number of spaces
The problem with such a statement is that a parser would need to distinguish between specific commands and properties such as 'for every', 'count' or 'spaces' and the data that is to be processed, i. e. 'Hello my name is john'. If you made that data part slightly different, such as 'that I do not name here', it would become impossible to resolve. At the very least you must somehow mark the data part. Also you have to be very careful about what constitutes a key phrase that describes the operation. In the above example 'for every' seems an appropriate key phrase, but you could also phrase something like: Every time I press the key down button, move the cursor one line down. Here, 'every time' is a key phrase, making 'every' by itself ambiguous. So when we parse a phrase, we cannot just investigate each word individually, we must also watch for specific phrases of words that subtly changes the meaning. It's doable, but it's incredibly complex. Google for 'Siri' to find an advanced system that might be able to tackle such problems.
Member 8331185 wrote:
any idiot can walk up to a PC and provided they can read and write in the English language they should be able to begin programming
Looking at forums I have some serious doubts about the ability of 'some idiot' to write proper english. Hell, often *I* have trouble understanding what they are saying...
I've worked with an idiot who's command of the English language was fairly good. His capability to code was non-existant. I groaned every time this person was grouped in the same team I was placed in. That was because my productivity, and every other real programmer's productivity in the team would drop because he was in it. I never understood how year after year, he remained employed. So 8331185's comment is totally unbelievable to me.
-
HTML isn't a programming language. It isn't Turing complete, and thus can't be used to implement arbitrary algorithms.
True, but definitely a domain-specific language.