Skip to content

Commit

Permalink
Initial work on handling underscore/don't care arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
didriklundberg committed Nov 21, 2024
1 parent 98def5f commit 2338beb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion hol/p4_from_json/excluded.sml
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,13 @@ val exclude_descs =
FAIL: Could not parse .*\/(.*?)\. .*?: unknown statement name: exit.*
*)
("adding exit statement to HOL4P4",
["issue2225-bmv2"]),
["issue2225-bmv2"]) (*,
(*
"Don't care" (underscore) argument (manually spotted)
*)
("fixing don't-care function arguments in import tool",
["issue774-4-bmv2"])
*)
];

fun get_error_desc testname [] = NONE
Expand Down
6 changes: 6 additions & 0 deletions hol/p4_from_json/petr4_to_hol4p4Script.sml
Original file line number Diff line number Diff line change
Expand Up @@ -1213,6 +1213,12 @@ Definition petr4_parse_expression_gen_def:
| SOME_msg (SetExp set_exp) => get_error_msg "set expressions as arguments disallowed by import tool: " exp
| NONE_msg exp_msg => NONE_msg ("could not parse arguments: "++exp_msg)
else NONE_msg ("unsupported argument type: "++argtype)
| (Array [String argtype; Object [("tags", tags)], p_tau_opt) =>
if argtype = "Missing" then
(* TODO: Use type maps and change return type of petr4_parse_args
* to create in-lined variable whose value is ARBed
* (automatic when initialising block)? *)
else NONE_msg ("unsupported argument type: "++argtype)
| _ => get_error_msg "unknown JSON format of argument: " (FST h)) /\
(petr4_parse_expressions (tyenv, enummap, vtymap, ftymap, gscope, extfun_list) [] =
SOME_msg []) /\
Expand Down

0 comments on commit 2338beb

Please sign in to comment.