Beispiel #1
0
func parse(file *os.File) {
	var (
		token_list *lexer.Token
		ast        *parser.AST
	)
	token_list = lexer.Lex(file)
	ast = parser.Parse(token_list)

	fmt.Println(ast)
}
Beispiel #2
0
func lex(file *os.File) {
	var (
		token_list *lexer.Token
	)

	token_list = lexer.Lex(file)

	current_token := token_list

	/* first_token := token_list */

	for {
		fmt.Println(current_token.Type, string(current_token.Content))

		current_token = current_token.Next
		if current_token == nil {
			break
		}
	}
}