Jump to content

LordGolias

Member
  • Content count

    2
  • Joined

  • Last visited

  • Medals

Community Reputation

6 Neutral

About LordGolias

  • Rank
    Newbie
  1. SQF parser and static analyser

    yes, I wrote the parser myself. Thanks!
  2. I am presenting to the world a parser, static analyzer, and interpreter of SQF, along with a front-end for using it in Atom. Here is an example of what you get on your screen. In a nutshell, the backend parses SQF code in Atom and spits errors back to the interface. It currently supports most of the basic functionality like * assignment, private, params, global variables, and scopes * math, comparison and logic operators * control operators (if, switch, for, while, etc.) The code is available here: backend linter-sqf This is WIP but I believe that it can already help people identifying issues in the code, avoiding the frustration of finding small errors by restarting the mission in the Editor, etc. In the long term, this has the potential of becoming the de-facto static analyzer of SQF. It was tested in Atom installed both in MacOS and Windows 10 (with powerShell). For the experts: this is not an ad-hoc solution to the problem; it uses a proper parser that builds a lexical tree of SQF statements. The backend is extremely powerful and very well maintained (99% of test-covered), and allows for very complex stuff like running SQF code in an emulated environment: from sqf.interpreter import interpret interpreter, outcome = interpret('_x = [1, 2]; _y = _x; reverse _y;') # outcome equals to "Nothing" # interpreter['_x'] equals to Array([Number(2), Number(1)]) # interpreter['_y'] equals to Array([Number(2), Number(1)]) The static analyzer does not use the interpreter and thus cannot detect syntactic errors that can only be resolved at run-time, but it does a pretty decent amount of syntax checking (including missing privates). Help on this endeavor is obviously highly appreciated!
×