int a = 2;
int b = 3;
boolean b = false;
boolean c = true;
float f = 2.3456;
begin
if(b and c)
a = a + 2;
endif
while(true)
endloop
while(false)
;
endloop
f = f + 0.001;
f = f + 1;
if(a notequals a)
a = a;
elseif(a equals b)
a = b + 2;
else
f = a + b + 0.5;
endif
end
🎉 Celebrating 25 Years of GameDev.net! 🎉
Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!
Need help testing compiler interface (Applet)
I'm working on a scripting language, finished lexical analysis phase and working on type checking / VM code generation.
A prototype of the compiler can be seen at http://www.javaengines.dk/arenabots
It's inside an empty prototype that doesn't do anything, just press "test GUI", then when the window pops up, press "login", then "new robot", the big text-area is for code.
If you could mess around trying to create some scripts and "compile" them, note if something compiles that shouldn't, doesn't that should, weird error-messages etc.
Any suggestions/comments on GUI are welcome too.
code syntax: (inspired by C/Java and VB)
4 datatypes: int float boolean string
lines / whitespace / case unimportant.
//type and /*type comments ignored*/
the code has 2 parts, declarations(optional) and code(mandatory).
declarations are of the form:
type-specifier id = expr;
example = int a = 2;
code starts with "begin" and ends with "end"
between those keywords are 0-n statements, that are either assignments or control structures (a third kind of statement "external" will be added later to interact with the game, it has the form external-id(expr) and can be both a statement and an expression, but isn't implemented yet)
note that only assignments (id = expr) works inside code, not declarations.
All statements (except control structures that have other terminators) are terminated by ;
control structures:
if(expr)
statement-list
elseif(expr)
statement-list
else
statement-list
endif
while(expr)
statement-list
endloop
nonsense example:
***
For Java games and Java related resources, go to http://www.javaengines.dk
***
[edited by - blackone on May 23, 2003 6:12:28 AM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement