| 12-16-2003, 01:27 PM | #46 |
I've added som syntactic shortcuts , thanks to silverdrake for provifing me with code to work on. Also take care to put <> araound all filenames in any include and includetable statements. Hope this won't cause to much trouble. |
| 12-21-2003, 05:41 AM | #47 | |
Quote:
Actually, it'd probably be best if all the precompiled code was commented out, so that WE would save it. Then you'd just run precompiler afterward. Simpler. |
| 12-21-2003, 12:46 PM | #48 |
If someone can come up with a code-example on how to use the WE and extended syntax I would be happy. It should't be a problem to run the precompiler on the map when WE is done with it. |
| 01-04-2004, 05:30 AM | #49 |
Is this acceptable syntax? Code:
function main takes nothing returns nothing
local integer i
local integer j
Sleep(2)
for (i = 0; i < 10; i+=2)
j = 0
while j < 5
print("Hello, World!")
j++
endwhile
endfor
endfunction |
| 01-04-2004, 06:20 AM | #50 |
Consider this syntax converter very alpha... It has no support for includes, its purpose is to show how an extended syntax could look. Please suggest improvements and additions. This might also be fun, right? Code:
function peasant takes unit u returns nothing
print("Peasant online")
endfunction
function main takes nothing returns nothing
local group g = CreateGroup()
local unit u
loop
Sleep(2)
GroupEnumUnitsOfType(g, "peasant", null)
forgroup u g // <---------
peasant(u)
endforgroup
endloop
endfunction |
| 01-04-2004, 11:00 PM | #51 |
Wow, this looks neat, and I prefer the first syntax you put up there. |
| 01-05-2004, 12:06 AM | #52 |
I kind of plan to support both of above code-examples. 8)) |
| 01-05-2004, 04:20 PM | #53 |
After a little more thought about this whole thing, I think I really like it :) If you make the output simple (optionally more verbose output), it would be easy to fit into good editor (I recommend textpad), or create a seperate program that takes code from a source (running program, file), runs it through your precomiler, and outputs the result into the WE. Since I already got textpad to syntax color JASS code, a program like this would be great, if it includes syntax checking :) My personal preference concerning syntax is more Java/C++/PHP like. I think most advanced JASS coders here would probably prefer that. If they don't, they will in the future, when they actually start to use any of the above mentioned languages. I suppose you know what Java syntax looks like, but for those that don't: Code:
function PolarProjectionBJ takes location source, real dist, real angle returns location
local real x = GetLocationX(source) + dist * Cos(angle * bj_DEGTORAD)
local real y = GetLocationY(source) + dist * Sin(angle * bj_DEGTORAD)
return Location(x, y)
endfunction
--->
location PolarProjectionBJ(location source, real dist) {
real x = GetLocationX(source) + dist * cos(angle * bj_DEGTORAD);
real y = GetLocationY(source) + dist * sin(angle * bj_DEGTORAD);
return new location(x, y);
}
forgroup(unit picked in mygroup) RemoveUnit(picked);
// yes that's more Javascript like :)
I just found a really old parser I wrote in Perl for a PHP like syntax. I made my own library of functions for parsing the code. I'll strip out the useless stuff and post what I got here soon. You can probably code a syntax checker extremely easy with it, since you almost directly input the syntax definition (forgot the acronym). |
| 01-05-2004, 09:56 PM | #54 |
Attached is my old compiler for a PHP like language. I have added a bunch of comments this evening; don't have time to strip it and alter it for JASS right now. It's pretty easy to understand, and with a little work, would make a wonderful JASS syntax checker and/or precompiler. Oh yeah, you call ctst.pl to compile a file. The test.cts file is a very small sample. It outputs the generated Perl code (which requires a different 'engine' to run). Sorry for double post :) |
| 01-08-2004, 05:32 PM | #55 |
Thank you! I will investigate your compiler. |
| 01-09-2004, 09:32 AM | #56 |
I'm working on making a JASS syntax checker using those scripts. If you could hang on for a couple of days, I'll upload it here. |
| 01-10-2004, 10:04 AM | #57 | |
Quote:
where can i find that documentation? |
| 01-10-2004, 05:44 PM | #58 |
Under Misc Tutorials (Inside W3M) BTW, Vidstige, how is the Precompiler going? The tables for AMAI are pretty much complete now so a Precompiler with all the IncludeTable functionality is needed (I guess I could work with the last one as a workaround but the code will be much uglier this way). |
| 01-10-2004, 09:57 PM | #59 |
I finished the parser, but it's uhm, slow. Also, it only shows 1 error at the moment. I'm optimizing and fixing things, but don't get your hopes up. It currently takes 22 seconds to parse bliz.j. Yeah I suck :( |
| 01-11-2004, 04:01 AM | #60 |
The Jass Pre-parser version 0.0.11 is finally here. Its main additions from last version (0.0.9) is better support for including tables. The support for syntactic short-cuts is at this moment neither extensive, good, or to be fully trusted. I have been experimenting with more advanced short-cuts than currently supported and will try to add support for while and for loops later today. |
