HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Script SYNTAX Checker

11-19-2002, 02:28 AM#1
DKSlayer
Ok I have heard many people say that they want a Syntax checker for scripts, or that writing scripts is hard, because it takes trial error and lots of paitience to write scripts. I have been working on a Script Editor, and have the basis working fairly nice. I would like know to work on the next main feature. A Syntax checker, This will require some majore coding. I would like some advice from people who program on how to pull this off.
Right Now, my plan is that you have the Blizzard.j and Common.j in the same directory as the editor.
----Function Naming----
For function naming, it would scan them till it hits the word function, then the next word (function name) is stored into an array. Then it goes through the script checking when it hits function the next word (function name) does not match any in the array, if it doesn't match it adds it to array. Can't be having two functions with same name. Also when it hits a ( it will look at the name before it makes sure there is a function with that name if not error there.
----Function Arguments----
This gets even more hairy, Although I am thinking I will have array's that store any takes and the return. the Array (number) will match so that when you hit a function with the same name it compares to make sure there are the required amount of arguments, Finding the type of the Entered Argument would be insane but still possible.
----Integers----
Would be done alot like the Function Naming. Using an array, once again the Type comparing stuff would be killer.
----Errors----
Like loops without a endloop.

I can't post all the stuff. But you get the Idea. I want real ideas, Ways to pull off this stuff, Also ways to speed up the process. Thanks Any help will spee this up.
Thanks
DKSlayer
11-19-2002, 03:30 PM#2
Guest
Don't forget to ignore comments. That should cut down on some time it will take to look for errors.
11-19-2002, 06:11 PM#3
AIAndy
Don't forget to allow that Blizzard.j is not used (for AI Scripts).
What you could do to save you a lot of coding is using a parser generator.
11-20-2002, 12:04 AM#4
DKSlayer
Yes I think I will have the opttion to say if you are writing a AI script or Custom Trigger, which turns off the corresponding thing.
Parser Generator? You will need to explain I have written a Parser but a Parser Generator?
11-20-2002, 12:51 AM#5
ph33rb0
This will definitely be tough.

I might be able to help a bit if you're working with VB but otherwise I don't know if I can do anything for ya.
11-20-2002, 10:27 AM#6
AIAndy
A Parser Generator generates you the code for the parser without you having to manually do it. In that a syntax check is already included and the generated code is usually very efficient compared to writing one yourself. You tell the Parser Generator how the language you want looks like and it generates the right code to use in your program.