My own programming language
#1
Posted 16 October 2008 - 09:01 AM
The language is appropriately dubbed CPL (Compact Programming Language).
I don't have it totally figured out, nor do I know how I would make a compiler, but this short guide explains well enough what I have figured so far (plz note, it's an RTF):
The Language
Anyway, anyone have some suggestions?
#2
Posted 18 October 2008 - 03:21 PM
Alright, so now I'm actually going to be working on multiple languages in a project called EPL (Element Programming Languages). Each language will be named for an element which it is similar to. For example, the one mentioned above will be called Iron, for its high-density and malleability.
Another one will be called carbon. It will be like EPL-style ASM. Nitty-gritty code, but the catch phrase will be "if you use it right, you'll get a diamond!".
Another proposed one will be called Lithium, a *high reactivity* language enabled with 10 other languages including C/C++, Python, Perl, and Javascript.
Finally, we have Oxygen, "As natural as the air you breathe!" Actually, moreso as the air you breathe is mostly nitrogen. Either way, Oxygen will be based more upon English than any ordinary programming language. It is meant to be natural to work with, so that new programmers can learn to program.
#3
Posted 19 October 2008 - 03:20 PM
#4
Posted 19 October 2008 - 03:28 PM
If that makes no sense, let me put it this way; it's a lot easier to make a great computer image using pixels, rather than using a collage of pictures.
Oh, and we're also naming programs after elements. Neon will be our image editor, built to work not only with plain images, but also as a skin editor for Magnesium, our 3d model editor.
Edited by Powerbracelet, 19 October 2008 - 03:31 PM.
#5
Posted 27 October 2008 - 09:33 PM
I can help if you want me to. I'm up for the challenge.
#6
Posted 27 October 2008 - 09:42 PM
If you can help, that would be great. How much do you know about x86 ASM? I know a bit, but what I do know is insufficient for properly creating a language. Being a user of C++, PHP, and DM, I find myself able to find improvements in languages such as these, and thus build upon them to create a new syntax. Likewise, syntax is another strength of mine. ASM, however, is not.
Edited by Powerbracelet, 27 October 2008 - 09:47 PM.
#7
Posted 28 October 2008 - 06:08 PM
Iron, while being very compact seems like it would be hard to understand.
I would rather help with Lithium.
Now what would be REALLY cool is if you could intermingle the code types, sorta like how you can stick ASM into a C program.
Something like this:
#"example.epl"
?bob = 2
?bob += 2
%bfunc(1, 2, 3)
>Carbon
;the > before a statement denotes an element change
;and since we're now in a different language,
;we change to another syntax. Carbon uses
;the same comment character as ASM would.
LBL 3
SET d0, 4
ADD d0, 3
EQL d0, 7
>Lithium
/* Once again, we changed elements, so we now use
// for comments and /* for long comments, and as always
closed off with */
int fred = 4;
fred ++;
var dunno; //var denotes an untyped variable.
dunno = duck;
>Oxygen
(now comments are in parentheses.)
If dunno is an instance of Animal, Display "dunno is an animal.". (Periods end statements)
If fred = 5, then: (colons open blocks)
Increment fred by 16.
Variable Ghost will be the value returned by bfunc using the parameters 1, 2, 3. (Oxygen is wordy!)
Display Ghost.
Delete Ghost! (exclamation points close blocks and can act as periods if necessary)
#8
Posted 28 October 2008 - 06:18 PM
We could actually use optional words to improve ease of use. For example, Display could be interchangeable with Show and Print. Also, we could make it so "will be" pre-defines a variable, and "is" or "becomes" re-define variables.
As for intermingling languages, the save for that could just be .epl
As a clever salute to the elements, I'm thinking (as far as file extensions go):
Lithium: .li
Carbon: .ca (since .c is already taken by C )
Oxygen: .o
Neon: .ne
Magnesium: .mg
Iron: .fe
#9
Posted 28 October 2008 - 07:18 PM
Since it may be sometimes easier to remember the code for doing certain things in Oxygen, even though you prefer using lithium or iron, intermingling languages would definitely be a major plus.
And we could refer to changing of elements as "alchemy." We could even use the term in compiler errors:
Also: my proposition for the compilers is to make them simple to run. Some compilers are a nuisance to deal with because of all of the parameters. That's what usually compels me to get an editor.
Edited by Beefster, 28 October 2008 - 07:22 PM.
#10
Posted 28 October 2008 - 07:20 PM
I'll get to work on some ideas tonight, and I'll share them tomorrow...
#11
Posted 28 October 2008 - 07:30 PM
#13
Posted 29 October 2008 - 12:34 AM
a=1+b would be in a syntax tree or parse tree
.....a.....
../....\....
.1.....b
and then = and + are stored in a postfix tree ( =...+) It involves using infix and postfix and parse trees so as to separate components from other ones, then do mathematics on them, and such. Also your proposal for "Oxygen" is a lot like AppleScript, an English type language. One of the only ways to do that well is to have a lower level language under it, which the language becomes parsed into.
So..
If dunno is an instance of animal
would parse to say
if dunno.isInstanceOf(animal)... (in OOP terms)
So yeah. Basically I know a little about it... and.. yeah. Hit me up on AIM if you want, dlu813
#14
Posted 29 October 2008 - 08:52 PM
Anyway, parsing is new to me, and learning to understand it will most likely improve the success chances of this project by 1000%...understanding more of Binary and ASM will also help, but one step at a time, you know?
But yeah, let's see what we can do. With you, and Beefster, and TMS...there are enough smart people on this forum to help me make this a success.
#15
Posted 30 October 2008 - 03:50 PM
I set up the channel: #epl on irc.ecnet.org!!
Edited by Beefster, 30 October 2008 - 04:14 PM.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users