from . import errors
from . import objects
from . import _context
from . import _layers


class NodeGenerator(_layers.Layer):

    @_layers.register(objects.Val)
    def _val(self, val):
        if isinstance(val.type_, tuple(map(type, (
                objects.CTypes.int_fast8, objects.CTypes.int_fast32,
                objects.CTypes.int_fast64, objects.CTypes.uint_fast8,
                objects.CTypes.uint_fast32, objects.CTypes.uint_fast64)))):
            return val.literal
        elif isinstance(val.type_, type(objects.CTypes.char)):
            return "'" + val.literal + "'"
        errors.not_implemented()

    @_layers.register(objects.Var)
    def _var(self, var):
        return var.name

    def generate(self, node):
        return self.get_registry()[node](node)

@@ -120,16 +120,344 @@
 ayer):%0A%0A
+    def _type(self, type_):%0A        # TODO: implement%0A        # return %22int%22%0A        errors.not_implemented()%0A%0A    def _expr(self, expr):%0A        if isinstance(expr, objects.Val):%0A            return self._val(expr)%0A        elif isinstance(expr, objects.Var):%0A            return self._var(expr)%0A        errors.not_implemented()%0A%0A
     @_la
@@ -1030,16 +1030,243 @@
 r.name%0A%0A
+    @_layers.register(objects.Decl)%0A    def _decl(self, decl):%0A        return %22 %22.join(%5B%0A            self._type(decl.type_),%0A            decl.name,%0A            %22=%22,%0A            %22%22.join(%5Bself._expr(decl.expr), %22;%22%5D)%0A        %5D)%0A%0A
     def 

Add high-level decl translation function without low-level functions' implementations