3 ms·
Using Pegs in Janet
- abound 1y agoFor 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/ https://janet.guide/pegular-expressions/
- fithisux 1y agoAre pegs easier for syntax highlighting or LSPs?
- conartist6 1y agoThey'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
- fithisux 1y agoYes I know, but are they making LSP server construction easier?
- veqq 1y agohttps://janetdocs.org/ 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 https://github.com/sogaiu/janet-peg The LSP used on vscode works with PEGs also: https://github.com/CFiggers/janet-lsp/blob/ca526aee35c60bcf511cc9475f876385b0b111a4/src/parser.janet#L47 https://github.com/CFiggers/janet-lsp/blob/ca526aee35c60bcf5...
- andersmurphy 1y agoThe part I really like about pegs in janet is it works on bytes.
- ktpsns 1y agoReminds me of raku (perl6) grammars https://docs.raku.org/language/grammars https://docs.raku.org/language/grammars