Is it possible to write a programming language with an existing one? I want to create a game creation program, and have it use it's own language for additional programming. Something similar to Game Maker.
Name:
Anonymous2005-05-18 15:44
Yes, but that's not necessarily the best choice.
Usually the best way to do this is to embed an existing scripting language, like LUA, Python, Ruby or Javascript or something.
This is a good choice because you already have a well-established language, with syntax familiar to other developers, and plenty of existing documentation on how to embed it.
But if you insist on your own language or syntax, look into grammars and something like flex/bison.
Name:
Christy McJesus!DcbLlAZi7U2005-05-18 18:21
It's very much possible, but a bad idea for most of the reasons >>2 mentioned and then some. Python is a good choice, some commercial games have successfully used it for the higher level logic after doing the performance code in C++.
Name:
Anonymous2005-05-19 6:49
I thought Lua was pretty much the default choice for an embedded language. Why python? (honest question)
>>5
Either you need to learn how to read, or go troll elsewhere.
Name:
Anonymous2005-05-21 9:05
>>6
I was making a [insert big word here] comment on the state of programming languages. >_>
Name:
Anonymous2005-05-24 4:18
It is entirly possible to write a programming language in anouther language. How ever you have to ask yourself do you really want to work out the binary code (or assembly if your not going to complete the job yourself) yourself. Plus the fact that you asked the question probably means you wouldn't be-able to produce a scripting language which requires computer theory, such as (mainly) stacks and hash tables.
Imbeding a existing scripting language, or using a tool such as dlopen (unix) or openlibrary (Windows) to dynamicly include library files, instead of worry about scripts.
Perhaps you should spend more effort on the game and introduce the this feature later? A game can require a lot of work, and it isn't worth going off on a tangent for a simple feature.
Bootstraping a new programming language with -itself- used to be all the rage years ago... (example: Wirth's Pascal)
Name:
Anonymous2005-05-31 5:33
It's a witty way to do stuff
Name:
Anonymous2005-05-31 21:33
More like it's a good way to prove the language is actually useful.
Name:
Anonymous2005-06-04 10:58
>>13
I see where are you coming from. In fact, I usually look for the following once I read a language:
- I like to be able to implement functions like those the language's base library provides. For example, you can do my_printf in C, but you can't do my_WriteLn in Pascal (correct me if wrong).
- I like to be able to do stuff. Any kind of stuff. For example, you can do linked lists in C, but you can't do them in Basic (correct me if wrong).
Name:
Christy McJesus!DcbLlAZi7U2005-06-05 11:09
Since we're on this line of discussion:
Lisp has a mere 7 axioms, the rest of Lisp is written in Lisp. w00t
Name:
Anonymous2005-06-05 22:25
I keep hearing good things about Lisp, but I'd rather have two teeth taken than write in Lisp syntax...
Name:
Anonymous2005-06-06 1:04
sounds to me like you basicly want to make a program that contains a scripting language, yes you can do that.
Name:
Anonymous2005-06-06 3:15
yes. i wrote a simple game that contains a forth interpreter in python. forth is the easiest language ever to write an interpreter for. it would probably be easier ond result in a better language if you used an existing scripting language though. i know that python and scheme have c++ bindings, probably some other languages too.
Try it out, it's worth it once you get used to the parentheses flying everywhere. Even if you never use it it'll give you an interesting point of view on language appreciation. (I tried to make the preceding sentence sound non-pretentious but I couldn't manage it...)
Name:
Anonymous2005-06-07 0:40
joy > lisp
it has even less syntax than lisp
Name:
Anonymous2005-06-07 1:28
you can't actually _do_ anything with joy though because the higher level combinators (i.e. most of the useful ones) work on the entire stack thus destroying any state information.
Anonymous #26 meant no matter what LISP has, useful stuff gets done in C (C++ if objects are really necessary), like always. Save for web sights, which can be done in PHP or Perl.
Name:
Christy McJesus!DcbLlAZi7U2005-06-08 6:03
Well I sure as hell don't do much in C. It's a low level language, trying to treat it as a high level language is the reason we have buffer overrun vulnerabilities in *everything*
Also the guy who shares my office keeps crunching on something. It's one of those really annoying slow crunches that people make when they're trying to eat quietly. *chhhommmp... munnnch... guulllp* If you're going to annoy me do it like a man, faggot.
Also in the interests of creating drama, I shall now bring up the subject of Java.
uhm. compiler theory is possibly the hardest part of computer science. it looks like he doesn't even know where to begin to look, so he's extremely unlikely to get anything working
Name:
Christy McJesus!DcbLlAZi7U2005-06-08 12:29
>>34
He only wants an extension language, why go to the extreme of compiling things?
Name:
Anonymous2005-06-08 14:25
oh god seriously are you a retard or are you trolling? if the former, how do you manage to breath?
>>36
The answer to your question would depend on who you're talking to. Abuse less pronouns.
Name:
Anonymous2005-06-09 12:02
>>38
Save for you who (strangely enough) are not Anonymous, it would then become:
oh god seriously is Anonymous a retard or is Anonymous trolling? if the former, how does Anonymous manage to breath?
which would pretty much be the same :)
Name:
Christy McJesus!DcbLlAZi7U2005-06-09 14:33
>>39
I was going to say something about using pronouns on a thread full of Anonymous, but I realised it would be silly for the reasons you mentioned :)
Name:
Anonymous2005-06-13 7:52
>>33
This is one of the best sentence I've ever read. But it spans more than just CS.
Name:
abez!XWEgiX8ArQ2005-06-20 21:50
All the game programmers use lua because they are painfully ignorant of functional languages. Since this will be for game programmers I'd suggest make a game engine which is extendible via Lua. You could also use a language such as SML to build a meta language which they code in.
Name:
Anonymous2005-06-21 3:17
>>42
First off: holy fuck, you posted in every thread.
Second: of course they're aware of functional languages. Who isn't? I'm interested to hear your reasons why they should use one for embedding though.
Name:
Anonymous2005-06-21 3:23
My knowledge of functional languages is very limited, but for what I've seen, they aren't that good as they sound - ok, they are attractive and interesting, but in real application environments, you're more worried at things like execution speed, code cleanliness and maintainability, syntax, learning curve, etc., and these languages (at least for what I could see) seem to be really lacking at some of these things, especially syntax, maintainability, and performance.
Well lisp is embedded into emacs, it doesn't seem that bad. The GIMP works very well with Guile. Guile is meant to be embedded and it is quite powerful. It doesn't seem to be the abortion that is Lua. Lua is inherently imperative but it really seems like a clean version of php. In other words Lua was designed for non-programmers whereas Guile was designed after Scheme, a real programming language. Guile has enough power like closures etc to handle much of the stuff you would expect. Functional languages also promote the parameterizing of functions via more functions. They make it convienant to pass around code or compose new functions to pass around. Lua on the other hand has it's datastructures and it's kludgy imperative style.
SML is a whole different story, SML is as the name implies a META LANGUAGE, you can define lots of additions to the language via the type system, you can effectively make new languages out of users just composing types. Even better you can match against these types and produce real code and then compile that.
Why reinvent the wheel when the wheel is here, it just needs a bit of tune up.
Name:
Anonymous2005-06-21 3:52
Yes, but I wonder if worrying about such features is justified, considering few people know them and they hurt maintainability. And the few stuff made with functional languages I used seems horribly slow.
What's so bad about traditional imperative structured programming, BTW?
Name:
abez!XWEgiX8ArQ2005-06-21 4:13
How does functional programming hurt maintainability? Supposedly abstraction and parameterizing improve maintainability, at least that is what people who emphasize agile methods and refactoring suggest.
I don't know what you used, I know that SML derivatives are quite fast because a strict type system allows the compilers to make all sorts of lovely optimizations beyond tail calls. I use OCaml for realtime audio synthesis and it holds up quite well against C.
Well I did recommend Lua didn't I, so imperative can't be that bad. Imperative is rather straight forward but it is pretty limited, usually functional languages allow for more code reuse through parametric polymorphism etc. I would argue that you write more code in an imperative style. For a game wouldn't it make more sense to have reusable chunks of logic you can pass about (I know you can pass functions in Lua). This is especially relevant for AI.
I explicitly recommended SML as it provides you with meta-language capabilities, you can extend SML without changing SML very much, you can also extend it in such a way that it can be compiled, you could generate C code and compile that if you wanted to.
Name:
Christy McJesus!DcbLlAZi7U2005-06-21 4:38
Uh if it's an extension language why would you care about speed? The engine is where the speed matters and you've already coded that to be fast (I hope you profiled before optimising).
Name:
Anonymous2005-06-21 5:52
>>47
Defining sub-languages and using these features increases software complexity. You're adding to what a coder needs to know to implement new features or change something, which reduces productivity. Besides, I don't know how nice SML is otherwise (I'll look into it later since you recommend it), but I've seen LISP, and man, that's a sucky syntax (or lack of). Unholy amount of parenthesis and prefix notation makes programs harder and slower to write, and much harder to read and understand. I'm not talking about writing my own sysadmin hacks, but an application I'm getting paid for and I have to document.
>>48
Depends on what do you want to use it for. Macros in a word processor? Anything will be fine. IA in a game? I would care.
Name:
Christy McJesus!DcbLlAZi7U2005-06-21 9:00
>>49
For an alternative view on everything you just mentioned, have a look at www.paulgraham.com
Paul Graham's company Viaweb developed the first decent software for creating web stores, which he then sold to Yahoo for many millions. He attributes Viaweb's ability to stay ahead of the competiton to the power of abstraction offered by Lisp, as compared to the low level languages other companies were using.
Worth a read; he's an excellent essayist.
Name:
Anonymous2005-06-21 10:12
Graham is a homo who wrote the software for amazon.com in clisp (they switched to C later because clisp sucks) and has done nothing since except write essays and a five hundred word document on "Arc", a lisp like language that he's supposed to finish some-time by 2070. Although, he might actually have a point about the superiority of lisp, the way he presents this conjecture is rather retarded.
Is not. I didn't say that he is wrong, just that he has an obnoxious off-putting way of stating his point.
Name:
meeelting2005-06-22 11:10
I've recently just wrote something like this; as i decided that lua/xml was probably too hard for the graphicians and the designer.. anyway; try to make it as simple as you can. (did this in C++ btw, not too familiar with C)
Anyway, if you're gonna go ahead and make your own language: i suggest you start by simple loading a file into a large char string, and the parse it up piece by piece, looking for spaces.
Then simply start looking through your parsed char variables, looking for commands.
Good luck guy..
Name:
Anonymous2008-04-19 18:48
>>4
ONE WORD: FORCED INDENTATION OF CODE. Thread over.
Anyway, if you're gonna go ahead and make your own language: i suggest you start by simple loading a file into a large char string, and the parse it up piece by piece, looking for spaces. Then simply start looking through your parsed char variables, looking for commands.
After reading that part by chance, I began scanning the post for the string `C++'. Sure enough, there it was.
Name:
Anonymous2008-04-19 21:30
Just implement The ABC Programming Language. It can do everything.
Load a file into a string? Load the file char by char until you read whitespace: now you have loaded one token.
Start by writing code converters for stuff like brainfuck, befunge, and ABC. Easy: convert your made up language into code some other, working compiler can understand.
Name:
Anonymous2009-03-06 7:54
Assembly End the sector with x55 xAA It will get released next year I mean it might Read the C FQA Lite.