public ConstructTpl compilePcode(String pcodeStatements, String srcFile, int srcLine)
			throws SleighException {

		LineArrayListWriter writer = null;
		try {
			writer = new LineArrayListWriter();
			ParsingEnvironment env = new ParsingEnvironment(writer);

			// inject pcode statement lines into writer (needed for error reporting)
			BufferedReader r = new BufferedReader(new StringReader(pcodeStatements));
			String line;
			while ((line = r.readLine()) != null) {
				writer.write(line);
				writer.newLine();
			}

			CharStream input = new ANTLRStringStream(writer.toString());

			env.getLocator().registerLocation(input.getLine(), new Location(srcFile, srcLine));

			SleighLexer lex = new SleighLexer(input);
			lex.setEnv(env);
			UnbufferedTokenStream tokens = new UnbufferedTokenStream(lex);
			SleighParser parser = new SleighParser(tokens);
			parser.setEnv(env);
			parser.setLexer(lex);
			lex.pushMode(SleighRecognizerConstants.SEMANTIC);
			semantic_return semantic = parser.semantic();
			lex.popMode();

			CommonTreeNodeStream nodes = new CommonTreeNodeStream(semantic.getTree());
			nodes.setTokenStream(tokens);
			// ANTLRUtil.debugNodeStream(nodes, System.out);
			SleighCompiler walker = new SleighCompiler(nodes);

			SectionVector rtl = walker.semantic(env, null, this, semantic.getTree(), false, false);

			if (getErrors() != 0) {
				return null;
			}

			ConstructTpl result = null;
			if (rtl != null) {
				result = buildConstructor(rtl.getMainSection());
			}

			return result;
		}
		catch (IOException e) {
			throw new AssertException(); // unexpected condition
		}
		catch (RecognitionException e) {
			throw new SleighException("Semantic compilation error: " + e.getMessage(), e);
		}
		catch (BailoutException e) {
			throw new SleighException("Unrecoverable error(s), halting compilation", e);
		}
		catch (NullPointerException e) {
			throw new SleighException("Unrecoverable error(s), halting compilation", e);
		}
		finally {
			if (writer != null) {
				try {
					writer.close();
				}
				catch (IOException e) {
					// squash!!! we tried
				}
			}
		}
	}
Compile pcode semantic statements.

@param pcodeStatements is the raw source to parse
@param srcFile source filename from which pcodeStatements came (
@param srcLine line number in srcFile corresponding to pcodeStatements
@return ConstructTpl. A null may be returned or an exception thrown if parsing/compiling
        fails (see application log for errors).
@throws SleighException pcode compile error
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/lang/PcodeParser.java