package asli

  1. Overview
  2. Docs
Interpreter for Arm's Architecture Specification Language (ASL)

Install

Dune Dependency

Authors

Maintainers

Sources

0.2.0.tar.gz
md5=f4581fd209256823fa4d569ac96c8cee
sha512=fd4a74294beb9eeeafa80c9224b5dc30f5e5ebde4d53fa601929d283b6ca72154de313874321774914f738ac6f0d640e59452f7d03cb1db7b3a019b48b82e0d4

doc/asli.libASL/LibASL/Asl_ast/index.html

Module LibASL.Asl_astSource

Sourcetype id = string
Sourcetype typeid = string
Sourcetype intLit = string
Sourcetype bitsLit = string
Sourcetype maskLit = string
Sourcetype realLit = string
Sourcetype hexLit = string
Sourcetype i = int
Sourcetype l =
  1. | Unknown
  2. | Int of string * l option
  3. | Generated of l
  4. | Range of Lexing.position * Lexing.position

Location tracking

Sourcetype 'a annot = l * 'a
Sourceval pp_lexing_position : Lexing.position -> string
Sourceval pp_loc : l -> string
Sourceexception Parse_error_locn of l * string

Parsing exceptions (1/2)

Sourcetype ident =
  1. | Ident of string
  2. | FIdent of string * int

Identifiers used for variable names, function names, etc.

There are two kinds of identifier:

  • Ident is generated by the parser - it is just a string
  • FIdent is generated by the disambiguation part of the typechecker and includes a unique label to distinguish different entities with the same name in the source syntax.
Sourceval pprint_ident : ident -> string
Sourceval addTag : ident -> int -> ident
Sourceval stripTag : ident -> ident
Sourceval name_of_FIdent : ident -> string
Sourceval addQualifier : string -> ident -> ident
Sourceval addPrefix : string -> ident -> ident
Sourceval addSuffix : ident -> string -> ident
Sourceval genericTyvar : int -> ident
Sourceval isGenericTyvar : ident -> bool
Sourcemodule Id : sig ... end

Type Identifiers

Sourcemodule StringSet : sig ... end
Sourceval typeIdents : StringSet.t ref
Sourceval addTypeIdent : ident -> unit
Sourceval isTypeIdent : string -> bool
Sourcetype binop =
  1. | Binop_Eq
  2. | Binop_NtEq
  3. | Binop_Gt
  4. | Binop_GtEq
  5. | Binop_Lt
  6. | Binop_LtEq
  7. | Binop_Plus
  8. | Binop_Minus
  9. | Binop_Multiply
  10. | Binop_Divide
  11. | Binop_Power
  12. | Binop_Quot
  13. | Binop_Rem
  14. | Binop_Div
  15. | Binop_Mod
  16. | Binop_ShiftL
  17. | Binop_ShiftR
  18. | Binop_BoolAnd
  19. | Binop_BoolOr
  20. | Binop_BoolIff
  21. | Binop_BoolImplies
  22. | Binop_BitOr
  23. | Binop_BitEor
  24. | Binop_BitAnd
  25. | Binop_Append
  26. | Binop_Concat
  27. | Binop_DUMMY
Sourcetype unop =
  1. | Unop_Negate
  2. | Unop_BoolNot
  3. | Unop_BitsNot
Sourcetype ixtype =
  1. | Index_Enum of ident
  2. | Index_Range of expr * expr
Sourceand ty =
  1. | Type_Constructor of ident
  2. | Type_Bits of expr
  3. | Type_App of ident * expr list
  4. | Type_OfExpr of expr
  5. | Type_Register of intLit * (slice list * ident) list
  6. | Type_Array of ixtype * ty
  7. | Type_Tuple of ty list
Sourceand pattern =
  1. | Pat_LitInt of intLit
  2. | Pat_LitHex of hexLit
  3. | Pat_LitBits of bitsLit
  4. | Pat_LitMask of maskLit
  5. | Pat_Const of ident
  6. | Pat_Wildcard
  7. | Pat_Tuple of pattern list
  8. | Pat_Set of pattern list
  9. | Pat_Range of expr * expr
  10. | Pat_Single of expr
