Module M_frontend.Parse_utils

Frontend variable names

type parse_val =
| ParseVar of M_ir.Com.var_name
| ParseInt of int

A parsed variable can be a regular variable or an integer literal

val mk_position : (Stdlib.Lexing.position * Stdlib.Lexing.position) -> Utils.Pos.t
val parse_variable : (Stdlib.Lexing.position * Stdlib.Lexing.position) -> string -> M_ir.Com.var_name

Checks whether the variable contains parameters

val parse_variable_name : (Stdlib.Lexing.position * Stdlib.Lexing.position) -> string -> string

Checks whether the string is entirely capitalized

val parse_parameter : (Stdlib.Lexing.position * Stdlib.Lexing.position) -> string -> char
val parse_variable_or_int : (Stdlib.Lexing.position * Stdlib.Lexing.position) -> string -> parse_val
val parse_table_size : string -> Mast.table_size
val parse_func_name : 'a -> string -> string

Literal parsing

val parse_int : (Stdlib.Lexing.position * Stdlib.Lexing.position) -> string -> int

Checks whether is it actually an integer

val parse_literal : (Stdlib.Lexing.position * Stdlib.Lexing.position) -> string -> M_ir.Com.literal
val parse_atom : (Stdlib.Lexing.position * Stdlib.Lexing.position) -> string -> M_ir.Com.m_var_name M_ir.Com.atom
val parse_to_atom : parse_val -> Utils.Pos.t -> M_ir.Com.m_var_name M_ir.Com.atom
val parse_function_name : string Utils.Pos.marked -> M_ir.Com.func Utils.Pos.marked
val parse_index_format : string Utils.Pos.marked -> string Utils.Pos.marked
val parse_if_then_etc : (Mast.expression Utils.Pos.marked option * Mast.instruction Utils.Pos.marked list * Utils.Pos.t) list -> Mast.instruction
val parse_when_do_etc : ((Mast.expression Utils.Pos.marked * Mast.instruction Utils.Pos.marked list * Utils.Pos.t) list * Mast.instruction Utils.Pos.marked list Utils.Pos.marked) -> Mast.instruction
type target_header =
| Target_apps of Mast.application Utils.Pos.marked list
| Target_input_arg of string Utils.Pos.marked list
| Target_tmp_vars of (string Utils.Pos.marked * Mast.table_size Utils.Pos.marked option) list
| Function_result of string Utils.Pos.marked
val parse_target_or_function_header : string Utils.Pos.marked -> bool -> target_header Utils.Pos.marked list -> Mast.application Utils.Pos.marked Utils.StrMap.t * string Utils.Pos.marked list * (string Utils.Pos.marked * Mast.table_size Utils.Pos.marked option) list * string Utils.Pos.marked option