Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Using Pegs in Janet (inqk.net)
55 points by Bogdanp 16 days ago | hide | past | favorite | 7 comments


For a bit deeper intro to PEGs in Janet, the Janet for Mortals guide [1] is pretty incredible here (and also uses HTML as an example).

[1] https://janet.guide/pegular-expressions/


Reminds me of raku (perl6) grammars https://docs.raku.org/language/grammars


The part I really like about pegs in janet is it works on bytes.


Are pegs easier for syntax highlighting or LSPs?


https://janetdocs.org/ does (server side) syntax highlighting through hiccup-lexer which converts janet-peg's tokens to hiccup: https://github.com/sogaiu/janet-peg

The LSP used on vscode works with PEGs also: https://github.com/CFiggers/janet-lsp/blob/ca526aee35c60bcf5...


They're not really the same kind of thing. LSP is a carrier format, but it doesn't know or care how you parse things, whether it's with PEGs or an earley parser or shift reduce or whatever


Yes I know, but are they making LSP server construction easier?




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: