#!/bin/bash verilog=$1 usage=$(cat << EOF Usage: ./export_json.sh Dependencies: * include the path to "verible-verilog-syntax" in PATH * download [verible](https://github.com/chipsalliance/verible/releases) * install "jq" using a package manager from your OS * or skip the last command in the pipe EOF ) if [[ -f $verilog ]] ; then verible-verilog-syntax --printtree --export_json $verilog | tr -d ' \t\n' | sed -e "s/,null//g" -e "s/null,//g" | jq else echo "$usage" echo "" fi