2014-10-10 22:47:26

Visualstudio, are you not understanding us, or something? Because right now your making this discussion a very difficult one. Do we have to speak in your native to understand? r do we need to close this topic. I'm going to give you an answer that you most certainly understand: Don't use LLVM. Clear?

"On two occasions I have been asked [by members of Parliament!]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out ?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."    — Charles Babbage.
My Github

2014-10-11 05:50:34

ok!, i dont use it!, i'll make an interpreter for that!, understanded

2014-10-11 17:25:50

I personally wouldn't say that. If you have a sincere need to use llvm and you have to knowledge to do so, then go ahead use it. We're not forcing you to use a particular piece of software here, we're just giving recommendations despite any appearances given. Llvm has it's uses, creating an interpreter for a scripting language has it's uses. the goal here is to weigh the advantages and disadvantages of using llvm and a  script interpreter, following the path that will lead to a finished piece of software.

Deep in the human unconscious is a pervasive need for a logical universe that makes sense. But the real universe is always one step beyond logic.

2014-10-12 05:15:47

thanks, i want recommendation!
but the question is, how to create an interpretor?
i've asked somewhere, they said to you need to compile your functions and classes with a C++ compiler to binary, and then link it with script bytecode!, but how to do that!, what about main entrypoint?

2014-10-12 05:46:49

Might I suggest making a game first?
There's two problems here.
The first is the language barrier: I can't tell if you don't know what's going on because I'm not sure if I'm understanding your posts or if you're understanding mine.  If English isn't your first language, I'd strongly suggest looking for someone who speaks yours fluently to explain this.  It's possible that you know more programming than I think and that the language barrier is what's preventing this from going anywhere.
The second is that I think you're biting off more than you can chew.  I've already told you the easiest way: use someone else's.  If you don't get why after rereading everything, there's nothing more I can say, but this can be done in 100 lines or less via Angelscript or similar.  Literally no one writes their own interpreters anymore.  We all just use something someone else has written.
You seem to be asking about elementary programming concepts now.  What have you done before?  What is your background?  if you've not released a mid-sized to large game, I'd not suggest trying to make a system for others to develop them.  Certainly, by the time you've done so, you won't have these questions anymore.  Use BGT, release a game around the complexity of Shades of Doom or BK3, and then revisit this project.

My Blog
Twitter: @ajhicks1992

2014-10-14 16:43:49

firstly, english is not my first language
my first language is persion
secondly, witch framework do you recommend for compiler?
or maybe, i'll release it as a C++ library
but what is the exec.bin in bgt's main directory?

2014-10-14 23:15:36

OK, then, visualstudio, I'll speak in your native language, then, since you don't seam to understand what we're trying to tell you.
آیا یک کامپایلر را ندارد. در عوض، یک مترجم با استفاده از جاوا با ابزار دیگر برای تشخیص زبان (ANTLR.) هنگامی که شما کشف کردن مکانیک از ANTLR، تلاش برای را  کامپایلر، اما می توانم کپی کردن از کسی میکنم. سعی کنید و گسترش مترجم خود را. اگر شما موفق به ساخت یک مترجم، من شما را راهنمایی در ساخت یک کامپایلر را. OK؟

"On two occasions I have been asked [by members of Parliament!]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out ?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."    — Charles Babbage.
My Github

2014-10-14 23:18:49

A Google translation might not be entirely accurate.

Deep in the human unconscious is a pervasive need for a logical universe that makes sense. But the real universe is always one step beyond logic.

2014-10-14 23:35:46

ok, but it didnt translate it correctly
i know what you are mentioning in your posts, but i've asked about exec.bin in bgt's main directory
dont need to translate everything for me

2014-10-15 03:05:27

Exec.bin is an angelscript necessity. BGT requires it to operate properly.

"On two occasions I have been asked [by members of Parliament!]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out ?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."    — Charles Babbage.
My Github

2014-10-15 05:19:02

ok, but some applications that uses AngelScript isnt using this file!
open it with a text editor, and you'll see that it start's with mz witch is the start of exe files!

2014-10-15 18:41:50

It's probably just the template exe for redistribution.  Kinda guessing in the dark, but given the name and that you're reorting that it's an exe file internally, this doesn't seem too far-fetched.  Copy the exe to whatever is distributed or append the bytecode or whatever, and then rename it to mygame.exe.
But again, just a guess in the dark.

My Blog
Twitter: @ajhicks1992

2014-10-15 19:25:45

i'm saying this, but dont know how can i create executables like this
i'm thinking about main entrypoint, and functions and classes that i want to add to this application
JIT compiler is just compiles the script code into bytecode, but it doesnt add executable header, main entrypoint, doesnt resolve simbles

2014-10-15 20:11:47 (edited by camlorn 2014-10-15 20:13:10)

