epsilon-devel
[Top][All Lists]
Advanced

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

[epsilon-devel] epsilon primitive operators


From: Luca Saiu
Subject: [epsilon-devel] epsilon primitive operators
Date: Wed, 01 Oct 2003 23:34:06 +0200
User-agent: Mozilla/5.0 (X11; U; Linux ppc; en-US; rv:1.4) Gecko/20030723

  Hi Matteo,
  as you requested I'm sending you a list of primitive operators.
I am not going to write them in the manual now since I plan to implement most of them in a very different way in the meta-interpreter and meta-compiler: they will be implemented as functions (even if they will be *primitive* functions, where "primitive" means "implemented in C"), and not as special operators as they are now; with your help, of course.

Here is the list, with some comments; types are between parentheses, and are not part of the syntax.

=======================================================================
  array operators:
  ----------------
  concatenation:          A1 @@ A2 (A1 : array of 'a, A2 : array of 'a)
  access to the i-th element: A @ i (A : array of 'a, i : integer)
  conversion from list:   list_to_array A (A : list of 'a)

  boolean operators (b, b1 and b2 are booleans; booleans are returned):
  -----------------
  not b
  b1 and b2
  b1 or b2
  b1 xor b2
  b1 and_strict b2 (both b1 and b2 are always evaluated)
  b1 or_strict b2 (both b1 and b2 are always evaluated)
All the comparing operators you expect: <, >, <=. >=, =, =/= (different), with the proper suffixes: 'i' for integers (optional), 'f' for floats, 'b' for booleans, 's' for strings.

  float operators:
  ----------------
The ones you expect: +f, -f (both unary and binary), *f, /f, **f (power). The suffix "f" is *mandatory*.

  integer operators:
  ------------------
The ones you expect: +, - (both unary and binary), *, /, ** (power). An optional suffix "i" is allowed, for uniformity with other types.

  list operators:
  ---------------
  empty:                 empty Xs (Xs : list of 'a; returns a boolean)
  cons:                  x :: Xs (x : 'a, Xs : list of 'a)
  head/car:              head Xs (Xs : list of 'a; returns an 'a)
  tail/cdr:              tail Xs (Xs : list of 'a; returns a list of 'a)
  conversion form array: array_to_list A (A : array of 'a)

  string operators:
  -----------------
  substring:        S from i to j (S : string, i : integer, j : integer)
  concatenation:    S1 @@s S2 (S1 : string, S2 : string)
access to the i-th character: S @s i (S : string, i : integer; returns a character)

  tuple (also called "n-uple") operators:
  ---------------------------------------
  tuple constructor:     x1, x2, ..., xn (xi can have any type)
selector: X ^ i (X is a tuple; returns the type of the i-th element of X)

  void operators:
  ---------------
There are *no* operators. "()" is the only object with type void, and is especially used as a placeholder for unused parameters.
=======================================================================

If you need some operators which don't exist yet and are not convenient for you to implement in epsilon don't hesitate to ask me.


I remind you about this since this is the first non-testing e-mail in the mailing list: please *always* reply to the mailing list address, address@hidden, and not directly to me. You can add my address in the Cc: field, if you like to be more specific.
  Bye,

--
Luca Saiu, maintainer of GNU epsilon
http://www.gnu.org/software/epsilon





reply via email to

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