acorn(1)
πΈ acorn(1) β like, the manual page, bestie πΈ
okay so before we even get into it: this is the page for acorn, section 1 of the manual (that's the "user commands" section, iykyk). If you've ever needed to peek inside a JavaScript file and see what the parser actually thinks it is, this is your girl. β¨
π NAME π
acorn β parse a JavaScript file π
β¨ SYNOPSIS β¨
acorn [--ecma3 | --ecma5 | --ecma6 | --ecma7 | ... | --ecma2015 |
--ecma2016] [--tokenize] [--locations] [--allow-hash-bang]
[--compact] [--silent] [--module] [--help] [--] [infile]
π¦ DESCRIPTION π¦
acorn is a lil command-line utility that parses a JavaScript file for you. That's it, that's the whole vibe. π
You hand it your input file as an argument, and the utility spits out the syntax tree as JSON data. No cap. Straight-up JSON, right there in your terminal, ready to be piped into whatever nonsense you're building. π
π OPTIONS π
--ecma3,--ecma5,--ecma6,--ecma7, ...,--ecma2015,--ecma2016β picks which ECMAScript version to parse with. The default is version 7, so if you say nothing, you get 7. Iconic default honestly. β--tokenizeβ flips on tokenizer mode of the parser. Not the full tree, just the tokens. π--locationsβ this one's a baddie fr. It attaches a"loc"object to each node, with"start"and"end"sub-objects, and each of those contains the one-based line and zero-based column numbers, in{line, column}form. Yes bestie, one-based lines but zero-based columns. That's just how it is. π--allow-hash-bangβ if you enable this, it skips the leading hashbang line. For all my script-with-a-#!-on-top girlies. π«Ά--compactβ no whitespace is used in the AST output. Tiny output, zero breathing room, maximum density. π₯--silentβ do not output the AST at all. It just returns the exit status. Quiet queen behaviour. π€«--moduleβ tells acorn the code shouldn't be parsed as a script, but as a module instead. Heads up, this actually changes things: it influences global strict mode and the'import'and'export'declarations. So like, not a cosmetic flag, it's giving real consequences. π--helpβ prints the usage information and quits. Your lil escape hatch when you're lost. π
π§ lil reminder bestie: there's a bare--in the synopsis, and it's not decorative β use it to mark the end of options before yourinfile.
π Also: the positional arg is infile, aka the JavaScript file you want parsed. Don't forget to actually give it one.
okay so that's the whole page!! go parse something slay. πβ¨
signing off: this was acorn(1) β from the acorn manual, dated 1782392480. mwah, talk later bestie ππ
π¦ where this page comes from
- ubuntu stonking: node-acorn 8.17.0+ds+~cs28.27.25-1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms