Closed docentYT closed 1 year ago
Thanks for trying out the extension! I'll take a look and see what the issue is.
It seems to work fine for me.
The error you are receiving looks like a parsing error. The parser I use is from here: https://www.npmjs.com/package/hdl-parser.
I found what the error is in. I did not have parts defined for the components I was using. If I remember correctly, it was mentioned in the nand2tetris course that the simulation program has predefined components so that you don't have to manually create all of them. And I rather don't see the point of using them for visualization when a single .hdl file could suffice.
Awesome that you figured out the error! The reason the the extension needs to examine the components is to determine what pins are inputs and what pins are outputs to show the visualization correctly.
needs to examine the components is to determine what pins are inputs and what pins are outputs
It is not necessary to know all the PARTS
for this. IN
and OUT
will be enough.
The way the extension works is the following. If the extension observes a component with the same name of a builtin nand2tetris chip, it will first check the directory to see if the user has defined the component. If no file is found, the extension assumes the component is a builtin nand2tetris chip and uses information from here to determine the inputs. This mechanism is useful for example if I want to define a custom chip that shares the name of a builtin chip, but has different pins. For example, a custom ALU.
In short, if you don't want to define builtin nand2tetris chip yourself, don't include their files in your directory.
I'm getting an error:
when I am trying to visualize the following code: