scriban / scriban

A fast, powerful, safe and lightweight scripting language and engine for .NET

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Formal grammar

binarycow opened this issue · comments

I think it would be useful to have a formal grammar for Scriban.

It may also be useful to tie in this work with updating the parser and lexer to ensure that we have agreement between documentation, grammar, and code.

Then, all future updates to any of the three, would necessitate updating all three.

Yeah! Understanding, how lexer works in details, I would add string interpolation (#476) much easier!

It is likely that Scriban has a few cases in its grammar that can lead to incorrect parsing, so that would be nice to have a formal grammar, but I will personally never have time/incentive to work on this.

Yeah! Understanding, how lexer works in details, I would add string interpolation (#476) much easier!

Frankly, I doubt that would help. Adding string interpolation requires to modify both the lexer and parser, and this can be done relatively easily. These two buddies are well identified in the source code, they are - almost - very conventional lex & parser, so the bulk of the work should be mostly laborious, but nothing complicated.