For my job I need to operate on JS code, transforming it and passing the abstract syntax from one program to one script, and from one LLM model to another. This AST will be take form of JSON. Then my static parser will translate it back to JS code using syntax-directed definitions.
I am not a master of JS and the standard is too verbose and does not offer any grammar specs — AFAIK, the paid version of the C2017 standard has a grammar specs, so maybe the paid version of JS standard may have a grammar? I could not find ‘paid’ PDF anywhere. How much money these organizations make by peddling standards anyways? Will somebody please standardize Rust so I can tRust it? — so it may not be comprehensive. If you see anything missing, tell me.
I don’t think I can share the JS syntax-directed definition, so here’s C’s syntax directed definition. If you need an SDD for any language, just give this to ChatGPT and tell it to make an SDD ‘like this’. It has worked for me before.
Thanks.