1

All Lisp-like expressions.

A Lisp expression may be an unsigned integer or a list. A list, enclosed by left and right parentheses, consists of one operator ($+$, $-$, $*$, $/$, $\max$, $\min$) followed by a sequence of at least one Lisp expression. For instance, $13$, $(- \;8)$, $(*\; 9\; 3)$, $(+\; (*\; 2\; 2)\; 4)$, and $(\min\; (\max\; 3\; 1\; 4) (\max\; 2\; 7\; 1))$ are Lisp expressions.

This is my solution:

\begin{gather} S \to X \mid Y \\ X \to 0\text{–}9 X \mid \epsilon \\ Y \to ( E )\mid \epsilon \\ E \to +,-,*,/,\max,\min YX \end{gather}

dfeuer
  • 9,069
Herious
  • 157
  • The computer science stack exchange may get you better results. There are two of them:
    http://cs.stackexchange.com/ and http://cstheory.stackexchange.com/
    – josh Aug 25 '13 at 02:59
  • Hmm.. so X is your unsigned integer and Y is your list? Don't forget any lisp expression can be used as arguments of an operation (see your min/max example, for instance). – Evan Aug 25 '13 at 03:06
  • Correct me if I'm wrong, the term is "S-expression". No? – Asaf Karagila Aug 25 '13 at 05:26

0 Answers0