Hi all!I want to parse julia in java, so i came looking to the sources and now i have some questions:1) do i get it right that julia lexer and parser are both here https://github.com/JuliaLang/julia/blob/master/src/julia-parser.scm and that there is no BNF grammar or something like that?
2) is there currently any work going on to rewrite it or to bring some major changes to the parser?
3) is there any convenient way to parse julia in julia and then print the AST? I have seen the parse function but it works only parses expressions, not whole files.
But does it really matter for 3) if the Julia parser or the Scheme parser is used? I would say just load the entire file into a string and use the regular parsing function.
julia> text = """1 + 2[ 1//(i + j - 1) for i=1:10, j=1:10 ]println("Hello, world.")""""1 + 2\n[ 1//(i + j - 1) for i=1:10, j=1:10 ]\nprintln(\"Hello, world.\")\n"julia> i = 11julia> while !done(text,i)ex, i = parse(text,i)@show exendex = :(1 + 2)ex = :($(Expr(:comprehension, :(1 // ((i + j) - 1)), :(i = 1:10), :(j = 1:10))))ex = :(println("Hello, world."))julia> i70
There's a method of parse that takes a starting position into the string and returns where it finished parsing. That version can be used to parse as many expressions from a string as one needs.
3) is there any convenient way to parse julia in julia and then print the AST? I have seen the parse function but it works only parses expressions, not whole files.
https://github.com/jakebolewski/JuliaParser.jl