All right look.  This is the absolute last time I'm going to lay this out.
1.  Get an interpreter tat someone else has written.  Lua, Angelscript, whatever.  It doesn't matter.  otice that I don't care if it's a JIT or not-the important part is that you didn't write it.
2. Write a program using this library.  This program looks for main.script in the directory of itself, loads it, and calls-say-main in the script.  This program will not top 300 lines and probably won't top 100.
3. Put this program in the same directory as the project and launch it.
For bonus points, use a batch file to launch the program that loads the script.  This enables you to use the program with multiple files-i.e. you don't have to bundle projects to run it.  The total code size of this project is 400 lines tops, including the launcher scripts.  You will not be able to out-do BGT in any meaningful way: by the time you do, you might as well have jsut used C++ or Java or something directly.  THe only way to answer this question more precisely is to give you the code; at that point, I've done your entire project for you.
I am now self-banning from this thread.  We've hammered the nail into the board and kept hammering until it fell out the other side.  I'm not sure why there is still a problem here.  I'd really suggest that, if you still don't understand, you find someone who knows your language to explain it.

My Blog
Twitter: @ajhicks1992

2014-10-15 20:16:49

I'm pretty sure you can find open source solutions that have already done this entire process as well. I honestly don't really think it's a language issue, since he seems to understand terminology. repeatedly stating that as the issue and forcing compliance really isn't the way to go here. I'd recommend the lupa package for python as a starting point, or angelscript. Python can also be embedded (though I don't really know enough to verify if it'd work). Are you aiming for any particular language type?

Deep in the human unconscious is a pervasive need for a logical universe that makes sense. But the real universe is always one step beyond logic.

2014-10-15 21:41:32

i have to mention i can run the script!, but i want to create executables from it!
what framework can i use that add's executable header, resolve simbles, etc
i'm not saying to do my project, the problem is you are thinking rong, you say write a script witch your application load's it!, but if you've read the topic, i've said how to create an executable for the script file that is compiled into bytecode?
again, i've developed that part that can run the script, but now, i want to implement it's compiler that turns the scripts into executable file in windows, *.exe

2014-10-15 22:19:55

Damn it, visualstudio! This is getting wayyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy out of hand! We've told you again and again that you cannot create executables from simple scripts yet! Your not experienced enough to do that! Unless, of course, you are able to turn the entire script, line by line, into assembly language, which then can be assembled by a compiler! As Camlorn said, we've nailed the nail into the board until it fell out the other side trying to help you out with this. You need to ask a computer expert in your local country if you really need to understand it. If you keep asking the same question over and over in different ways, your going to annoy us so much that we're going to need to close this thread! All I've seen on this damn thread is you asking "How do I make a compiler?" or, "How do I make executables with a programming language?" when we've told you, time and time again, that you shouldn't make a compiler or try to make executables yet! Sure, mz is the systems-compliant executable format, but stop trying to build executables out of other executables unless you know what your doing! This is a very dangerous road your going down, visualstudio. Not on the forum, but on your computer. An executable ahs to be a perfectly made one, with no errors that the processor can find. A program should only have logic ones at most. If the processor faults on another computer, the owner of said computer is going to find a way to contact you and start complaining about it, and there's nothing that you can do because you don't know assembly language. Can you just lay off the "make a compiler" thesis until you're actually ready for it? If you don't, one of these days I'm going to get so angry at you that I'll get banned myself, and I don't want to be banned again. And if I am banned, this time, it'll be a legit reason to ban me, unlike the other time, which wasn't true at all, and in fact was of someones bad observation techniques. Taht someone, I will not name.

"On two occasions I have been asked [by members of Parliament!]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out ?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."    — Charles Babbage.
My Github

2014-10-15 22:46:27

Well, actually, there's two questions going on here.  I have covered the second one, but I'll repeat it one more time.
Writing a compiler? You don't have the experience for doing that quickly.  None of us really do.
But two points:
First, there is no functional advantage to actually putting the script into an executable.  The user will barely notice.  It is still just as easily hackable.  Putting the script outside the executable as a file and distributing as a zip that you extract is 100% okay, and you're going to have to do that anyway.  The user will want to distribute sounds, after all.
Second, you can do so easily by requiring the end user to install a C compiler.  Write the executable to run the script from a base64-encoded string literal, but intentionally leave out that literal.  When packing the program, package the scripts into the base64 string by inserting the base64-encoded representation of the file at the appropriate place in the source file.  I believe I said something like this before.  Problem solved, no framework required, the end.  Given the amount of effort needed to modify an already-compiled executable, it's not worth doing so for those users who can't bear to distribute the bytecode as a file--i.e. none.
But if you're dead set on this, pull out Google and find something.  I'm sure someone has written a library to modify a compiled executable.  But we can't help you.  None of us have done it to my knowledge; I don't think any of us would.  The gains are truly and simply not worth it.  But you can, if you want, and I certainly can't stop you.  Just use a cheap trick and stop there.  I promise no one will notice except for you.

