-1

我不断收到错误:

In HDL file home/barnacles/nand2tetris/projects/01/And.hdl,Line 18, ',', or ')' are expected

我继续检查语法,它是正确的,我不知道什么是错的。

// This file is part of www.nand2tetris.org
// and the book "The Elements of Computing Systems"
// by Nisan and Schocken, MIT Press.
// File name: projects/01/And.hdl

/**
 * And gate: 
 * out = 1 if (a == 1 and b == 1)
 *       0 otherwise
 */

CHIP And {
    IN a, b;
    OUT out;

    PARTS:
    // Put your code here:
    Nand(a=a, b=b, out=nand_1);
    Not(in=nand_1, out=out);
}
// This file is part of www.nand2tetris.org
// and the book "The Elements of Computing Systems"
// by Nisan and Schocken, MIT Press.
// File name: projects/01/And.hdl

/**
 * And gate: 
 * out = 1 if (a == 1 and b == 1)
 *       0 otherwise
 */

CHIP And {
    IN a, b;
    OUT out;

    PARTS:
    // Put your code here:
    Nand(a=a, b=b, out=nand_1);
    Nand(a=nand_1, b=nand_1, out=out);
}

我知道更改正在保存。我也试过重新安装

4

1 回答 1

0

我认为问题在于 _ 不是符号名称的有效字符。如果您将 nand_1 更改为 nand1,您的 HDL 应该可以编译。

这个限制对我来说是出乎意料的和新的,并且错误消息是神秘的也无济于事。如果它甚至提供了触发错误的行中的字符位置,问题就会更加明显。

于 2021-08-17T09:23:25.517 回答