Skip to content

Instantly share code, notes, and snippets.

@seantalts
Created January 5, 2019 21:48
Show Gist options
  • Save seantalts/26981388420a06d8996e5079212cd734 to your computer and use it in GitHub Desktop.
Save seantalts/26981388420a06d8996e5079212cd734 to your computer and use it in GitHub Desktop.
let ufb =
Core_kernel.Option.map ~f:(List.map semantic_check_statement) fb
in
(* Check that all declared functions have a definition *)
let _ =
if
Symbol_table.check_some_id_is_unassigned vm
&& !check_that_all_functions_have_definition
then
semantic_error
~loc:(List.hd (Core_kernel.Option.value_exn ufb)).stmt_typed_loc
"Some function is declared without specifying a definition."
(* TODO: insert better location in the error above *)
in
let _ = context_flags.current_block <- Data in
let udb =
Core_kernel.Option.map ~f:(List.map semantic_check_statement) db
in
let _ = context_flags.current_block <- TData in
let utdb =
Core_kernel.Option.map ~f:(List.map semantic_check_statement) tdb
in
let _ = context_flags.current_block <- Param in
let upb =
Core_kernel.Option.map ~f:(List.map semantic_check_statement) pb
in
let _ = context_flags.current_block <- TParam in
let utpb =
Core_kernel.Option.map ~f:(List.map semantic_check_statement) tpb
in
let _ = context_flags.current_block <- Model in
(* Model top level variables only assigned and read in model *)
let _ = Symbol_table.begin_scope vm in
let umb =
Core_kernel.Option.map ~f:(List.map semantic_check_statement) mb
in
let _ = Symbol_table.end_scope vm in
let _ = context_flags.current_block <- GQuant in
let ugb =
Core_kernel.Option.map ~f:(List.map semantic_check_statement) gb
in
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment