loa

Virtual machine for the Logic of Assumptions
git clone git://juanmeleiro.mat.br/loa
Log | Files | Refs

schema.h (807B)


      1 #include <stdbool.h>
      2 #include <stdlib.h>
      3 
      4 #include "symbol.h"
      5 #include "tree.h"
      6 
      7 typedef struct schema schema;
      8 
      9 /* BUILDING */
     10 schema* new_schema(symbol);
     11 void    add_constructor(schema*, symbol);
     12 void    assign_subschema(schema*, symbol, symbol, schema*);
     13 void    mark_as_leaf(schema*, symbol, symbol);
     14 void    set_check_function(schema*, bool (*)(tree*));
     15 
     16 /* USING */
     17 schema* get_subschema(schema*, symbol, symbol);
     18 bool is_constructor(schema*, symbol);
     19 bool has_key(schema*, symbol, symbol);
     20 bool takes_leaf(schema*, symbol, symbol);
     21 bool check(schema*, tree*);
     22 symbol get_name(schema*);
     23 
     24 size_t get_amount_of_required_keys(schema*, symbol);
     25 symbol *get_required_keys(schema*, symbol);
     26 
     27 extern struct schema *LEAF;
     28 
     29 /* Guarantees:
     30    - assign_subschema, get_subschema => id
     31    Test:
     32    - check tree
     33  */