The infinite loop was caused in src/parser/quote_expression.pir as follows: the call to the rule on line 288 returns failure (since '$' is not a valid variable); quote_literal is called instead, but concludes on line 360 that it's reached an escape char ('$'), and exits immediately. The control is passed back and forth like this, never advancing pos.
Two possible patches for this issue attached.
dollar_bug.patch1
Description: Binary data
dollar_bug.patch2
Description: Binary data