Ћирилисп код, активно извршаван у хипу, је делимично репно-елиминабилан
This commit is contained in:
parent
35cd4b13cf
commit
f27932a1f9
4
Makefile
4
Makefile
|
@ -9,8 +9,8 @@ LIBPREFIX = $(PREFIX)/lib
|
|||
|
||||
# флегови за C компајлер и линкер
|
||||
CPPFLAGS = -D_POSIX_C_SOURCE=2 -DDESTDIR=\"$(DESTDIR)\" -DVERSION=\"$(VERSION)\"
|
||||
CFLAGS = -g -std=c99 -pedantic -Wall -Wextra -O0 -fexec-charset=UTF-8 -finput-charset=UTF-8 -fwide-exec-charset=UTF-32LE
|
||||
# CFLAGS = -std=c99 -pedantic -Wall -Wextra -O3 -fexec-charset=UTF-8 -finput-charset=UTF-8 -fwide-exec-charset=UTF-32LE
|
||||
# CFLAGS = -g -std=c99 -pedantic -Wall -Wextra -O0 -fexec-charset=UTF-8 -finput-charset=UTF-8 -fwide-exec-charset=UTF-32LE
|
||||
CFLAGS = -std=c99 -pedantic -Wall -Wextra -O3 -fexec-charset=UTF-8 -finput-charset=UTF-8 -fwide-exec-charset=UTF-32LE
|
||||
LDFLAGS = -lm -lc
|
||||
|
||||
CC = cc
|
||||
|
|
|
@ -1282,7 +1282,9 @@ int main(int argc, char **argv)
|
|||
|
||||
\begin{wrapfigure}{r}{0.5\textwidth}
|
||||
\begin{center}
|
||||
\includegraphics[width=0.5\linewidth]{../../MMM_5394.jpg}
|
||||
\IfFileExists{./../../../MMM_5394.jpg}
|
||||
{\includegraphics[width=0.5\linewidth]{../../../MMM_5394.jpg}}
|
||||
{НАЈС ТРАЈ ЕФ-БИ-АЈ!}
|
||||
\end{center}
|
||||
\caption{Моја слика}
|
||||
\end{wrapfigure}
|
||||
|
|
21
eval.c
21
eval.c
|
@ -185,17 +185,24 @@ object apply(object procedure, object parameters, env currentEnv)
|
|||
}
|
||||
|
||||
object *currentExprPointer = &PROC_COMP_BODY(procedure);
|
||||
while (TYPE(*currentExprPointer) != nilObject)
|
||||
object currentExpr;
|
||||
while (TYPE(CDR(*currentExprPointer)) != nilObject)
|
||||
/* сви изрази осим задњег */
|
||||
{
|
||||
object currentExpr = copyObject(CAR(*currentExprPointer));
|
||||
currentExpr = copyObject(CAR(*currentExprPointer));
|
||||
currentExpr = Eval(currentExpr, procEnv);
|
||||
if (TYPE(CDR(*currentExprPointer)) == nilObject)
|
||||
{
|
||||
result = copyObject(currentExpr);
|
||||
}
|
||||
currentExprPointer = &CDR(*currentExprPointer);
|
||||
|
||||
deleteObject(currentExpr);
|
||||
currentExprPointer = &CDR(*currentExprPointer);
|
||||
}
|
||||
/* репни позив */
|
||||
currentExpr = copyObject(CAR(*currentExprPointer));
|
||||
//pruneExpr(¤tExpr); ова функција ће бити коришћена за
|
||||
// упроштавање израза, тако да постану репно-елиминалбилни, када буде
|
||||
// написана ЛОЛ :)
|
||||
currentExpr = Eval(currentExpr, procEnv);
|
||||
result = copyObject(currentExpr);
|
||||
|
||||
removeEnvironment(procEnv);
|
||||
--currentRecursionDepth;
|
||||
|
||||
|
|
Loading…
Reference in a new issue