Switch branches/tags
Nothing to show
Find file History

README

Example for binding golex and goyacc.

$ # To run it
$ make run

----

The calc example is also useful as a demonstration of the performed DFA
optmimization.

$ golex -DFA -nodfaopt tokenizer.l
StartConditions:
	INITIAL, scId:0, stateId:1
DFA:
[1]
	"\t", "\r", " ", --> 11
	"0"..."9", --> 2
	"."--> 12
[2]
	"E", "e", --> 8
	"."--> 3
	"0"..."9", --> 2
[3]
	"E", "e", --> 5
	"0"..."9", --> 4
[4]
	"0"..."9", --> 4
	"E", "e", --> 5
[5]
	"0"..."9", --> 6
	"+", "-", --> 7
[6]
	"0"..."9", --> 6
[7]
	"0"..."9", --> 6
[8]
	"+", "-", --> 9
	"0"..."9", --> 10
[9]
	"0"..."9", --> 10
[10]
	"0"..."9", --> 10
[11]
	"\t", "\r", " ", --> 11
[12]
	"0"..."9", --> 13
[13]
	"0"..."9", --> 13
	"E", "e", --> 14
[14]
	"+", "-", --> 16
	"0"..."9", --> 15
[15]
	"0"..."9", --> 15
[16]
	"0"..."9", --> 15
state 3 accepts rule 2
state 6 accepts rule 2
state 2 accepts rule 2
state 15 accepts rule 2
state 13 accepts rule 2
state 10 accepts rule 2
state 11 accepts rule 1
state 4 accepts rule 2

---- vs ----

$ golex -DFA tokenizer.l
StartConditions:
	INITIAL, scId:0, stateId:1
DFA:
[1]
	"0"..."9", --> 8
	"."--> 3
	"\t", "\r", " ", --> 2
[2]
	"\t", "\r", " ", --> 2
[3]
	"0"..."9", --> 4
[4]
	"E", "e", --> 5
	"0"..."9", --> 4
[5]
	"0"..."9", --> 7
	"+", "-", --> 6
[6]
	"0"..."9", --> 7
[7]
	"0"..."9", --> 7
[8]
	"."--> 4
	"E", "e", --> 5
	"0"..."9", --> 8
state 2 accepts rule 1
state 8 accepts rule 2
state 7 accepts rule 2
state 4 accepts rule 2

$