Language Parser
A language parser is responsible for parsing source files of a specific language and converting them into an abstract syntax tree (AST).
import io.github.potjerodekool.nabu.lang.spi.LanguageParser;
public class SimpleLanguageParser implements LanguageParser {
private final FileObject.Kind SOURCE_KIND = new FileObject.Kind(".simple", true);
@Override
public FileObject.Kind getSourceKind() {
return SOURCE_KIND;
}
@Override
public CompilationUnit parse(final FileObject fileObject,
final CompilerContext compilerContext) {
// TODO: Implement parsing logic for .simple files
return null;
}
}
The language parser can be registered in the plugin.xml
<language-parser implementationClass="com.example.SimpleLanguageParser"/>