New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

hdl-parser

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hdl-parser

Parser for nand2tetris HDL language

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

hdl-parser

Parser for nand2tetris HDL (Hardware Description Language), built on top of Peggy.

Build Status NPM Version License: MIT Types: TypeScript

Usage example

const { parse } = require('hdl-parser');

console.log(parse(`
  CHIP Not {
    IN in;
    OUT out;

    PARTS:
    Nand(a=in, b=true, out=out);
  }
`));

And the result:

({
  name: 'Not',
  definitions: [
    { type: 'IN', pins: [{ name: 'in', bits: 1 }] },
    { type: 'OUT', pins: [{ name: 'out', bits: 1 }] },
  ],
  parts: [
    {
      name: 'Nand',
      connections: [
        { from: { pin: 'a', bits: null }, to: { pin: 'in', bits: null } },
        { from: { pin: 'b', bits: null }, to: { const: 'true' } },
        { from: { pin: 'out', bits: null }, to: { pin: 'out', bits: null } },
      ],
    },
  ],
})

For more examples, see the tests file.

License

Released under the terms of the MIT licence. Copyright (c) 2021, Uri Shaked.

Keywords

nand2tetris

FAQs

Package last updated on 09 Mar 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts