Version 7 (modified by archibald, 8 years ago) (diff)

--

Expression Syntax

This is just an area win which I'm exploring a simple expression syntax ...

Here's an example of a simple syntax

operators := ( "+" | "-" | "*" | "/" | "%" | "=" );
expression := 
  ( identifier
  | constant
  | operator /* monadic */ expression 
      ( operator /* diadic */ expression )
  | "(" expression ")"
  );

The above syntax should let you have any operator as either monadic or diadic ... and has no implicit precedence (ie the brackets are required to produce the precedence)

This doesn't take into account whether an identifer is or isn't mutable ... and takes no account of contants not being mutable.

What does all this this mean?

Well if we don't mind having expressions like

3 := fred + (2 * -15) + *thing

Then it's accepable