Is there a (good) AS3 parser?


#1

Question lies in title.


#2

hey, what’s the goal ? making a documentation tool? a compiler? a transpiler?

when you say “good usage documentation compared to most existing ones”
what other tool are you talking about? asdoc?

Are you aware that a Java ActionScript 3.0 AST parser already exists?
and it was made by Macromedia/Adobe? and has been open sourced for long time?

asc (ActionScript Compiler)
see flex-sdk/tree/develop/modules/asc/src/java/macromedia/asc/parser

also check the compiler module
where you can find

flex-sdk/tree/develop/modules/compiler/src/java/flash/swf/tools/as3
see the EvaluatorAdapter and PrettyPrinter classes

flex-sdk/tree/develop/modules/compiler/src/java/flex2/tools
see ASDoc, Compc, Fcsh, Mxmlc, Tool classes

flex-sdk/tree/develop/modules/compiler/src/java/flex2/tools/oem
see Application, Builder, Library classes

In general dev just use the command-line tools (MXMLC, COMPC, ASC, ASDOC)
but if you had very specific needs and wanted to make a custom AS3/MXML compiler
you could use the flex2.oem and start to build your own compiler for example.

If you’re not happy with the current documentation tools, flex2.oem could also be used to implement your own asdoc-like tool, or you could start from the asdoc tool itself and patch it for what you need.

I can understand that parser/lexer/tokenizer/etc. are interesting subjects
and rolling your own is an educating/interesting experience, but really why do it (beside the experience of rolling your own)?


The Java Character class is easily clonable/duplicable in any other language, is that the only reason you’re using Java ?


#4

I’m then decided. I think I’ll go this ASC parser next time my laptop is fixed. If no interest is active on really working in my AS3-Lua (Transformice) transpiler, I just stop really.[quote=“zwetan, post:2, topic:977”]
I can understand that parser/lexer/tokenizer/etc. are interesting subjects
and rolling your own is an educating/interesting experience, but really why do it (beside the experience of rolling your own)?
[/quote]
There’s no more reason. By rolling my experience I’ll waste my time. Thank your for the refs…

In fact, I’ve read a bit of the code in macromedia.asc.parser.Scanner. It looks more perfomant than esprima… but I ask, is it handwritten?


closed #5

archived #6