Skip to content

Commit

Permalink
[asl] Check type validity on user input
Browse files Browse the repository at this point in the history
  • Loading branch information
HadrienRenaud committed Jan 9, 2024
1 parent 45d5164 commit a715e76
Show file tree
Hide file tree
Showing 4 changed files with 400 additions and 373 deletions.
2 changes: 1 addition & 1 deletion asllib/Interpreter.ml
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ module Make (B : Backend.S) (C : Config) = struct
(** [build_funcs] initialize the unique calling reference for each function
and builds the subprogram sub-env. *)
let build_funcs (env : StaticEnv.env) =
IMap.map (fun (f, _pureness) -> (ref 0, f)) env.StaticEnv.global.subprograms
IMap.map (fun f -> (ref 0, f)) env.StaticEnv.global.subprograms

(* Global env *)
(* ---------- *)
Expand Down
10 changes: 7 additions & 3 deletions asllib/Parser.mly
Original file line number Diff line number Diff line change
Expand Up @@ -373,12 +373,16 @@ let ty :=
| STRING; { T_String }
| BIT; { t_bit }
| BITS; ~=pared(expr); ~=bitfields_opt; < T_Bits >
| ENUMERATION; l=braced(tclist(IDENTIFIER)); < T_Enum >
| l=plist(ty); < T_Tuple >
| ARRAY; e=bracketed(expr); OF; t=ty; < T_Array >
| name=IDENTIFIER; < T_Named >
)

let ty_decl := ty |
annotated (
| ENUMERATION; l=braced(tclist(IDENTIFIER)); < T_Enum >
| RECORD; l=fields_opt; < T_Record >
| EXCEPTION; l=fields_opt; < T_Exception >
| name=IDENTIFIER; < T_Named >
)

(* Constructs on ty *)
Expand Down Expand Up @@ -560,7 +564,7 @@ let decl ==
}

| terminated_by(SEMI_COLON,
| TYPE; x=IDENTIFIER; OF; t=ty; ~=subtype_opt; < D_TypeDecl >
| TYPE; x=IDENTIFIER; OF; t=ty_decl; ~=subtype_opt; < D_TypeDecl >
| TYPE; x=IDENTIFIER; s=annotated(subtype); < make_ty_decl_subtype >

| keyword=storage_keyword; name=ignored_or_identifier;
Expand Down
Loading

0 comments on commit a715e76

Please sign in to comment.