![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: Apr 2005
Posts: 96
Rep Power: 4
![]() |
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.
|
|
|
|
|
|
#2 |
|
Programming Guru
![]() |
It's possible...
__________________
|
|
|
|
|
|
#3 |
|
PFO Founder
![]() ![]() |
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. |
|
|
|
|
|
#4 |
|
Programming Guru
![]() Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5
![]() |
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. |
|
|
|
|
|
#5 |
|
Programmer
Join Date: Apr 2005
Posts: 96
Rep Power: 4
![]() |
if not php then what?
|
|
|
|
|
|
#6 |
|
Professional Programmer
Join Date: Mar 2005
Location: Glasgow, Scotland
Posts: 317
Rep Power: 4
![]() |
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! |
|
|
|
|
|
#7 |
|
Expert Programmer
Join Date: Aug 2005
Location: Rotterdam, the Netherlands
Posts: 942
Rep Power: 4
![]() |
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. |
|
|
|
|
|
#8 |
|
Programming Guru
![]() |
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?
__________________
|
|
|
|
|
|
#9 | |
|
Programming Guru
![]() Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5
![]() |
Quote:
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? |
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|