Home | History | Annotate | Download | only in tutorial

Lines Matching full:precedence

21 `Operator-Precedence
71 Note that there is no discussion about precedence of binary operators,
242 (multiplication) has higher *precedence* than "+" (addition).
245 to use `Operator-Precedence
247 This parsing technique uses the precedence of binary operators to guide
252 (* binop_precedence - This holds the precedence for each binary operator that is
256 (* precedence - Get the precedence of the pending binary operator token. *)
257 let precedence c = try Hashtbl.find binop_precedence c with Not_found -> -1
263 * 1 is the lowest precedence. *)
272 reader). The ``Parser.precedence`` function returns the precedence for
277 comparisons in the ``Parser.precedence`` function. (Or just use a
281 expressions. The basic idea of operator precedence parsing is to break
284 Operator precedence parsing considers this as a stream of primary
302 pairs for us. It takes a precedence and a pointer to an expression for
309 The precedence value passed into ``Parser.parse_bin_rhs`` indicates the
310 *minimal operator precedence* that the function is allowed to eat. For
312 ``Parser.parse_bin_rhs`` is passed in a precedence of 40, it will not
313 consume any tokens (because the precedence of '+' is only 20). With this
322 (* If this is a binop, find its precedence. *)
324 let token_prec = precedence c in
330 This code gets the precedence of the current token and checks to see if
331 if is too low. Because we defined invalid tokens to have a precedence of
355 precedence and compare it to BinOp's precedence (which is '+' in this
362 let next_prec = precedence c2 in
365 If the precedence of the binop to the right of "RHS" is lower or equal
366 to the precedence of our current operator, then we know that the
369 same precedence. In this case we'll create the AST node for "a+b", and
387 primary. In this case, the precedence of "\*" is higher than the
388 precedence of "+" so the if condition will be entered.
402 if token_prec < precedence c2
414 primary has higher precedence than the binop we are currently parsing.
416 higher precedence than "+" should be parsed together and returned as
418 function specifying "token\_prec+1" as the minimum precedence required
713 (* binop_precedence - This holds the precedence for each binary operator that is
717 (* precedence - Get the precedence of the pending binary operator token. *)
718 let precedence c = try Hashtbl.find binop_precedence c with Not_found -> -1
761 (* If this is a binop, find its precedence. *)
763 let token_prec = precedence c in
780 let next_prec = precedence c2 in
879 * 1 is the lowest precedence. *)