aboutsummaryrefslogtreecommitdiff
path: root/parser.y
blob: 6b88e03ad762ccc7cb84527d4f6e1575e17d2216 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
%{
package main

import "fmt"
%}

%union {
	sval string
	ival int
	fval float64
	cval complex128
}

%token <sval> STRING
%token <ival> INTEGER
%token <fval> FLOAT
%token <cval> COMPLEX

%%

line
	: STRING	{ fmt.Println($1) }
	| INTEGER	{ fmt.Println($1) }
	| FLOAT		{ fmt.Println($1) }
	| COMPLEX	{ fmt.Println($1) }

%%