| // Copyright 2009 The Go Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| import Universe "universe" |
| import Verifier "verifier" |
| func Compile(comp *Globals.Compilation, file_name string) { |
| src, ok := sys.readfile(file_name); |
| print "cannot open ", file_name, "\n" |
| scanner := new(Scanner.Scanner); |
| scanner.Open(file_name, src); |
| parser := new(Parser.Parser); |
| parser.Open(comp, scanner); |
| print "parsing ", file_name, "\n"; |
| if parser.S.nerrors > 0 { |
| if !comp.flags.semantic_checks { |
| if comp.flags.print_export { |
| Printer.PrintObject(comp, comp.pkgs[0].obj, false); |
| Export.Export(comp, file_name); |