SA-MP Forums Archive
Pawn Linting/Static Analysis - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Discussion (https://sampforum.blast.hk/forumdisplay.php?fid=84)
+---- Thread: Pawn Linting/Static Analysis (/showthread.php?tid=613510)

Pages: 1 2


Pawn Linting/Static Analysis - [HLF]Southclaw - 28.07.2016

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?


Re: Pawn Linting/Static Analysis - Misiur - 28.07.2016

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!


Re: Pawn Linting/Static Analysis - [HLF]Southclaw - 28.07.2016

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!


Re: Pawn Linting/Static Analysis - AndySedeyn - 28.07.2016

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


Re: Pawn Linting/Static Analysis - Crayder - 28.07.2016

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++.


Re: Pawn Linting/Static Analysis - OneDay - 08.08.2016

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


Re: Pawn Linting/Static Analysis - Crayder - 08.08.2016

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.


Re: Pawn Linting/Static Analysis - OneDay - 09.08.2016

Why?


Re: Pawn Linting/Static Analysis - Crayder - 09.08.2016

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

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


Re: Pawn Linting/Static Analysis - xxmitsu - 15.11.2016

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 ?


Re: Pawn Linting/Static Analysis - Jayse - 16.11.2016

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.


Re: Pawn Linting/Static Analysis - Crayder - 16.11.2016

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.


Re: Pawn Linting/Static Analysis - xxmitsu - 16.11.2016

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.


Re: Pawn Linting/Static Analysis - Jayse - 16.11.2016

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!


Re: Pawn Linting/Static Analysis - Hiddos - 17.11.2016

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.


Re: Pawn Linting/Static Analysis - [HLF]Southclaw - 17.11.2016

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.


Re: Pawn Linting/Static Analysis - Crayder - 17.11.2016

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!


Re: Pawn Linting/Static Analysis - [HLF]Southclaw - 17.11.2016

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.


Re: Pawn Linting/Static Analysis - Crayder - 17.11.2016

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.


Re: Pawn Linting/Static Analysis - xxmitsu - 08.02.2017

Hi there!

Any news of this progress, or ETA available?