help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Implicit Multiplication


From: Hans Aberg
Subject: Re: Implicit Multiplication
Date: Sat, 6 Aug 2005 11:54:13 +0200


On 6 Aug 2005, at 03:05, Aaron Hurst wrote:

I would like to be able to parse implicit multiplication (i.e. if two expression appear next to each other without an operator, they should be mulitplied).

Here is a variation:

%token IDENTIFIER
%left '|' '+'
%left '^'
%left '&' '*' IDENTIFIER '(' ')'

%%

expression:
  IDENTIFIER
  | '(' expression ')'
  | expression '*' expression
  | expression '&' expression
  | expression '+' expression
  | expression '|' expression
  | expression '^' expression
  | IDENTIFIER IDENTIFIER
  | IDENTIFIER '(' expression ')'
  | '(' expression ')' IDENTIFIER
  | '(' expression ')' '(' expression ')'
  ;


  Hans Aberg






reply via email to

[Prev in Thread] Current Thread [Next in Thread]