Commits

Steven! Ragnarök committed f395e42

Removes :+ from meta-grammar notation. Use :term :*term instead.

Comments (0)

Files changed (1)

 	:int_lit => /^-?[0-9]+$/,	:eof => /\$/
 }
 
-## ::meta-grammar:: * => 0..n, + => 1..n, or => any ONE of the following. ##
+##                         ::meta-grammar::
+## '*' => 0..n, '|' => any ONE of the marked rules.
 Grammar = {
-	:Program => [ :*, :NonReturnStatement, :ReturnStatement ],
-	:NonReturnStatement => [ :or, :AssignmentStatement, :DefineStatement ],
+	:Program => [ :"*NonReturnStatement", :ReturnStatement ],
+	:NonReturnStatement => [ :"|AssignmentStatement", :"|DefineStatement" ],
 	:AssignmentStatement => [ :set, :ident, :Expr ],
 	:DefineStatement => [ :define, :ident, :Arglist, :Program ],
-	:Arglist => [ :lparen, :+, :ident, :rparen ],
-	:Expr => [ :or, :int_lit, :ident, :Application ],
-	:Application => [ :lparen, :Fname, :*, :Expr, :rparen ],
-	:Fname => [ :or, :ident, :math_op ],
+	:Arglist => [ :lparen, :ident, :"*ident", :rparen ],
+	:Expr => [ :"|int_lit", :"|ident", :"|Application" ],
+	:Application => [ :lparen, :Fname, :"*Expr", :rparen ],
+	:Fname => [ :"|ident", :"|math_op" ],
 	:ReturnStatement => [ :return, :Expr ]
 }
 
 raise ArgumentError.new "too many arguments" if ARGV.length > 1
 raise ArgumentError.new "no argument given" if ARGV.empty?
 
-def match_maker construct
-	matcher = Array.new
-	rhs = Grammar[construct] || construct
-	case rhs
-	when Array
-		rhs.each do |c|
-
-		end
-	end
-end
-
 ## Terminal Matcher ##
 def match(terminal, token)
 	if terminal == token[:type]