Skip to content

Commit

Permalink
add simple main runnable
Browse files Browse the repository at this point in the history
  • Loading branch information
Garciat committed Jan 2, 2025
1 parent 32d2881 commit 91b7c94
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/cmd/main/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package main

import (
"github.com/garciat/gobid/check"
"github.com/garciat/gobid/compile"
"io"
"os"
)

func main() {
unit := compile.NewCompilationUnit("main")
for _, arg := range os.Args[1:] {
switch arg {
case "-v":
*check.DebugAll = true
case "-":
stdin, err := io.ReadAll(os.Stdin)
if err != nil {
panic(err)
}
unit.AddSource("stdin.go", stdin)
default:
unit.AddFile(arg)
}
}
unit.Compile()
}

0 comments on commit 91b7c94

Please sign in to comment.