PageRenderTime 39ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/source/core/frontend/Driver.ooc

http://github.com/nddrylliog/oc
Unknown | 35 lines | 26 code | 9 blank | 0 comment | 0 complexity | 5dde458357b815537732016a1bfca90a MD5 | raw file
  1. import frontend/[ParsingPool, BuildParams]
  2. import io/File
  3. import middle/Resolver
  4. import ast/Module
  5. import ../DynamicLoader
  6. Driver: class {
  7. compile: static func (file: String, params: BuildParams) {
  8. if(!File new(file) exists?()) {
  9. "File not found: %s, bailing out" printfln(file)
  10. exit(1)
  11. }
  12. // parse main module and dependencies!
  13. pool := ParsingPool new(params)
  14. mainJob := ParsingJob new(file, null)
  15. pool push(mainJob)
  16. pool exhaust()
  17. if(params dump?) {
  18. pseudoBackend := DynamicLoader loadBackend("pseudo", params)
  19. pool done each(|j|
  20. pseudoBackend process(j module, params)
  21. )
  22. }
  23. mainJob module main? = true
  24. Resolver new(params, mainJob module) start()
  25. }
  26. }