I am trying to use the project for Darwin/ARM64. The problem I am facing is that the program crashes. I am trying to use tree-sitter-python. I am using the configuration directives from the README file.
try {
Parser parser = new Parser();
parser.setLanguage(Languages.python());
Tree tree = parser.parseString("def foo(bar, baz):\n print(bar)\n print(baz)");
Node root = tree.getRootNode();
System.out.println(root.getType());
Node function = root.getChild(0);
System.out.println(function.getType());
}
catch (Exception e){
System.out.println("exception");
e.printStackTrace();
}
Command Line: -agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=127.0.0.1:51316 -Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant org.example.Main
Host: "Mac14,2" arm64, 8 cores, 16G, Darwin 22.3.0, macOS 13.2.1 (22D68)
Time: Fri Mar 17 18:59:24 2023 MDT elapsed time: 5.564390 seconds (0d 0h 0m 5s)
--------------- T H R E A D ---------------
Current thread (0x0000000134808a00): JavaThread "main" [_thread_in_native, id=5123, stack(0x000000016b594000,0x000000016b797000)]
Stack: [0x000000016b594000,0x000000016b797000], sp=0x000000016b7969b0, free space=2058k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [libjava-tree-sitter.dylib+0x22884] ts_tree_root_node+0x0
j ai.serenade.treesitter.TreeSitter.treeRootNode(J)Lai/serenade/treesitter/Node;+0
j ai.serenade.treesitter.Tree.getRootNode()Lai/serenade/treesitter/Node;+4
j org.example.Main.main([Ljava/lang/String;)V+36
v ~StubRoutines::call_stub
V [libjvm.dylib+0x46e49c] JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, JavaThread*)+0x390
V [libjvm.dylib+0x4d2bf8] jni_invoke_static(JNIEnv_*, JavaValue*, _jobject*, JNICallType, _jmethodID*, JNI_ArgumentPusher*, JavaThread*)+0x110
V [libjvm.dylib+0x4d627c] jni_CallStaticVoidMethod+0x130
C [libjli.dylib+0x9ac8] JavaMain+0xa80
C [libjli.dylib+0xbdc0] ThreadJavaMain+0xc
C [libsystem_pthread.dylib+0x706c] _pthread_start+0x94
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j ai.serenade.treesitter.TreeSitter.treeRootNode(J)Lai/serenade/treesitter/Node;+0
j ai.serenade.treesitter.Tree.getRootNode()Lai/serenade/treesitter/Node;+4
j org.example.Main.main([Ljava/lang/String;)V+36
v ~StubRoutines::call_stub
I am trying to use the project for Darwin/ARM64. The problem I am facing is that the program crashes. I am trying to use tree-sitter-python. I am using the configuration directives from the README file.
The program I am using is the following
At the instruction
Node root = tree.getRootNode();, the program crashes. This is the stack traceFYI, I am using the JVM amazoncorretto17