Parsing Julia code

Hello, I am working on a project where I need to parse and tokenized Julia source code. As I understand it correctly, the only available parser is the one used in REPL and is written in Scheme/Lisp. So, it looks like I need to somehow utilize this parser, but I do not know how to use it. What I understand is that there are at least two files julia-parser.scm and julia-syntax.scm that are executed internally using a modified version of Femtolisp. I was looking on the Internet for more information, but it looks like despite the demand there is no documentation about the internals of Julia.

Use Base.Meta.parse(str)

6 Likes

There is also GitHub - julia-vscode/CSTParser.jl: A concrete syntax tree parser for Julia, which is written in native Julia and uses GitHub - JuliaLang/Tokenize.jl: Tokenization for Julia source code for tokenization.

3 Likes

There’s a whole section of the manual:

https://docs.julialang.org/en/v1/devdocs/init/

8 Likes