Skip to content
Snippets Groups Projects
bc_compiler.c 543 B
Newer Older
  • Learn to ignore specific revisions
  • #include "bc_compiler.c"
    
    void string_init    ( String * str ) {
      str -> capacity = 1000;
      str -> len = 0;
      str -> str = (u8*) malloc ( 1000 );
    }
    
    void string_destroy ( String * str ) {
      free ( str -> str );
    }
    
    void ast_to_bc ( Ast * ast ) {
      switch ( ast -> kind ) {
        default:
          assert ( false );
      }
    }
    
    void generate_bc ( Ast * ast, String * bc ) {
      // generate header
    
      // generate internals (constants (exp. functions), globals)
      ast_to_bc ( ast );
    
      // header
      // constants to bc
      // globals to bc
      // EP
    }