2020-06-25 15:06:08 +03:00
|
|
|
---
|
|
|
|
layout: developer-doc
|
|
|
|
title: JVM Object Generation
|
|
|
|
category: parser
|
|
|
|
tags: [parser, jvm, object-generation]
|
2020-10-30 17:06:24 +03:00
|
|
|
order: 9
|
2020-06-25 15:06:08 +03:00
|
|
|
---
|
|
|
|
|
|
|
|
# JVM Object Generation
|
2020-07-21 15:59:40 +03:00
|
|
|
|
2020-06-26 16:54:20 +03:00
|
|
|
The JVM object generation phase is responsible for creating JVM-native objects
|
|
|
|
representing the parser AST from the rust-native AST. This is required to allow
|
|
|
|
the compiler and runtime to work with the AST.
|
2020-06-25 15:06:08 +03:00
|
|
|
|
|
|
|
<!-- MarkdownTOC levels="2,3" autolink="true" -->
|
|
|
|
|
|
|
|
<!-- /MarkdownTOC -->
|
2020-06-26 16:54:20 +03:00
|
|
|
|
2020-08-14 12:10:52 +03:00
|
|
|
# Overall Architecture
|
|
|
|
|
|
|
|
The JVM foreign function interface (FFI), named
|
|
|
|
[Java Native Interface](https://en.wikipedia.org/wiki/Java_Native_Interface)
|
|
|
|
(JNI), enables the Rust parser library to call and be called by the parser
|
|
|
|
library implemented in Scala.
|
|
|
|
|
|
|
|
Specifically, in our architecture, the JNI is used for:
|
|
|
|
|
|
|
|
- Invoking Rust parser methods from Scala.
|
|
|
|
- Invoking Scala AST constructors from Rust.
|