Jump to content

Photo

My own programming language


  • Please log in to reply
45 replies to this topic

#1 Fabbrizio

Fabbrizio

    Legend

  • Members
  • Real Name:Mark

Posted 16 October 2008 - 09:01 AM

Alright, so a few days ago I thought I would try and design my own programming language. Its purpose is to be compact so that more code can fit in your screen while you work with it. The syntax is very similar to C, but in a lot of ways it's totally new.

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 Fabbrizio

Fabbrizio

    Legend

  • Members
  • Real Name:Mark

Posted 18 October 2008 - 03:21 PM

News for you!

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 Soarin

Soarin

    Chosen One

  • Members

Posted 19 October 2008 - 03:20 PM

How hard will it be to learn?

#4 Fabbrizio

Fabbrizio

    Legend

  • Members
  • Real Name:Mark

Posted 19 October 2008 - 03:28 PM

It depends on what language you plan on learning. The languages named for gases are our "lightweight" languages, the easy to work with ones, but will also have limited results (not TOO limited, mind you. just limited by ease of use). While carbon will probably be the hardest one, but also the one with the best results.

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 Beefster

Beefster

    Human Being

  • Members
  • Real Name:Justin
  • Location:Colorado

Posted 27 October 2008 - 09:33 PM

Sounds a bit ambitious. And cool. You should probably make Iron and Carbon first. Those should be pretty easy. Then make Lithium. Oxygen just seems really hard to do, so do that last.

I can help if you want me to. I'm up for the challenge.

#6 Fabbrizio

Fabbrizio

    Legend

  • Members
  • Real Name:Mark

Posted 27 October 2008 - 09:42 PM

I'll admit it is a rather large task, but I'm in no hurry.

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 Beefster

Beefster

    Human Being

  • Members
  • Real Name:Justin
  • Location:Colorado

Posted 28 October 2008 - 06:08 PM

I don't know x86 ASM. I know some baseline TI ASM, though.

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:
CODE
!We'll say the default element is Iron!
#"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 Fabbrizio

Fabbrizio

    Legend

  • Members
  • Real Name:Mark

Posted 28 October 2008 - 06:18 PM

The way you show it, oxygen seems like it would be pretty fun to build and easy to use.

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 icon_frown.gif )
Oxygen: .o
Neon: .ne
Magnesium: .mg
Iron: .fe

#9 Beefster

Beefster

    Human Being

  • Members
  • Real Name:Justin
  • Location:Colorado

Posted 28 October 2008 - 07:18 PM

It can basically be as simple or as complex as you want to make it.

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:
CODE
ALCHEMIC ERROR: UNEXPECTED ELEMENT SHIFT. EXPECTED SEMICOLON ON TOKEN >
You can also shorten element shift statements to O, Li, C, and Fe.

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 Fabbrizio

Fabbrizio

    Legend

  • Members
  • Real Name:Mark

Posted 28 October 2008 - 07:20 PM

Sounds good!

I'll get to work on some ideas tonight, and I'll share them tomorrow...

#11 Beefster

Beefster

    Human Being

  • Members
  • Real Name:Justin
  • Location:Colorado

Posted 28 October 2008 - 07:30 PM

Maybe we could open up a blog about the language...

#12 Fabbrizio

Fabbrizio

    Legend

  • Members
  • Real Name:Mark

Posted 28 October 2008 - 08:55 PM

Done and done.

http://epl.thedevhome.net/

Just lemme get it set up.

#13 Takuya

Takuya

    spirit of fire

  • Members
  • Location:Cali

Posted 29 October 2008 - 12:34 AM

I might be able to give you a hand. Just letting you all know how hard building a compiler is, and a language. Basically, a compiler uses a binary tree to determine and parse elements. It stores elements in a btree, so basically

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 Fabbrizio

Fabbrizio

    Legend

  • Members
  • Real Name:Mark

Posted 29 October 2008 - 08:52 PM

Don't have AIM...I'll probably have a forum for this soon enough (following up the blog)...

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 Beefster

Beefster

    Human Being

  • Members
  • Real Name:Justin
  • Location:Colorado

Posted 30 October 2008 - 03:50 PM

I'm gonna open up a chat channel on devnode for this if I can. I'll use Ecnet if I can't.

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