Python 3 interpreter in Go
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
package main
|
|
|
|
|
|
import (
|
|
|
"fmt"
|
|
|
"os"
|
|
|
|
|
|
"github.com/brettlangdon/gython/parser"
|
|
|
"github.com/brettlangdon/gython/token"
|
|
|
)
|
|
|
|
|
|
func main() {
|
|
|
tokenizer, err := parser.TokenizerFromFileName(os.Args[1])
|
|
|
if err != nil {
|
|
|
panic(err)
|
|
|
}
|
|
|
for {
|
|
|
tok := tokenizer.Next()
|
|
|
if tok.ID == token.ENDMARKER || tok.ID == token.ERRORTOKEN {
|
|
|
break
|
|
|
}
|
|
|
fmt.Println(fmt.Sprintf("<%s> %s", tok, tok.Repr()))
|
|
|
}
|
|
|
}
|