Skip to content
/ LR0 Public
forked from kendalharland/LR0

Generate the set of LR(0) items from an augmented grammar

License

Notifications You must be signed in to change notification settings

mrmitzh/LR0

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

LR0

Generate the set of LR(0) items from an augmented grammar

####compling:

	make

####runnning:

	./lrz < grammar.txt

###example grammar:

	E
	E->E+T
	E->T
	T->T*F
	T->F
	F->(E)
	F->i

###example output:

	Augmented Grammar
	-----------------
	'->E
	E->E+T
	E->T
	T->T*F
	T->F
	F->(E)
	F->i

	Sets of LR(0) Items
	-------------------
	I0:
		'->@E                goto(E)=I1
		E->@E+T
		E->@T                goto(T)=I2
		T->@T*F
		T->@F                goto(F)=I3
		F->@(E)              goto(()=I4
		F->@i                goto(i)=I5
	I1:
		'->E@
		E->E@+T              goto(+)=I6
	I2:
		E->T@
		T->T@*F              goto(*)=I7
	I3:
		T->F@
	I4:
		F->(@E)              goto(E)=I8
		E->@E+T
		E->@T                goto(T)=I2
		T->@T*F
		T->@F                goto(F)=I3
		F->@(E)              goto(()=I4
		F->@i                goto(i)=I5
	I5:
		F->i@
	I6:
		E->E+@T              goto(T)=I9
		T->@T*F
		T->@F                goto(F)=I3
		F->@(E)              goto(()=I4
		F->@i                goto(i)=I5
	I7:
		T->T*@F              goto(F)=I10
		F->@(E)              goto(()=I4
		F->@i                goto(i)=I5
	I8:
		F->(E@)              goto())=I11
		E->E@+T              goto(+)=I6
	I9:
		E->E+T@
		T->T@*F              goto(*)=I7
	I10:
		T->T*F@
	I11:
		F->(E)@

About

Generate the set of LR(0) items from an augmented grammar

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 99.4%
  • Makefile 0.6%