|
| 1 | +open Grain_parsing; |
| 2 | +open Grain_typed; |
| 3 | +open Grain_middle_end; |
| 4 | +open Grain_codegen; |
| 5 | +open Grain_linking; |
| 6 | + |
| 7 | +type input_source = |
| 8 | + | InputString(string) |
| 9 | + | InputFile(string); |
| 10 | + |
| 11 | +type compilation_state_desc = |
| 12 | + | Initial(input_source) |
| 13 | + | Parsed(Parsetree.parsed_program) |
| 14 | + | WellFormed(Parsetree.parsed_program) |
| 15 | + | TypeChecked(Typedtree.typed_program) |
| 16 | + | TypedWellFormed(Typedtree.typed_program) |
| 17 | + | Linearized(Anftree.anf_program) |
| 18 | + | Optimized(Anftree.anf_program) |
| 19 | + | Mashed(Mashtree.mash_program) |
| 20 | + | Compiled(Compmod.compiled_program) |
| 21 | + | ObjectFileEmitted(Compmod.compiled_program) |
| 22 | + | Linked(Compmod.compiled_program) |
| 23 | + | Assembled; |
| 24 | + |
| 25 | +type compilation_state = { |
| 26 | + cstate_desc: compilation_state_desc, |
| 27 | + cstate_filename: option(string), |
| 28 | + cstate_outfile: option(string), |
| 29 | +}; |
| 30 | + |
| 31 | +type compilation_action = |
| 32 | + | Continue(compilation_state) |
| 33 | + | Stop; |
| 34 | + |
| 35 | +type error = |
| 36 | + | Cannot_parse_inline_flags(string) |
| 37 | + | Cannot_use_help_or_version; |
| 38 | + |
| 39 | +exception InlineFlagsError(Location.t, error); |
| 40 | + |
| 41 | +let default_output_filename: string => string; |
| 42 | + |
| 43 | +let default_mashtree_filename: string => string; |
| 44 | + |
| 45 | +let stop_after_parse: compilation_state => compilation_action; |
| 46 | + |
| 47 | +let stop_after_well_formed: compilation_state => compilation_action; |
| 48 | + |
| 49 | +let stop_after_typed: compilation_state => compilation_action; |
| 50 | + |
| 51 | +let stop_after_typed_well_formed: compilation_state => compilation_action; |
| 52 | + |
| 53 | +let stop_after_anf: compilation_state => compilation_action; |
| 54 | + |
| 55 | +let stop_after_optimization: compilation_state => compilation_action; |
| 56 | + |
| 57 | +let stop_after_mashed: compilation_state => compilation_action; |
| 58 | + |
| 59 | +let stop_after_compiled: compilation_state => compilation_action; |
| 60 | + |
| 61 | +let stop_after_object_file_emitted: compilation_state => compilation_action; |
| 62 | + |
| 63 | +let stop_after_linked: compilation_state => compilation_action; |
| 64 | + |
| 65 | +let stop_after_assembled: compilation_state => compilation_action; |
| 66 | + |
| 67 | +let compile_string: |
| 68 | + ( |
| 69 | + ~is_root_file: bool=?, |
| 70 | + ~hook: compilation_state => compilation_action=?, |
| 71 | + ~name: string=?, |
| 72 | + ~outfile: string=?, |
| 73 | + ~reset: bool=?, |
| 74 | + string |
| 75 | + ) => |
| 76 | + compilation_state; |
| 77 | + |
| 78 | +let compile_file: |
| 79 | + ( |
| 80 | + ~is_root_file: bool=?, |
| 81 | + ~hook: compilation_state => compilation_action=?, |
| 82 | + ~outfile: string=?, |
| 83 | + ~reset: bool=?, |
| 84 | + string |
| 85 | + ) => |
| 86 | + compilation_state; |
| 87 | + |
| 88 | +let save_mashed: (string, string) => unit; |
0 commit comments