The difference between Babel parser and acorn

Time:2022-3-24

knowacornIs the parser of JS, I also knowbabel-parserIt’s also a JS parser, but what’s the difference between them?
first,@babel/parser(previously Babylon) fromacornFork comes out, but it’s basically rewritten, but someacornThe algorithm is still popular.

There are still some differences between them:

  • @Babel / parser does not support third-party plug-ins.
  • Acorn only supports the proposal of the fourth stage (basically equivalent to writing the standard, but it’s just a matter of time. See here).
  • The ast format is different, but you can start the estree plug-in of @ Babel / parser to match the ast format of acorn

babel/issues#11393

Recommended Today

php displays Chinese graphically and specifies the ttf font library

1 <?php 2 header("Content-Type:image/png"); 3 $img=imagecreatetruecolor(400,300); 4 // imagejpeg($img); 5 // imagejpeg($img,"./img/copy_img01.jpg",10); 6 $color1=imagecolorallocate($img,100,100,100); 7 $color2=imagecolorallocate($img,255,0,0); 8 $str="北京欢迎你!"; 9 imagefill($img,0,0,$color1); 10 // imagestring($img,5,0,0,$str,$color2); 11 $fontfile="F:\phpStudy\WWW\myweb\FZXBSJW.ttf"; 12 imagettftext($img,24,0,100,100,$color2,$fontfile,$str); 13 imagepng($img); 14 imagedestroy($img); 15 // header("Content-Type:text/html"); 16 // echo "gave over!"; Line 13 imagepng($img) must have, and the Chinese font path must be an absolute path.