First shot at a lexer.

This commit is contained in:
Daniel Jones 2013-02-25 21:25:25 -08:00
commit 9ba796161d
2 changed files with 337 additions and 0 deletions

24
mk.go Normal file
View file

@ -0,0 +1,24 @@
package main
import (
"fmt"
"os"
"io/ioutil"
)
func main() {
input, _ := ioutil.ReadAll(os.Stdin)
l, tokens := lex(string(input))
for t := range tokens {
if t.typ == tokenError {
fmt.Printf("Error: %s", l.errmsg)
break
}
fmt.Println(t.String())
}
}