I wanted to know, how could one integrate the use of JFlex and Cup into JMonkeyEngine?
I know there is a plugin for Eclipse, but there doesn’t seem to be one for Netbeans (which JDK is based upon, if I’m not mistaken), although it seems there are syntax highlight possibilities…
Is there a simple way to achieve this, or should I stick to the use of Windows’ terminal?
Be able to use JFlex and Cup into JMonkeyEngine, having automatised compilation, so that I can write a parser for a script language that I’ll use in my game.
Well, my problem is not to use it with the rest of my java files; but to be able to call JFlex and Cup (via Ant?) directly from JME SDK to parse my lexer and parser files, and then compile them.
btw you do know that java intself has internally already a scripting engine that supports for example javascript, that is performance wise fine.
(Also as you intend to use it only via developing and not live, why do you want a specialized script language for this? As in what is the benefit you want compared to using plain java.
I’m building my own scripting language, for a self-made game engine. The language is used to define a basic API which correspond to a Java written API.
The script is then “compiled” into bytecode (a hand made bytecode, too, which is already done) so that I execute only “atomic” instructions (in the meaning that it correspond to a small Java method, being very fast to execute).
The future user of my engine can then use the language to make something like :
[java]
function createWave takes nothing returns nothing
Unit u = noUnit;
for each Integer i from 0 to 9
u = createUnit(unitType, position);
orderUnitToPoint(u, orderType, point);
end for
end
[/java]
The benefit is that this way, I can manage to switch between different bytecode execution, thus allowing the use of a sole thread and not having the problem of cross threading and object locking time, etc. Also, I can know exactly the execution state of the script and can then save it easily, to reload the game later.
@nomen : Hum… Could you tell what I’m supposed to look for? I mean, how it would be called? I’m feeling dizzy when browsing this very long FAQ ‘_’…
Into Cup’s doc, I’ve found the following way to integrate it into an ANT build file :
[java]
<taskdef name=“cup”
classname=“java_cup.anttask.CUPTask”
classpathref=“cupclasspath”
/>
[/java]
and
[java]