Carbon

For the discussion of Perl, Python, Ruby, and PHP and other interpreted languages.

Carbon

Post by YayPython on Sun Feb 08, 2009 4:30 pm
([msg=17533]see Carbon[/msg])

Hey guys. I've started planning out language design for something I'd like to call Carbon.Carbon will be a scripting language, run with an interpreter, much like Python. It will have three main parts:
1: The Shell
a. The Shellwill work exactly like Python's command line program does; runs Python commands. Carbon's shell will also include standard bash commands, like "cd", "ls", "mkdir", and more. The syntax for the system commands will be somewhat the same, and can be incorporated into Carbon's syntax, so Carbon Shell Tools will be much like windows batch files.
2: Carbon2
a. Carbon2 is the actual languge. You type code for command line programs with this, and save it as a ".cb" file, which can be double clicked (or $ carbon script1.cb'd) to run.
b. Carbon2 is not only used for command line applications. It is also what makes the second language work: Making GUIs interactive.
3: Carbon3
a. Carbon3 is the language that makes GUIs. It is a markup languge, so if you know HTML you will get used to it quickly.

I have prepared a few examples of code:
CarbonSH Dialouge:
Code: Select all
[carbon]$ x = 2
[carbon]$ print(x)
x
[carbon]$ math(x+2)
4
[carbon]$ math(2 * x)
4
[carbon]$ str("a"+x)
a2


Carbon2 Simple Calculator:
Code: Select all
func data(){
  print("Enter a mathematical expression:\n");
  return get.input();
}
$x = data()
$y = math($x)
print($y);


Carbon3 Non interactive GUI:
Code: Select all
[c3 title="LOL I DOES NATHING"]
[button value="CLICK ME. Or die." pos="centered"]
[/c3]


Carbon Program:
GUI File:
Code: Select all
[c3 title="Calc"]
Input: [inputbox name="data"]
Output:[inputbox name="out"]
[button name="1" value="1" onclick="data.value + '1'"]
[button name="2" value="2" onclick="data.value + '2'" //And so on with the  onclicks.]
[button name="3" value="3"]
[button name="4" value="4"]
[button name="5" value="5"]
[button name="6" value="6"]
[button name="7" value="7"]
[button name="8" value="8"]
[button name="9" value="9"]
[button name="0" value="0"]
[button name="+" value="+"]
[button name="-" value="-"]
[button name="*" value="*"]
[button name="/" value="/"]
[button name="=" value="="]
[link carbon2 file="Usr/Jefflalala/Carbon/calc.cb"]
[/c3]

Carbon2 File
Code: Select all
#gui[1] <Usr/Jefflalala/Carbon/calc/calc.cbg>
$x = gui[1].data
$y = math($x)
gui[1].out == $y


As you can see, it's heavily influenced by HTML/BBCode (lol), JavaScript, PHP, Perl, Python (CarbonSH), and I think I threw a bit of C(++) in there too.

However, I'm just not sure how to start the development. I have STFW over and over into the wee hours of the morning, but to no avail. I'm at a loss. Can some of you point me in the correct direction? I'm not asking for code to steal from.

Also, I would greatly appreciate feedback on the language. Do you like the syntax? Do you like the idea that it is very heavily influenced from my old HTML/JS days? I think it's good that soon, web developers may start cranking out desktop applications. I also hope it will get ported to all three main OS choices out there (Linux, Mac OS X, Windows).

And one more thing, what language would you suggest for a feat like this?
User avatar
YayPython
Experienced User
Experienced User
 
Posts: 50
Joined: Sat Jan 31, 2009 11:05 am
Blog: View Blog (0)


Re: Carbon

Post by Tentra on Sun Feb 08, 2009 4:58 pm
([msg=17534]see Re: Carbon[/msg])

My thoughts when I read this:
Looks like a cross between Python and PHP.
Too many brackets (I hate brackets with a passion)
Carbon2, Carbon3????? Are you making 3 languages? Or are you thinking of something like Gems for Ruby?
Whats the main purpose of this langugage?
Where would it be used? (Web pages, Normal App Development, etc.)
Why should someone choose Carbon over something like C++, PHP, or Perl?

I tried something like this once, I used C#. All it could do was input, print, and do basic math.
I had this ghetto way of storing variables, I had parallel arrays, one had the name of the variable, and the other contained the value.

Dont let me discourage you, but I think you need to take more time to think about how Carbon would work.
Good Luck :D

P.S.
You might not want to use the name "Carbon" Look at this
User avatar
Tentra
Poster
Poster
 
Posts: 157
Joined: Wed Apr 30, 2008 4:52 pm
Blog: View Blog (0)


Re: Carbon

Post by YayPython on Sun Feb 08, 2009 5:37 pm
([msg=17539]see Re: Carbon[/msg])

Tentra wrote:My thoughts when I read this:
Looks like a cross between Python and PHP.
Too many brackets (I hate brackets with a passion)
Carbon2, Carbon3????? Are you making 3 languages? Or are you thinking of something like Gems for Ruby?
Whats the main purpose of this langugage?
Where would it be used? (Web pages, Normal App Development, etc.)
Why should someone choose Carbon over something like C++, PHP, or Perl?

I tried something like this once, I used C#. All it could do was input, print, and do basic math.
I had this ghetto way of storing variables, I had parallel arrays, one had the name of the variable, and the other contained the value.

Dont let me discourage you, but I think you need to take more time to think about how Carbon would work.
Good Luck :D

P.S.
You might not want to use the name "Carbon" Look at this

Oh really? I'm a bracket wh*re. And by the way, it's not really three languages. More like two, and a shell. The one language (Carbon2) is just shell input in a file. The other, Carbon3, is a markup language used to make interfaces. Also, it's going to be used to make normal apps for linux/windows/mac. Like python scripts that you run on client side.

Edit: Oh, and isn't that just an IDE or something? It's not a programming language.
User avatar
YayPython
Experienced User
Experienced User
 
Posts: 50
Joined: Sat Jan 31, 2009 11:05 am
Blog: View Blog (0)


Re: Carbon

Post by Tentra on Sat Feb 14, 2009 4:27 pm
([msg=17895]see Re: Carbon[/msg])

YayPython wrote:Also, I would greatly appreciate feedback on the language


When you ask for feedback don't bitch about what I say. I didn't try to piss you off or anything, I was just saying what I thought.
User avatar
Tentra
Poster
Poster
 
Posts: 157
Joined: Wed Apr 30, 2008 4:52 pm
Blog: View Blog (0)


Re: Carbon

Post by YayPython on Tue Feb 17, 2009 3:31 pm
([msg=18119]see Re: Carbon[/msg])

Tentra wrote:
YayPython wrote:Also, I would greatly appreciate feedback on the language


When you ask for feedback don't bitch about what I say. I didn't try to piss you off or anything, I was just saying what I thought.

I wasn't bitching. I took what you said and responded. I felt happy as hell when someone aknowledged that I was trying to do this. Everyone else I know told me not to. I did appreciate it. I'm not sure where you thought I wa bitching...
User avatar
YayPython
Experienced User
Experienced User
 
Posts: 50
Joined: Sat Jan 31, 2009 11:05 am
Blog: View Blog (0)


Re: Carbon

Post by Tentra on Tue Feb 17, 2009 10:15 pm
([msg=18136]see Re: Carbon[/msg])

Oh, well I apologize then. I guess I misunderstood you.
And if you need anything I would be happy to help
User avatar
Tentra
Poster
Poster
 
Posts: 157
Joined: Wed Apr 30, 2008 4:52 pm
Blog: View Blog (0)


Re: Carbon

Post by nneonneo on Wed Feb 18, 2009 4:51 pm
([msg=18187]see Re: Carbon[/msg])

Develop a syntax for your language, get it working, and write a Yacc/bison parser for it. Once you have done that, you will have the basic system for interpreting the language, and from there you can start thinking about making it really tick.

For the shell language, you may opt for something simpler; most shell scripting systems have very basic parsers (nothing complex).

However, in general, designing and implementing a language is not easy. It will take work and is not simply a weekend project. To make it work, you will really have to spend some time learning the fundamentals.
nneonneo
New User
New User
 
Posts: 5
Joined: Fri Apr 25, 2008 11:01 am
Blog: View Blog (0)


Re: Carbon

Post by YayPython on Sun Feb 22, 2009 11:56 am
([msg=18404]see Re: Carbon[/msg])

nneonneo wrote:Develop a syntax for your language, get it working, and write a Yacc/bison parser for it. Once you have done that, you will have the basic system for interpreting the language, and from there you can start thinking about making it really tick.

For the shell language, you may opt for something simpler; most shell scripting systems have very basic parsers (nothing complex).

However, in general, designing and implementing a language is not easy. It will take work and is not simply a weekend project. To make it work, you will really have to spend some time learning the fundamentals.

Well, the shell language will pretty much be the same as Carbon2, just typed into a Terminal window (Terminal.app, CMD.exe, xterm). But the Yacc parser looks kind of cool. I'll definitely look into it.

I had an epiphany about the syntax when I was playing Left 4 Dead. Maybe I should make it all in one file, for example:
Code: Select all
[Carbon]

<?carbon

#start <carbon> {
  console(console)
  console.writeline("Welcome to SimpleShell [Built in Carbon2]")
  $on = true;
  while($on == true){
   $cmd = console.readline()
   if($cmd == "ver"){
    console.writeline("Version 1.00 [Carbon2]")
   }
   elif($cmd == "mkdir"){
    $mkdirargs = console.getargs()
    os.mkdir($mkdirargs)
   }
   elif($cmd == "ls"){
    os.ls()
   }
   elif($cmd == "cd"){
    $cdargs console.getargs()
    os.cd($cdargs)
   }
   console.writeline("[csh]$ ")
  }
}

carbon?>

[/Carbon]


The above will make a new Carbon2 console, and take input/args and process them with the os object. IT's a very simple shell written in Carbon2.

I changed the Carbon2 syntax over the weekend, whilst I was writing out a list of objects/methods.
Current objects:
Console
String
Math
Gui
Button
Textfield
Radiobutton
Dropdown
os

-- Thu Feb 26, 2009 12:14 am --

All right guys, I'm not killing this project, I'm just putting it aside. I started learning C++ and had a great idea for a hacker's environment. There will be a thread on it, and it does include a script language, just a lot simpler than this one. It's more like batch files than this.

I'll get back to this at some point.
User avatar
YayPython
Experienced User
Experienced User
 
Posts: 50
Joined: Sat Jan 31, 2009 11:05 am
Blog: View Blog (0)



Return to Interpreted Languages

Who is online

Users browsing this forum: No registered users and 0 guests