My Blog
Twitter: @ajhicks1992

2014-10-16 00:23:39

I think he wants to make some wrappers for C++, for instance a “sound” class to play sounds, like that found in BGT. Also other functions and classes, easier to use. He wants to have an editor, or something like this where users to write code using his classes and functions, after, that code to be compiled.

I think this is his thought.

Yes, this kind of classes would be useful for many users, I remember my first app in C++ with Wind32.dll, too many lines for a simple task, even just for a blank window.
Maybe some users will prefer to have a game in C++, if they would have a function like: “createMainWindow(“My Game”)”; a sound class with methods like: load()play(), playWait() etc.

If you do first these wrappers, we will test them with Visual C++ Express for instance, we want just to include your files and we will test all these classes and functions. Finally, the code will be compiled, of course, but just for now, let’s use an existing compiler, give use some useful classes for Audio games.

In future, a solution would be to create your editor for C++, where in menu to be found classes for audio games. After the code is written, the code can be compiled through command line, some commands sent by your editor.

Emanuel Boboiu
Errare humanum est, sed perseverare... diabolicum.
For other Audio Games and programs, visit www.scripts.pontes.ro!

2014-10-16 06:23:04

No one has said anything about C++.  In fact, this entire thread has been about how to *not* be C++.  I'm not sure where this particular conceptual leap came from.  I would not write an audiogame in C++ under most circumstances: there is nothing there that I can't get elsewhere, and elsewhere is simpler by far.  Goodbye, manual memory management.  Goodbye, falling back to C apis and raw pointers for half the world.  Yeah, you can write wrappers...but why?  Why would you subject yourself to such mortal agony?

My Blog
Twitter: @ajhicks1992

2014-10-17 02:21:55

Yes, I read that, he wants to avoid C++, but I continue to think that he thought to C++ without knowing that. smile
Good luck!

Emanuel Boboiu
Errare humanum est, sed perseverare... diabolicum.
For other Audio Games and programs, visit www.scripts.pontes.ro!

2014-10-17 07:00:09

i want to avoid use of C++ because of pointers and memory leeks
because of that i've started this topic to develop an executable compiler for my engine
firstly, executables are not something that you are thinking
in the start, they have a header
variables and simbles most be resolved in there locations
it has a footer at the end
it has a main entrypoint in the header witch mentions what function should be called when the application starts
your functions and classes must be copyed into executable or a DLL and the executable can call them
secondly, i havent found anythink for COFF, for elf, i have libelf witch loads and edits elf executables

2014-10-17 16:44:48

Hmmm, visualstudio. I'm not getting you now. This doesn't make any sense. It is very difficult and very uncommon for someone to develop a compiler in another language other than C/C++. There is a way to avoid memory leaks and other memory-related issues, however! Check out the Dlib C++ Library and the memory_manager class from that library. There is also the memory_manager_global and the memory_manager_stateless classes that you may use.

"On two occasions I have been asked [by members of Parliament!]: 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out ?' I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question."    — Charles Babbage.
My Github

2014-10-17 22:10:43

Actually, if I developed a compiler, I'd not use C++.  My understanding is that he wants to use C++ for the engine, but maybe I'm misunderstanding something.  Still, nothing says you can't develop the compiler in another language or, as is actually very common, in the language that the compiler compiles (really).
Now, to be quite frank, perhaps even blunt.  Visualstudio, it's abundantly clear that you don't understand your problem.  I know what an executable is, and the method I posted does *exactly* what you need.  The things you are suggesting take a project that is very, very simple and make it very, very complicated.  I think that I'm not alone when I say that you don't seem to understand your problem at all, and most of your posts don't seem to be replying to what other people say.  I think that your English is too poor for us to have such a technical conversation.  I'd strongly recommend looking for a forum of programmers speaking your native tongue and asking there.  I've given you solutions.  You're choosing to ignore them.
If you are dead set on a compiler that you write yourself, please understand that you are in the realm of the so-caled "learning project".  That is, it will be a project that no one is going to be able to use for a very long time if ever, and it will simply serve as a stepping stone to let you contribute to other compilers.  I'm sorry if this isn't what you want to hear, but it is a fact.  If you were experienced enough to write a commercial-grade compiler by yourself, you would certainly not be asking this question and it's extremely doubtful you'd be asking here.

My Blog
Twitter: @ajhicks1992

2014-10-18 05:09:52

ok!, thanks ethin, i'll release it as a C++ library
my goal is to avoid memory leeks and you've helped me a lot
i have dlib c++ library and i've forgot about that!
thanks