Does the complexity of IDE error detection and completion depend on the language syntax?

Does it require less checks / less thorough code analysis to provide feedback on development environment errors and automatic completion for programming languages, which consist mainly of human-readable phrases and words (i.e. Python, VB.NET)? This differs from C-style languages, which are more dependent on characters and punctuation marks for the code structure.

+6
source share
1 answer

I have experience / responsibility for creating dozens of language interfaces .

Talkative and punctuation languages ​​are generally equally difficult for analysis and static analysis.

People who define languages ​​of any kind, either decorate them for decades (for example, COBOL since 1958), or build complex languages ​​(C ++, Scala, Ruby) with complex syntax and complex name resolution and rule type inference; compiler vendors then proceed to add obscure syntax to support the weird things they do, or to provide client locks (for example, "managed C ++" MS, DLL declarations, etc.). There is a third problem with lousy definitions; upper languages ​​can have clear rules about how they work, but many languages ​​have sloppy definitions (like PHP) that create dark angular cases that need to be eliminated due to painful experiments with the actual implementation.

C ++ was our worst, especially. with the C ++ 11 committee creating a massive recent mess of things. We have complete C ++ parsers, but they are still working on full name resolution for C ++ 11 on top of our implementation in C ++ 98. (The name resolution code is about 250,000 lines of code and not enough!).

IBM COBOL takes second place; the language is simply gigantic, and there are all kinds of ridiculous rules for resolving names ("an unqualified name can refer to a specific name without qualification if the link is unambiguous." So, is this name an unambiguous reference in this context?).

After you finish parsing and resolving the name / type, you get into the control flow, data flow, point analysis, anlaysis range, plotting calls ... which, as a rule, have the same amount of effort, earlier stages; we avoid less by having really good libraries that support these tasks.

With all of this as a background analysis, you can start doing a β€œstatic analysis" of the smart look that people want.

Another poster noted that recovery from syntax errors and (highlighting) "continue to generate meaningful error messages." All I can say is "Amen, brother." See this SO answer fooobar.com/questions/916357 / ... for a discussion of what goes wrong when you have "partial programs", which is essentially what you get when a syntax error correction guesses the correction .

+5
source

Source: https://habr.com/ru/post/916355/


All Articles