Sourceand expr =
  1. | Expr_If of expr * expr * e_elsif list * expr
  2. | Expr_Binop of expr * binop * expr
  3. | Expr_Unop of unop * expr
  4. | Expr_Field of expr * ident
  5. | Expr_Fields of expr * ident list
  6. | Expr_Slices of expr * slice list
  7. | Expr_In of expr * pattern
  8. | Expr_Var of ident
  9. | Expr_Parens of expr
  10. | Expr_Tuple of expr list
  11. | Expr_Unknown of ty
  12. | Expr_ImpDef of ty * string option
  13. | Expr_TApply of ident * expr list * expr list
  14. | Expr_Array of expr * expr
  15. | Expr_LitInt of intLit
  16. | Expr_LitHex of hexLit
  17. | Expr_LitReal of realLit
  18. | Expr_LitBits of bitsLit
  19. | Expr_LitMask of maskLit
  20. | Expr_LitString of string
Sourceand e_elsif =
  1. | E_Elsif_Cond of expr * expr
Sourceand slice =
  1. | Slice_Single of expr
  2. | Slice_HiLo of expr * expr
  3. | Slice_LoWd of expr * expr
Sourcetype direction =
  1. | Direction_Up
  2. | Direction_Down
Sourcetype lexpr =
  1. | LExpr_Wildcard
  2. | LExpr_Var of ident
  3. | LExpr_Field of lexpr * ident
  4. | LExpr_Fields of lexpr * ident list
  5. | LExpr_Slices of lexpr * slice list
  6. | LExpr_BitTuple of lexpr list
  7. | LExpr_Tuple of lexpr list
  8. | LExpr_Array of lexpr * expr
  9. | LExpr_Write of ident * expr list * expr list
  10. | LExpr_ReadWrite of ident * ident * expr list * expr list
Sourcetype stmt =
  1. | Stmt_VarDeclsNoInit of ty * ident list * l
  2. | Stmt_VarDecl of ty * ident * expr * l
  3. | Stmt_ConstDecl of ty * ident * expr * l
  4. | Stmt_Assign of lexpr * expr * l
  5. | Stmt_FunReturn of expr * l
  6. | Stmt_ProcReturn of l
  7. | Stmt_Assert of expr * l
  8. | Stmt_Unpred of l
  9. | Stmt_ConstrainedUnpred of l
  10. | Stmt_ImpDef of ident * l
  11. | Stmt_Undefined of l
  12. | Stmt_ExceptionTaken of l
  13. | Stmt_Dep_Unpred of l
  14. | Stmt_Dep_ImpDef of string * l
  15. | Stmt_Dep_Undefined of l
  16. | Stmt_See of expr * l
  17. | Stmt_Throw of ident * l
  18. | Stmt_DecodeExecute of ident * expr * l
  19. | Stmt_TCall of ident * expr list * expr list * l
  20. | Stmt_If of expr * stmt list * s_elsif list * stmt list * l
  21. | Stmt_Case of expr * alt list * stmt list option * l
  22. | Stmt_For of ident * expr * direction * expr * stmt list * l
  23. | Stmt_While of expr * stmt list * l
  24. | Stmt_Repeat of stmt list * expr * l
  25. | Stmt_Try of stmt list * ident * catcher list * stmt list option * l
Sourceand s_elsif =
  1. | S_Elsif_Cond of expr * stmt list
Sourceand alt =
  1. | Alt_Alt of pattern list * expr option * stmt list
Sourceand catcher =
  1. | Catcher_Guarded of expr * stmt list
Sourcetype instr_field =
  1. | IField_Field of ident * int * int
Sourcetype opcode_value =
  1. | Opcode_Bits of bitsLit
  2. | Opcode_Mask of maskLit
Sourcetype decode_pattern =
  1. | DecoderPattern_Bits of bitsLit
  2. | DecoderPattern_Mask of maskLit
  3. | DecoderPattern_Wildcard of ident
  4. | DecoderPattern_Not of decode_pattern
