2 <link rel=
"stylesheet" href=
"style.css" type=
"text/css">
3 <meta content=
"text/html; charset=iso-8859-1" http-equiv=
"Content-Type">
4 <link rel=
"Start" href=
"index.html">
5 <link title=
"Index of types" rel=Appendix
href=
"index_types.html">
6 <link title=
"Index of exceptions" rel=Appendix
href=
"index_exceptions.html">
7 <link title=
"Index of values" rel=Appendix
href=
"index_values.html">
8 <link title=
"Index of modules" rel=Appendix
href=
"index_modules.html">
9 <link title=
"Types" rel=
"Chapter" href=
"Types.html">
10 <link title=
"Parser" rel=
"Chapter" href=
"Parser.html">
11 <link title=
"Lexer" rel=
"Chapter" href=
"Lexer.html">
12 <link title=
"Value" rel=
"Chapter" href=
"Value.html">
13 <link title=
"Signal" rel=
"Chapter" href=
"Signal.html">
14 <link title=
"Faustexp" rel=
"Chapter" href=
"Faustexp.html">
15 <link title=
"Interpreter" rel=
"Chapter" href=
"Interpreter.html">
16 <link title=
"Preprocess" rel=
"Chapter" href=
"Preprocess.html">
17 <link title=
"Main" rel=
"Chapter" href=
"Main.html"><title>Interpreter.interpret_ident
</title>
20 <code class=
"code"><span class=
"keyword">let
</span> interpret_ident
=
<span class=
"keyword">fun
</span> s
<span class=
"keywordsign">-
></span> <span class=
"keyword">fun
</span> input_beam
<span class=
"keywordsign">-
></span><br>
21 <span class=
"keyword">let
</span> n
=
<span class=
"constructor">List
</span>.length
input_beam
<span class=
"keyword">in
</span><br>
22 <span class=
"keyword">match
</span> s
<span class=
"keyword">with
</span><br>
23 <span class=
"keywordsign">|
</span><span class=
"constructor">Pass
</span> <span class=
"keywordsign">-
></span> <span class=
"keyword">if
</span> n
=
1 <span class=
"keyword">then
</span> input_beam
<span class=
"keyword">else
</span> raise
(
<span class=
"constructor">Evaluation_Error
</span> <span class=
"string">"Ident _"</span>)
<br>
25 <span class=
"keywordsign">|
</span><span class=
"constructor">Stop
</span> <span class=
"keywordsign">-
></span> <span class=
"keyword">if
</span> n
=
1 <span class=
"keyword">then
</span> []
<span class=
"keyword">else
</span> raise
(
<span class=
"constructor">Evaluation_Error
</span> <span class=
"string">"Ident !"</span>)
<br>
27 <span class=
"keywordsign">|
</span><span class=
"constructor">Add
</span> <span class=
"keywordsign">-
></span> <span class=
"keyword">if
</span> n
=
2 <span class=
"keyword">then
</span> [signal_add
(
<span class=
"constructor">List
</span>.nth
input_beam
0)
(
<span class=
"constructor">List
</span>.nth
input_beam
1)]
<br>
28 <span class=
"keyword">else
</span> raise
(
<span class=
"constructor">Evaluation_Error
</span> <span class=
"string">"Ident +"</span>)
<br>
30 <span class=
"keywordsign">|
</span><span class=
"constructor">Sup
</span> <span class=
"keywordsign">-
></span> <span class=
"keyword">if
</span> n
=
2 <span class=
"keyword">then
</span> [signal_sub
(
<span class=
"constructor">List
</span>.nth
input_beam
0)
(
<span class=
"constructor">List
</span>.nth
input_beam
1)]
<br>
31 <span class=
"keyword">else
</span> raise
(
<span class=
"constructor">Evaluation_Error
</span> <span class=
"string">"Ident -"</span>)
<br>
33 <span class=
"keywordsign">|
</span><span class=
"constructor">Mul
</span> <span class=
"keywordsign">-
></span> <span class=
"keyword">if
</span> n
=
2 <span class=
"keyword">then
</span> [signal_mul
(
<span class=
"constructor">List
</span>.nth
input_beam
0)
(
<span class=
"constructor">List
</span>.nth
input_beam
1)]
<br>
34 <span class=
"keyword">else
</span> raise
(
<span class=
"constructor">Evaluation_Error
</span> <span class=
"string">"Ident *"</span>)
<br>
36 <span class=
"keywordsign">|
</span><span class=
"constructor">Div
</span> <span class=
"keywordsign">-
></span> <span class=
"keyword">if
</span> n
=
2 <span class=
"keyword">then
</span> [signal_div
(
<span class=
"constructor">List
</span>.nth
input_beam
0)
(
<span class=
"constructor">List
</span>.nth
input_beam
1)]
<br>
37 <span class=
"keyword">else
</span> raise
(
<span class=
"constructor">Evaluation_Error
</span> <span class=
"string">"Ident /"</span>)
<br>
39 <span class=
"keywordsign">|
</span><span class=
"constructor">Delay
</span> <span class=
"keywordsign">-
></span> <span class=
"keyword">if
</span> n
=
2 <span class=
"keyword">then
</span> [signal_delay
(
<span class=
"constructor">List
</span>.nth
input_beam
0)
(
<span class=
"constructor">List
</span>.nth
input_beam
1)]
<br>
40 <span class=
"keyword">else
</span> raise
(
<span class=
"constructor">Evaluation_Error
</span> <span class=
"string">"Ident @"</span>)
<br>
42 <span class=
"keywordsign">|
</span><span class=
"constructor">Mem
</span> <span class=
"keywordsign">-
></span> <span class=
"keyword">if
</span> n
=
1 <span class=
"keyword">then
</span> [signal_mem
(
<span class=
"constructor">List
</span>.nth
input_beam
0)]
<br>
43 <span class=
"keyword">else
</span> raise
(
<span class=
"constructor">Evaluation_Error
</span> <span class=
"string">"Ident mem"</span>)
<br>
45 <span class=
"keywordsign">|
</span><span class=
"constructor">Vectorize
</span> <span class=
"keywordsign">-
></span> <span class=
"keyword">if
</span> n
=
2 <span class=
"keyword">then
</span> [signal_vectorize
(
<span class=
"constructor">List
</span>.nth
input_beam
0)
(
<span class=
"constructor">List
</span>.nth
input_beam
1)]
<br>
46 <span class=
"keyword">else
</span> raise
(
<span class=
"constructor">Evaluation_Error
</span> <span class=
"string">"Ident vectorize"</span>)
<br>
48 <span class=
"keywordsign">|
</span><span class=
"constructor">Serialize
</span> <span class=
"keywordsign">-
></span> <span class=
"keyword">if
</span> n
=
1 <span class=
"keyword">then
</span> [signal_serialize
(
<span class=
"constructor">List
</span>.nth
input_beam
0)]
<br>
49 <span class=
"keyword">else
</span> raise
(
<span class=
"constructor">Evaluation_Error
</span> <span class=
"string">"Ident serialize"</span>)
<br>
51 <span class=
"keywordsign">|
</span><span class=
"constructor">Concat
</span> <span class=
"keywordsign">-
></span> <span class=
"keyword">if
</span> n
=
2 <span class=
"keyword">then
</span> [signal_append
(
<span class=
"constructor">List
</span>.nth
input_beam
0)
(
<span class=
"constructor">List
</span>.nth
input_beam
1)]
<br>
52 <span class=
"keyword">else
</span> raise
(
<span class=
"constructor">Evaluation_Error
</span> <span class=
"string">"Ident #"</span>)
<br>
54 <span class=
"keywordsign">|
</span><span class=
"constructor">Nth
</span> <span class=
"keywordsign">-
></span> <span class=
"keyword">if
</span> n
=
2 <span class=
"keyword">then
</span> [signal_nth
(
<span class=
"constructor">List
</span>.nth
input_beam
0)
(
<span class=
"constructor">List
</span>.nth
input_beam
1)]
<br>
55 <span class=
"keyword">else
</span> raise
(
<span class=
"constructor">Evaluation_Error
</span> <span class=
"string">"Ident []"</span>)
<br>
57 <span class=
"keywordsign">|
</span><span class=
"constructor">Floor
</span> <span class=
"keywordsign">-
></span> <span class=
"keyword">if
</span> n
=
1 <span class=
"keyword">then
</span> [signal_floor
(
<span class=
"constructor">List
</span>.nth
input_beam
0)]
<br>
58 <span class=
"keyword">else
</span> raise
(
<span class=
"constructor">Evaluation_Error
</span> <span class=
"string">"Ident floor"</span>)
<br>
60 <span class=
"keywordsign">|
</span><span class=
"constructor">Int
</span> <span class=
"keywordsign">-
></span> <span class=
"keyword">if
</span> n
=
1 <span class=
"keyword">then
</span> [signal_int
(
<span class=
"constructor">List
</span>.nth
input_beam
0)]
<br>
61 <span class=
"keyword">else
</span> raise
(
<span class=
"constructor">Evaluation_Error
</span> <span class=
"string">"Ident int"</span>)
<br>
63 <span class=
"keywordsign">|
</span><span class=
"constructor">Sin
</span> <span class=
"keywordsign">-
></span> <span class=
"keyword">if
</span> n
=
1 <span class=
"keyword">then
</span> [signal_sin
(
<span class=
"constructor">List
</span>.nth
input_beam
0)]
<br>
64 <span class=
"keyword">else
</span> raise
(
<span class=
"constructor">Evaluation_Error
</span> <span class=
"string">"Ident sin"</span>)
<br>
66 <span class=
"keywordsign">|
</span><span class=
"constructor">Cos
</span> <span class=
"keywordsign">-
></span> <span class=
"keyword">if
</span> n
=
1 <span class=
"keyword">then
</span> [signal_cos
(
<span class=
"constructor">List
</span>.nth
input_beam
0)]
<br>
67 <span class=
"keyword">else
</span> raise
(
<span class=
"constructor">Evaluation_Error
</span> <span class=
"string">"Ident cos"</span>)
<br>
69 <span class=
"keywordsign">|
</span><span class=
"constructor">Atan
</span> <span class=
"keywordsign">-
></span> <span class=
"keyword">if
</span> n
=
1 <span class=
"keyword">then
</span> [signal_atan
(
<span class=
"constructor">List
</span>.nth
input_beam
0)]
<br>
70 <span class=
"keyword">else
</span> raise
(
<span class=
"constructor">Evaluation_Error
</span> <span class=
"string">"Ident atan"</span>)
<br>
72 <span class=
"keywordsign">|
</span><span class=
"constructor">Atantwo
</span> <span class=
"keywordsign">-
></span> <span class=
"keyword">if
</span> n
=
2 <span class=
"keyword">then
</span> [signal_atantwo
(
<span class=
"constructor">List
</span>.nth
input_beam
0)
(
<span class=
"constructor">List
</span>.nth
input_beam
1)]
<br>
73 <span class=
"keyword">else
</span> raise
(
<span class=
"constructor">Evaluation_Error
</span> <span class=
"string">"Ident atantwo"</span>)
<br>
75 <span class=
"keywordsign">|
</span><span class=
"constructor">Sqrt
</span> <span class=
"keywordsign">-
></span> <span class=
"keyword">if
</span> n
=
1 <span class=
"keyword">then
</span> [signal_sqrt
(
<span class=
"constructor">List
</span>.nth
input_beam
0)]
<br>
76 <span class=
"keyword">else
</span> raise
(
<span class=
"constructor">Evaluation_Error
</span> <span class=
"string">"Ident sqrt"</span>)
<br>
78 <span class=
"keywordsign">|
</span><span class=
"constructor">Rdtable
</span> <span class=
"keywordsign">-
></span> <span class=
"keyword">if
</span> n
=
3 <span class=
"keyword">then
</span> [signal_rdtable
(
<span class=
"constructor">List
</span>.nth
input_beam
0)
<br>
79 (
<span class=
"constructor">List
</span>.nth
input_beam
1)
(
<span class=
"constructor">List
</span>.nth
input_beam
2)]
<br>
80 <span class=
"keyword">else
</span> raise
(
<span class=
"constructor">Evaluation_Error
</span> <span class=
"string">"Ident rdtable"</span>)
<br>
82 <span class=
"keywordsign">|
</span><span class=
"constructor">Selecttwo
</span> <span class=
"keywordsign">-
></span> <span class=
"keyword">if
</span> n
=
3 <span class=
"keyword">then
</span> [signal_select2
(
<span class=
"constructor">List
</span>.nth
input_beam
0)
(
<span class=
"constructor">List
</span>.nth
input_beam
1)
<br>
83 (
<span class=
"constructor">List
</span>.nth
input_beam
2)]
<br>
84 <span class=
"keyword">else
</span> raise
(
<span class=
"constructor">Evaluation_Error
</span> <span class=
"string">"Ident select2"</span>)
<br>
86 <span class=
"keywordsign">|
</span><span class=
"constructor">Selectthree
</span> <span class=
"keywordsign">-
></span> <span class=
"keyword">if
</span> n
=
4 <span class=
"keyword">then
</span> [signal_select3
(
<span class=
"constructor">List
</span>.nth
input_beam
0)
(
<span class=
"constructor">List
</span>.nth
input_beam
1)
<br>
87 (
<span class=
"constructor">List
</span>.nth
input_beam
2)
(
<span class=
"constructor">List
</span>.nth
input_beam
3)]
<br>
88 <span class=
"keyword">else
</span> raise
(
<span class=
"constructor">Evaluation_Error
</span> <span class=
"string">"Ident select3"</span>)
<br>
90 <span class=
"keywordsign">|
</span><span class=
"constructor">Prefix
</span> <span class=
"keywordsign">-
></span> <span class=
"keyword">if
</span> n
=
2 <span class=
"keyword">then
</span> [signal_prefix
(
<span class=
"constructor">List
</span>.nth
input_beam
0)
(
<span class=
"constructor">List
</span>.nth
input_beam
1)]
<br>
91 <span class=
"keyword">else
</span> raise
(
<span class=
"constructor">Evaluation_Error
</span> <span class=
"string">"Ident prefix"</span>)
<br>
93 <span class=
"keywordsign">|
</span><span class=
"constructor">Mod
</span> <span class=
"keywordsign">-
></span> <span class=
"keyword">if
</span> n
=
2 <span class=
"keyword">then
</span> [signal_mod
(
<span class=
"constructor">List
</span>.nth
input_beam
0)
(
<span class=
"constructor">List
</span>.nth
input_beam
1)]
<br>
94 <span class=
"keyword">else
</span> raise
(
<span class=
"constructor">Evaluation_Error
</span> <span class=
"string">"Ident %"</span>)
<br>
96 <span class=
"keywordsign">|
</span><span class=
"constructor">Larger
</span> <span class=
"keywordsign">-
></span> <span class=
"keyword">if
</span> n
=
2 <span class=
"keyword">then
</span> [signal_sup
(
<span class=
"constructor">List
</span>.nth
input_beam
0)
(
<span class=
"constructor">List
</span>.nth
input_beam
1)]
<br>
97 <span class=
"keyword">else
</span> raise
(
<span class=
"constructor">Evaluation_Error
</span> <span class=
"string">"Ident >"</span>)
<br>
99 <span class=
"keywordsign">|
</span><span class=
"constructor">Smaller
</span> <span class=
"keywordsign">-
></span> <span class=
"keyword">if
</span> n
=
2 <span class=
"keyword">then
</span> [signal_inf
(
<span class=
"constructor">List
</span>.nth
input_beam
0)
(
<span class=
"constructor">List
</span>.nth
input_beam
1)]
<br>
100 <span class=
"keyword">else
</span> raise
(
<span class=
"constructor">Evaluation_Error
</span> <span class=
"string">"Ident <"</span>)
</code></body></html>