A Java parser for linker script (LD) format using ANTLR.
import io.ldparser.LDParser;
import io.ldparser.Script;
import io.ldparser.Command;
import io.ldparser.ProvideCommand;
import java.io.File;
// Parse from file
Script script = LDParser.parse(new File("script.ld"));
// Access commands
for (Command cmd : script.getCommands()) {
if (cmd instanceof ProvideCommand) {
ProvideCommand pc = (ProvideCommand) cmd;
System.out.println("Symbol: " + pc.getSymbolName() + ", Expression: " + pc.getExpression());
}
}Install Eclipse. Once in Eclipse click File > Open Projects from File System.... On the import dialog select LD-Parser folder and import the project.
You are ready for building, testing and developing.
The package is published to Maven Central and Github package repository.
Those pages provide installation snippets, visit them for more information.