Prolog:DCG 语法错误
我正在尝试解析我正在创建的语言的“函数调用”,但我得到:
:30:0 Syntax error: Operator expected
下面的第一行是我收到错误的地方:
Fun(FXs) --> name(F),
ws,
[0'(],
ws,
args(Xs),
ws,
[0')],
{FXs =.. [F, Xs]}.
name(N) --> id(Cs),
{atom_chars(Cs, N)}.
我已经在 Google 上详尽地搜索了有关 DCG 解析错误的帮助,并且我还没有找到任何东西。对我做错了什么的解释将会很有帮助,或者任何能让我更好地理解 DCG 的资源!
I'm attempting to parse a "function call" for a language that I am creating, but I am getting:
:30:0 Syntax error: Operator expected
The first line below is where I am getting my error:
Fun(FXs) --> name(F),
ws,
[0'(],
ws,
args(Xs),
ws,
[0')],
{FXs =.. [F, Xs]}.
name(N) --> id(Cs),
{atom_chars(Cs, N)}.
I have exhaustively searched Google for help with errors in DCG parsing, and I have not found anything. An explanation on what I am doing wrong will be helpful, or any resources that would allow me to understand DCG more!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想它是有趣:你应该写有趣。 SWI-Prolog 有一个允许使用 CamelCase 函子的扩展,但必须启用。
I guess it's Fun: you should write fun instead. SWI-Prolog has an extension to allow CamelCase functors, but must be enabled.