PageRenderTime 62ms CodeModel.GetById 20ms RepoModel.GetById 1ms app.codeStats 0ms

/source/core/backend/Backend.ooc

http://github.com/nddrylliog/oc
Unknown | 34 lines | 30 code | 4 blank | 0 comment | 0 complexity | 639a17649296fd856573d5f54de47ac9 MD5 | raw file
  1. import ast/[Module, Access, Var]
  2. import middle/Resolver
  3. import frontend/BuildParams
  4. /**
  5. * Interface for pluggable backends in oc-c89
  6. */
  7. Backend: abstract class {
  8. /**
  9. * Given the full AST of a module and a set of build parameters, process
  10. * should compile the AST into the desired result.
  11. *
  12. * A C backend might produce C files, then call a C compiler to produce
  13. * a library/executable, for instance.
  14. *
  15. * A bytecode backend might produce backend and save it in files.
  16. *
  17. * An interpreter backend might simply interpret the module.
  18. */
  19. process: abstract func (module: Module, params: BuildParams)
  20. /**
  21. * Override this method to have a backend-specific way to resolve variable
  22. * accesses.
  23. *
  24. * For example, a C backend might automatically be aware of C types from
  25. * parsing header files, and allow resolving of those names automatically.
  26. */
  27. resolveAccess: func (acc: Access, task: Task, suggest: Func (Var)) {
  28. "resolveAccess(%s) in %s" printfln(acc toString(), class name)
  29. }
  30. }