Pawn Linting/Static Analysis
#1

With ~100 second compile times and the astounding ability to miss semicolons and other basic syntax after almost a decade of writing this language I am considering writing a static analysis tool for Pawn (most likely as a Sublime Text plugin).

This idea is actually mostly just for the experience of writing code to parse code (which I have done in the past, but I didn't use tokenisation or an AST) that's scope-aware.

The first bit would be to write a Pawn AST parser that's #include aware, function aware, recursion aware and a few other things. Next, I'd work on variable detection, "type" (tag) checking and small stuff.

I'd love to have some feedback from the community about this (if you all still exist of course!) would you use an analysis tool? (I'd probably write it regardless, it sounds fun... somehow) Have any of you experienced working with parsing source code or writing compilers (admittedly not totally related but still somewhat) before?
Reply
#2

http://forum.sa-mp.com/showthread.ph...tatic+analysis

Still interested! I've bumped into AST when trying to create drag'n'drop samp gamemode generator (first try in php, then in node) - it's a tough cookie, even tho there exist cool robust libraries just for that - still it's just a first step. Team Sublime master race. Best of luck to you!
Reply
#3

Great to see some interest! I was thinking of getting a C linter and adapting it to support tags and Pawn qualifiers (native, public, etc) but I'll probably get bored of working with another codebase. I may use it as a starting point to learn though (the original lint source code is somewhere, splint is the modern version).

If you're into spaghetti python code though I wrote a tool to grab Pawn function names a while ago and it still gives me headaches!

I'll probably use Python for this project too since speed won't be an issue and it's the language I'm most comfortable with. I'll update this thread once I have a starting point on GitHub!
Reply
#4

I'm definitely interested! I'll contribute if and where possible. Good luck!
Reply
#5

Extreme Studio is going to feature static analysis.

I've thought about making a VS plugin to support PAWN.

And yes I'd be interested in your tool, especially if it was for Notepad++.
Reply
#6

you can compile with -l for some compiler then check one file without any preprocessor and compile that again

so to compile code once as -l
then check .lst instead of code - no files and no preprocessor neede
then compile .lst instead of code
Reply
#7

Quote:
Originally Posted by OneDay
Посмотреть сообщение
you can compile with -l for some compiler then check one file without any preprocessor and compile that again

so to compile code once as -l
then check .lst instead of code - no files and no preprocessor neede
then compile .lst instead of code
Actually this was considered for ES, but was quickly determined the wrong way to go.
Reply
#8

Why?
Reply
#9

Quote:
Originally Posted by OneDay
Посмотреть сообщение
Why?
Because our lexer was better.

I have no doubt that Southclaw could make a great lexer also.
Reply
#10

Hello everyone,

any progress on this? or does anyone know about the existence of 'Linting/Static Analysis' tools that could be used 'non-interactively' aka from an automated script/job ?
Reply
#11

Quote:
Originally Posted by xxmitsu
Посмотреть сообщение
Hello everyone,

any progress on this? or does anyone know about the existence of 'Linting/Static Analysis' tools that could be used 'non-interactively' aka from an automated script/job ?
I also wonder about that, it would be awesome if we could have something like this in Sublime Text 3.
Reply
#12

Quote:
Originally Posted by Jayse
Посмотреть сообщение
I also wonder about that, it would be awesome if we could have something like this in Sublime Text 3.
Extreme Studio. Built for PAWN, built for SA-MP.

Still in development but currently slow since the developer has a bunch of school shit going on right now. Me and him are pretty tight. In fact, I designed the logo and banner of the program.
Reply
#13

An IDE wouldn't be so useful for me. I was looking more into something like a tool that could be used 'non-interactively' to be able to automate Code Integration process.
Reply
#14

Quote:
Originally Posted by Crayder
Посмотреть сообщение
Extreme Studio. Built for PAWN, built for SA-MP.

Still in development but currently slow since the developer has a bunch of school shit going on right now. Me and him are pretty tight. In fact, I designed the logo and banner of the program.
But it can't be good like Sublime Text 3, not to mention it can't be customized with plugins. I'm not saying it isn't good, it's really useful but Sublime Text 3 has more features that I would like to use while scripting, with such a feature implemented would make it more awesome!
Reply
#15

I'd love to see this and I'd be willing to contribute to what is described in the OP.

On a personal note I'd prefer seeing this in Atom than in Sublime, as I find it easier to use.
Reply
#16

I am still working on this, don't lose hope!

It will be a CLI + Plugin so automation for CI/builds will be possible like flake8/ESLint/Clint etc.

I am aiming to make the functionality similar to Anaconda's with warnings on save and live underlines/highlights of problems such as unused labels, undefined labels and maybe even some include structure/importing stuff.

And since it will be a CLI program, porting to other editors should be easy.
Reply
#17

Honestly, I'd most rather see this on a VS plugin...

It is very much possible to port languages to VS and I've never seen it done for PAWN!
Reply
#18

Well once the linter is available, it can be ported to anything. Not sure how open Intellisense is, I'm not a huge fan of the text editor in VS anyway but once it's done I don't imagine hooking an executable script up to an editor is too hard anyway!

I'm currently still in the AST stage of things anyway, once I get this down the rest should be simple.
Reply
#19

Quote:
Originally Posted by [HLF]Southclaw
Посмотреть сообщение
Well once the linter is available, it can be ported to anything. Not sure how open Intellisense is, I'm not a huge fan of the text editor in VS anyway but once it's done I don't imagine hooking an executable script up to an editor is too hard anyway!

I'm currently still in the AST stage of things anyway, once I get this down the rest should be simple.
I prefer Notepad++, I just haven't seen PAWN used in VS. I was just saying I think it'd be interesting to have PAWN in VS.
Reply
#20

Hi there!

Any news of this progress, or ETA available?
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)