SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Discussion

Reply
 
Thread Tools Display Modes
Old 28/07/2016, 03:25 PM   #1
[HLF]Southclaw
High-roller
 
[HLF]Southclaw's Avatar
 
Join Date: Apr 2009
Location: England
Posts: 4,943
Reputation: 1471
Lightbulb Pawn Linting/Static Analysis

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?
__________________
Tools:

Plugins:

Links:

[HLF]Southclaw is offline   Reply With Quote
Old 28/07/2016, 03:55 PM   #2
Misiur
High-roller
 
Misiur's Avatar
 
Join Date: Jul 2009
Location: Poland
Posts: 2,537
Reputation: 552
Default Re: Pawn Linting/Static Analysis

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!
Misiur is offline   Reply With Quote
Old 28/07/2016, 04:35 PM   #3
[HLF]Southclaw
High-roller
 
[HLF]Southclaw's Avatar
 
Join Date: Apr 2009
Location: England
Posts: 4,943
Reputation: 1471
Default Re: Pawn Linting/Static Analysis

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!
__________________
Tools:

Plugins:

Links:

[HLF]Southclaw is offline   Reply With Quote
Old 28/07/2016, 06:38 PM   #4
AndySedeyn
High-roller
 
AndySedeyn's Avatar
 
Join Date: Feb 2014
Location: Belgium
Posts: 1,332
Reputation: 681
Default Re: Pawn Linting/Static Analysis

I'm definitely interested! I'll contribute if and where possible. Good luck!
AndySedeyn is offline   Reply With Quote
Old 28/07/2016, 06:56 PM   #5
Crayder
High-roller
 
Crayder's Avatar
 
Join Date: Sep 2013
Location: Flames of Hell
Posts: 3,862
Reputation: 594
Default Re: Pawn Linting/Static Analysis

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++.
__________________
Those who deserve reputation, do not need to beg for it.
Also, don't expect the help you need when offering reputation, you'll just be attracting Rep Hunters.
Join SA-MP Discord!
Crayder is offline   Reply With Quote
Old 08/08/2016, 03:26 PM   #6
OneDay
Huge Clucker
 
Join Date: Sep 2015
Posts: 292
Reputation: 126
Default Re: Pawn Linting/Static Analysis

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
OneDay is offline   Reply With Quote
Old 08/08/2016, 04:23 PM   #7
Crayder
High-roller
 
Crayder's Avatar
 
Join Date: Sep 2013
Location: Flames of Hell
Posts: 3,862
Reputation: 594
Default Re: Pawn Linting/Static Analysis

Quote:
Originally Posted by OneDay View Post
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.
__________________
Those who deserve reputation, do not need to beg for it.
Also, don't expect the help you need when offering reputation, you'll just be attracting Rep Hunters.
Join SA-MP Discord!
Crayder is offline   Reply With Quote
Old 09/08/2016, 01:03 PM   #8
OneDay
Huge Clucker
 
Join Date: Sep 2015
Posts: 292
Reputation: 126
Default Re: Pawn Linting/Static Analysis

Why?
OneDay is offline   Reply With Quote
Old 09/08/2016, 06:15 PM   #9
Crayder
High-roller
 
Crayder's Avatar
 
Join Date: Sep 2013
Location: Flames of Hell
Posts: 3,862
Reputation: 594
Default Re: Pawn Linting/Static Analysis

Quote:
Originally Posted by OneDay View Post
Why?
Because our lexer was better.

I have no doubt that Southclaw could make a great lexer also.
__________________
Those who deserve reputation, do not need to beg for it.
Also, don't expect the help you need when offering reputation, you'll just be attracting Rep Hunters.
Join SA-MP Discord!
Crayder is offline   Reply With Quote
Old 15/11/2016, 11:08 AM   #10
xxmitsu
Gangsta
 
Join Date: Feb 2009
Posts: 623
Reputation: 36
Default Re: Pawn Linting/Static Analysis

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 ?
__________________
aka xanto - Retired - Former eGaming.ro technical staff.
xxmitsu is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Static NPC - Help Lumabd Scripting Help 1 08/07/2015 04:42 AM
[Ajuda] Static! Wallker Português/Portuguese 6 04/08/2012 07:51 PM
[Tool/Web/Other] PAWN Scanner - Scan PAWN files for information. Slice Tools and Files 10 15/07/2012 07:09 PM


All times are GMT. The time now is 06:38 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.