6 ms·
How to develop statically un-analyzable PL
- l3r8y 4y agoHere I talk about how you should design a programming language for no better static analysis.
- Ygg2 4y agoAdd a decent macro system. Or any meta programming facility.
- l3r8y 4y agoOkay, I'll definitely read about it and try to add, thanks!
- WastingMyTime89 4y agoHaving professionally worked on static analysers for bit, I deeply disagree with this article. It’s basically a list of things which are slightly complex to do with an analyser (and even then, point 1 is syntactic sugar which is trivial and shouldn’t be here at all) not things which make a PL un-analysable. Analysing constructs which are a bit complex is the whole point. If things were trivial, there would be no need for static analysis in the first place. It reads like something written by a student annoyed they have to do work.
- rurban 4y agoExactly. Static-analysis might be costly, but still can follow all possible paths. Just the proof of termination might be too hard - while (1) {...} -, or side-effects are different, are but still the analyser must do its work. Same as a type checker, and on this analysis we must be able to rely on.
- anonymousDan 4y agoI agree. I think there is potentially an interesting article to be written about the topic, but this isn't it. The understanding of what makes static analysis hard comes across as pretty shallow. I liked this online course (https://m.youtube.com/watch?v=EG9lz3ncanI https://m.youtube.com/watch?v=EG9lz3ncanI) and of course Nielsen's book is good but pretty technical (https://link.springer.com/book/10.1007/978-3-662-03811-6 https://link.springer.com/book/10.1007/978-3-662-03811-6). Would be interested in any other recommendations for good resources!
- HybridCurve 4y agoIntroduction to Static Analysis by Xavier Rival and Kwangkeun Yi is not as heavy on the mathematical notation as the Nielsen book.
- l3r8y 4y agoThanks for your resources too!
- l3r8y 4y agoYes, you are right, I am a student who is starting to do static analysis, but it doesn't annoy me) I also want you to say that I am not analyzed here as part of the general irony, I don't think anyone should take it seriously, anyway if you can write me what you think makes language difficult to analyze, I would love to read it and add it)
- WastingMyTime89 4y agoI am not sure I understood the second part of your sentence but sorry if what I wrote sounded harsh. It's easy to forget that you might be read by the person who actually wrote the article. I don't think that what you wrote is worthless. I just disagreed. > anyway if you can write me what you think makes language difficult to analyze, I would love to read it First, I can give you exemples of things which are notoriously hard to analyse in any language: order of execution dependent behaviours when parallelism is involved, floating point arithmetic, heavily runtime dependent behaviours. Regarding languages features, anything which limits the amount of guarantee you can give about semantic units make analysis more difficult (well, a lot less useful at least). Languages were non local changes can heavily influence what's happening are notoriously hard to analyse for exemple. As a worst case scenario, you can consider a language with no namespacing, global scoping, global visibility, global accessibility and first-class functions (it sounds silly but I have used languages for symbolic computation which work like that). Now, you have to consider the whole execution context to know the value of identifiers including functions. You can give no garantee whatsoever on the value of anything in isolation.
- l3r8y 4y agoThe number of comments with amendments forced me to do a second part. I will try to read and take into account all that have written today, thank you again)
- fooker 4y agoStatic analysis is almost never done on source level AST. Compilers already have intermediate representations (usually CFG) which are much more amenable for static analysis. Also, C++ has all of these and there are several static analyzers for C++.
- l3r8y 4y agoThank you, I will pay attention to that!