3 ms·
I like this grammar hack. ``` grammar = """ Response ::= "Alice\n" (ListOfCmds | SingleNaturalLangResponse) ListOfCmds ::= (BashCommand\n)+ BashCommand ::=
by going_ham 4y ago
I like this grammar hack.
```
grammar = """
Response ::= "Alice\n" (ListOfCmds | SingleNaturalLangResponse)
ListOfCmds ::= (BashCommand\n)+
BashCommand ::= "$ " AnyString
SingleNaturalLangResponse ::= AnyString without $"""
```
- greshake 4y agoI tried regular expressions as well, but BNF grammar seems to work best