hi all
as my topic title says,
i want to create a compiler for my game engine
but, i dont know how can i parse AngelScript's scripts and provide instructions for compilation with llvm
now, what you recommend to me?
what should i do?
hi all
as my topic title says,
i want to create a compiler for my game engine
but, i dont know how can i parse AngelScript's scripts and provide instructions for compilation with llvm
now, what you recommend to me?
what should i do?
Do you know how to use LLVM? Do you understand lexing and parsing? AST traversal, etc.?
No, then that's probably where you should start. LLVM has a short series of tutorials on using it, and there's always the dragon book.
Of course, the first stage should be Google. Or basic research. Simply tossing a bunch of words together and going "HOW I DO?" without a bit of prior research is a bad idea.
but, i dont know how can i parse AngelScript's scripts and provide instructions for compilation with llvm
AngelScript already has a compiler. What exactly do you hope to accomplish by writing a new one?
Washu, on 31 Jul 2014 - 1:32 PM, said:
Do you know how to use LLVM? Do you understand lexing and parsing? AST traversal, etc.?
No, then that's probably where you should start. LLVM has a short series of
tutorials on using it, and there's always the dragon book.
Of course, the first stage should be Google. Or basic research. Simply tossing a bunch of words together and going "HOW I DO?" without a bit of prior research is a bad idea.
?
yes, if i want to create a new scripting language, i use spirit and use LLVM kaleidoscope to get started with it
and then i'll read other tutorials
?
swiftcoder, on 31 Jul 2014 - 5:26 PM, said:
brightening-eyes, on 31 Jul 2014 - 12:18 PM, said:
but, i dont know how can i parse AngelScript's scripts and provide instructions for compilation with llvm
AngelScript already has a compiler. What exactly do you hope to accomplish by writing a new one?
i want an executable compiler, something that get's the script and compile it into executable
maybe i use spirit to create a new scripting language for myself, but if you know about AngelScript, i'm here to lisson
of course yes, LLVM is a compiler, and the modules must be linked together to create an executable
and about that compiler, i've saw it before
it turn's AngelScript's scripts and turn them into C++ code, and i dont need that
i want to create a compiler that turn's a set of scripts and then link it together and create an executable
LLVM is a compiler
LLVM is not really a compiler. It's more of an set of optimizer passes attached to an assembler, that defines a (mostly) portable assembly language, and happens to provide some libraries to help compiler developers.
You still have to write a good portion of the compiler yourself. At the very least, the lexer/parser, type checker and code-gen layers.
i want to create a compiler that turn's a set of scripts and then link it together and create an executable
Why?
If it's for an academic exercise, fair play to you. Go ahead and do it. Invent your own language, write the compiler, write the linker. You WILL learn a hell of a lot.
If you want it for a game, well that's a different matter.
Re-inventing the wheel is never a good thing for productivity, it's fun sometimes. If you literally re-invent the wheel, make it an octogan and change roads to have a matching set of notches, then do the maths, you find definite advantages for the new wheel over the old one.
However don't hold your breath waiting for the world to catch on and change to wheel 2.0
When it comes to games coding re-inventing the wheel nearly always ends up with coding hours wasted, productivity stalled, game delayed. It's even worse for hobby coders. Then you just see projects disappear completely.
If you want a scripting system that can be precompiled, there are plenty. You can use C# and compile it on the fly during development, then link the source code into the game for release.
You can use lua and read from hard disk during development, then package them up into binary files for release.
Hell I've even seen Forth used as a scripting system.
It's up to you in the end, but I would advise you to decide what is "Fun" for you and just code that.