我正在学习如何在 Pharo、Smalltalk 上使用 PetitParser,并且我正在使用教科书来学习它。在教科书中,给出了以下脚本。
term := PPDelegateParser new.
prod := PPDelegateParser new.
prim := PPDelegateParser new.
term setParser: (prod , $+ asParser trim , term ==> [ :nodes | nodes first + nodes last ]) / prod.
prod setParser: (prim , $*asParser trim , prod ==> [ :nodes | nodes first*nodes last ]) / prim.
prim setParser: ($( asParser trim , term , $) asParser trim ==> [ :nodes | nodes second ]) / number.
start := term end.
start parse:'1+2*3'.
但是,当我尝试在操场上打印它时,我得到 MessageNotUnderstood:“parseOn:”的接收者为零。我做错了什么?