arm-asl-parser

Introduction: Parsing tools for ARM's ASL
More: Author   ReportBugs   
Tags:
  • Overview

This repository implements a parser for the ARM Semantics Language (ASL), which is a domain-specific language for describing the semantics of ARM instructions [fn:asl-description]. The parser is written in Java using ANTLR; the Java tool dumps the parsed AST in an s-expression format. The included Haskell library (asl-parser) parses the s-expression format into a native Haskell ADT.

The ASL is extracted from the official XML specifications from ARM [fn:arm-specs] using a set of tools [fn:mra_tools] developed by Alastair Reid.

  • Use

To download, extract, and parse the ASL specification, simply run:

make all

+END_SRC sh

This performs the following steps:

  1. Downloads and extracts the XML specifications from ARM into the ~xml~ subdirectory.
  2. Uses mra_tools to parse the XML specifications into ASL. This creates ~arch.asl~, ~arch_instrs.asl~, ~regs.asl~ and ~support.asl~ in the ~asl~ subdirectory.
  3. Uses the ANTLR parser to parse these into an s-expression format. This creates ~arm_defs.sexpr~, ~arm_instrs.sexpr~, ~arm_regs.sexpr~ and ~support.expr~ in the ~asl-parsed~ subdirectory.

  4. Building

Currently, this repository only implements a library parsing the generated s-expression files. Client code can use the library to process ASL. See the module ~Language.ASL.Parser~ and the functions ~parseAslDefs~, ~parseAslInsts~ and ~parseAslRegs~. The mra_tools produce three files of interest: ~arch.asl~, ~arch_instrs.asl~ and ~regs.asl~. The first contains definitions of functions used to implement instruction semantics. The second contains the definitions of the semantics of each instruction in the architecture. The third contains definitions for the registers used in other two. Additionally mra_tools provides a collection of reference implementations for implementation-defined functions in the ASL specification. These are concatenated together in ~support.asl~.

The cabal target asl-parser builds the parser library.

+BEGIN_SRC sh

cabal v2-build asl-parser

+END_SRC

  • References

[fn:mra_tools] https://github.com/alastairreid/mra_tools [fn:asl-description] https://alastairreid.github.io/dissecting-ARM-MRA/ [fn:arm-specs] https://developer.arm.com/architectures/cpu-architecture/a-profile/exploration-tools

Apps
About Me
GitHub: Trinea
Facebook: Dev Tools