Show HN: perl-lsp – annotation free static analysis for Perl

perl-lsp — a fast Perl language server in Rust with cross-file type inference, completion, goto-def, and rename. Built on tree-sitter-perl and tower-lsp. - tree-sitter-perl/perl-lsp
3 points by rabbiveesh 121 days ago github.com 1 comments
Summary not yet generated for this article.

Original Text

Built in Rust on top of ts-parser-perl and tower-lsp. Witness bags with graph traversal (value edges, call flow edges).

How it works: - builds witnesses and scopes by walking the parse tree. Fully known values get concrete types, otherwise they get an edge pointing to the last witness we have for this symbol - a worklist runs to a fixed point: reducers fold each symbol's witnesses and chase edges. At this point, the witness bag is complete and ready to use - all downstream features are queries into the bag, following along the graph edges that are relevant

Extensible - you can bring your own Rhai plugin to shortcut common patterns (exporters and OOP frameworks), or even add new types of definitions (worker tasks and web routes).

The build/query timing distinction with edges lets you late bind types, which is duly similar to how Perl itself works: `Foo->new` isn't known if it's the constructor for Foo or calling a method on the sub name `Foo`; late binding lets you make that call after the worklist folds.

Comments (1 of ) ⌛

Loading more comments... ⌛
Scroll down to load more comments
No comments available.
Type to search HN and engineering blog articles
Press Escape to close  |  ↑↓ to navigate  |  Enter to open