Sourcetype decode_slice =
  1. | DecoderSlice_Slice of int * int
  2. | DecoderSlice_FieldName of ident
  3. | DecoderSlice_Concat of ident list
Sourcetype sformal =
  1. | Formal_In of ty * ident
  2. | Formal_InOut of ty * ident
Sourcetype encoding =
  1. | Encoding_Block of ident * ident * instr_field list * opcode_value * expr * (int * bitsLit) list * stmt list * l
Sourcetype decode_case =
  1. | DecoderCase_Case of decode_slice list * decode_alt list * l
Sourceand decode_alt =
  1. | DecoderAlt_Alt of decode_pattern list * decode_body
Sourceand decode_body =
  1. | DecoderBody_UNPRED of l
  2. | DecoderBody_UNALLOC of l
  3. | DecoderBody_NOP of l
  4. | DecoderBody_Encoding of ident * l
  5. | DecoderBody_Decoder of instr_field list * decode_case * l
Sourcetype mapfield =
  1. | MapField_Field of ident * pattern
Sourcetype declaration =
  1. | Decl_BuiltinType of ident * l
  2. | Decl_Forward of ident * l
  3. | Decl_Record of ident * (ty * ident) list * l
  4. | Decl_Typedef of ident * ty * l
  5. | Decl_Enum of ident * ident list * l
  6. | Decl_Var of ty * ident * l
  7. | Decl_Const of ty * ident * expr * l
  8. | Decl_BuiltinFunction of ty * ident * (ty * ident) list * l
  9. | Decl_FunType of ty * ident * (ty * ident) list * l
  10. | Decl_FunDefn of ty * ident * (ty * ident) list * stmt list * l
  11. | Decl_ProcType of ident * (ty * ident) list * l
  12. | Decl_ProcDefn of ident * (ty * ident) list * stmt list * l
  13. | Decl_VarGetterType of ty * ident * l
  14. | Decl_VarGetterDefn of ty * ident * stmt list * l
  15. | Decl_ArrayGetterType of ty * ident * (ty * ident) list * l
  16. | Decl_ArrayGetterDefn of ty * ident * (ty * ident) list * stmt list * l
  17. | Decl_VarSetterType of ident * ty * ident * l
  18. | Decl_VarSetterDefn of ident * ty * ident * stmt list * l
  19. | Decl_ArraySetterType of ident * sformal list * ty * ident * l
  20. | Decl_ArraySetterDefn of ident * sformal list * ty * ident * stmt list * l
  21. | Decl_InstructionDefn of ident * encoding list * stmt list option * bool * stmt list * l
  22. | Decl_DecoderDefn of ident * decode_case * l
  23. | Decl_Operator1 of unop * ident list * l
  24. | Decl_Operator2 of binop * ident list * l
  25. | Decl_NewEventDefn of ident * (ty * ident) list * l
  26. | Decl_EventClause of ident * stmt list * l
  27. | Decl_NewMapDefn of ty * ident * (ty * ident) list * stmt list * l
  28. | Decl_MapClause of ident * mapfield list * expr option * stmt list * l
  29. | Decl_Config of ty * ident * expr * l
Sourcetype leadingblank =
  1. | LeadingBlank
  2. | LeadingNothing
Sourcetype factor =
  1. | Factor_BinOp of binop * expr
Sourcetype impdef_command =
  1. | CLI_Impdef of string * expr
Sourceval associativeOperators : binop list
Sourceval booleanOperators : binop list
Sourceval comparisionOperators : binop list
Sourceval miscOperators : binop list
Sourceval isAssociative : binop -> bool
Sourceval isBoolean : binop -> bool
Sourceval isComparision : binop -> bool
Sourceval isMisc : binop -> bool
Sourceval higherPriorityThan : binop -> binop -> bool option
Sourceexception PrecedenceError of l * binop * binop

Parsing exceptions (2/2)

Sourceval buildExpr : binop -> expr -> factor list -> l -> expr * factor list
Sourceval buildExpression : expr -> factor list -> l -> expr
OCaml

Innovation. Community. Security.