Commits

Steven! Ragnarök  committed 4db8c26

Refactors for single token lookahead.

  • Participants
  • Parent commits 4d24230

Comments (0)

Files changed (1)

File top_downer.rb

 	def parse string
 		@tree = Hash.new
 		@enumerator = tokenize(string).each
+		recognize(:Program)
 	end
 
 	private
 
 	def match t
 		if @token[:type] == t
-			tkn, @token, @peek = @token, @enumerator.next, @enumerator.peek
+			tkn, @token = @token, @enumerator.next
 			return tkn[:token]
 		else
-			raise ArgumentError.new "SYNTAX ERROR expected #{t}, got #{@token[:token]}"
+			raise ArgumentError.new "SYNTAX ERROR expected #{t}, got #{tkn[:token]}"
 		end
 	end
 
 	# First we need to build some functions which recognize the first two
 	# symbols for each rule so that we can accurately consume our language.
 	# Now that we have a plan. Let's fuck some shit up!!!!
+	def recognize rule
+	end
 end