Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Sep 4th, 2005, 7:13 PM   #1
crazykid48x
Programmer
 
crazykid48x's Avatar
 
Join Date: Apr 2005
Posts: 96
Rep Power: 4 crazykid48x is on a distinguished road
My own programing language

I am planning to start planing a big project. Its gonna be a web based game for programers. Its gonna have its own little programing language, nothing big though. It will be like a robot programing strategy game. I wanted to know if someone could refer me to a place where I can learn how programing languages are made. Also I wanted to know if I can acomplish all of this using only html, php, mysql, jscript and flash.
crazykid48x is offline   Reply With Quote
Old Sep 4th, 2005, 11:00 PM   #2
tempest
Programming Guru
 
tempest's Avatar
 
Join Date: Oct 2004
Posts: 1,041
Rep Power: 5 tempest is on a distinguished road
Send a message via ICQ to tempest Send a message via AIM to tempest Send a message via Yahoo to tempest
It's possible...
__________________

tempest is offline   Reply With Quote
Old Sep 5th, 2005, 2:41 AM   #3
big_k105
PFO Founder

 
big_k105's Avatar
 
Join Date: Mar 2004
Location: Fargo, ND
Posts: 1,646
Rep Power: 10 big_k105 is on a distinguished road
Send a message via AIM to big_k105 Send a message via MSN to big_k105 Send a message via Yahoo to big_k105
Im pretty sure you can do all this using what you want to use

Im sorry but at this moment i dont know any places to help you create a language, sorry
__________________
BIG K aka Kyle
Programming Forums
Kyle K Online

Please do not PM or email me programming questions. Post them in the forums instead.
big_k105 is offline   Reply With Quote
Old Sep 5th, 2005, 3:06 AM   #4
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5 Arevos is on a distinguished road
The major problem with creating a web-based programming game is the potential for abuse. If your programming language has loops in it (and you'll almost certainly need some form of looping ability), then an attacker could overload your system with an non-terminating loop.

The best way to deal with this, to my mind, is to start by creating an assembly-like language. You can then assign 'costs' to certain instruction sets. A user gets so much credit per day or per hour to run their program, and each instruction executed takes up some of this credit.

If you want to create something more complex, you could use this as a basis for designing a higher level language on top of your assembly-language base. However, this task would not be trivial to acheive, and I for one would not attempt it in PHP.
Arevos is offline   Reply With Quote
Old Sep 5th, 2005, 7:32 AM   #5
crazykid48x
Programmer
 
crazykid48x's Avatar
 
Join Date: Apr 2005
Posts: 96
Rep Power: 4 crazykid48x is on a distinguished road
if not php then what?
crazykid48x is offline   Reply With Quote
Old Sep 5th, 2005, 9:52 AM   #6
mackenga
Professional Programmer
 
Join Date: Mar 2005
Location: Glasgow, Scotland
Posts: 317
Rep Power: 4 mackenga is on a distinguished road
I actually started working on a slightly similar (in very general terms, and not web-based) game a while back. I haven't worked on it for a while now (other projects are eating up too much of my time); my game was 'turn based' but each machine - each user-programmed robot - could make one move per turn. The code that determined the moves wasn't capable of looping, which solves that problem; non-terminating loops were OK because they'd execute over the course of multiple turns, which would keep them down to the speed of the rest of the game and avoid losing a lot of resources. In fact, most of the machine definitions would be built around a non-terminating loop.

I wouldn't build a language in PHP - it's interpreted to start with. You could write CGI programs in C or another compiled language; this would keep the speed reasonable and while C is very different from PHP at least much of the syntax is similar.

A nice programming language which is fundamentally very simple, and was originally designed to control astronomical telescopes and other hardware and therefore seems a good choice for a control language, is FORTH. It's a little odd to use, but I think it would suit your application quite well as a model for your game's simple language. A more modern but essentially quite similar descendant is PostScript; might be worth a look as a model to imitate.

Anyway, sounds like a great project, and a great way to learn about building programming languages. Best of luck with it!
mackenga is offline   Reply With Quote
Old Sep 5th, 2005, 10:09 AM   #7
Polyphemus_
Expert Programmer
 
Polyphemus_'s Avatar
 
Join Date: Aug 2005
Location: Rotterdam, the Netherlands
Posts: 942
Rep Power: 4 Polyphemus_ is on a distinguished road
creating another language in php? that's gonna be s..l...o..w..., since it will be an interpretted language and php is also interpretted, what means the interpretter is interpretted
I recommend creating a module for Apache in C, or something simular.
Polyphemus_ is offline   Reply With Quote
Old Sep 5th, 2005, 1:47 PM   #8
tempest
Programming Guru
 
tempest's Avatar
 
Join Date: Oct 2004
Posts: 1,041
Rep Power: 5 tempest is on a distinguished road
Send a message via ICQ to tempest Send a message via AIM to tempest Send a message via Yahoo to tempest
I don't recommend creating any implementations of a user-inputted programming language into a web environment. It, in short, is just too risky or too controlled.

If you want to create a web game for programmers, i don't think having actual programming involved would be the most feasible idea sadly to say... maybe you should consider trivia questions about specific languages and their unique tendencies?
__________________

tempest is offline   Reply With Quote
Old Sep 5th, 2005, 2:55 PM   #9
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5 Arevos is on a distinguished road
Quote:
Originally Posted by crazykid48x
if not php then what?
Anything with a parser generator, like Jack, JavaCC, Bison, ANTLR or PyParsing, to name a few. An assembly-like language is simple enough not to need a parser generator, but anything more complex than that really does need a generator of some description.

With the language you propose, you'd have to create it from assembly upwards, because security is such an issue. Since there is no solution to the halting problem, you can't detect infinite loops the way you would detect illegal file access or other security issues. You'd need to assign each command a cost, or create a language that cannot use loops. Unfortunately, such a language would be rather restrictive.

A lot can be done with assembly language. Robocom and CoreWars are two programming games that use assembly-esque languages to create programs that fight amongst themselves. Perhaps you could create something similar to that?
Arevos is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:15 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC