/jshdl

convert antrl4 vhdl.g4 to js

Primary LanguageC++

jshdl

Convert a Antlr4 vhdl.g4 grammar to javascript via antl4 cpp target and emscripten instead of the slow antl4 javascript target. vhdl.g4 from https://github.com/Nic30/hdlConvertor.

antlr4 cpp target (t/simple.cpp):

Scan 131kb t/iu3.vhd with antlr4 *cpp* target parser:

time ./vhdl.out t/iu3.vhd
real  0m3.666s
user  0m3.612s
sys   0m0.048s

antlr4 javascript target:

Scan 131kb t/iu3.vhd with antlr4 *javascript* target parser (t/simple.js):

time node t/simple.js
real  2m26.034s
user  2m27.348s
sys   0m1.180s

=> very slow

antlr4 cpp target parser converted with emscripten (t/simple_node.cpp):

emcc -O3 compiled: 13976859 bytes. Scan 131kb t/iu3.vhd:

$time node vhdlparser.js
real  0m15.864s
user  0m15.732s
sys   0m0.144s

emcc -Oz compiled: 8817131 bytes. Scan 131kb t/iu3.vhd:

$time node vhdlparser.js
real  0m20.709s
user  0m20.608s
sys	  0m0.128s