In Spad, a simple line such as
if false then 1
can cause a compile error:
****** comp fails at level 2 with expression: ******
error in function test1
(SEQ | << noBranch >> | (|exit| 1 |x|))
****** level 2 ******
$x:= noBranch
$m:= NoValueMode
That's because at parsing stage, the parser
will tranform "if false then 1" into "noBranch".
See 'parseIf' in src/interp/parse.boot.
So I treat this case at compile-time,
by transforming "noBranch" into a "voidValue".
https://github.com/oldk1331/fricas/commit/e7fcea4da7d3693da45bd5985c93a377a6b5eab7.patch
diff --git a/src/interp/compiler.boot b/src/interp/compiler.boot
index c1fab3b2..e91fe598 100644
--- a/src/interp/compiler.boot
+++ b/src/interp/compiler.boot
@@ -367,6 +367,7 @@ DEFPARAMETER($compForModeIfTrue, false)
compSymbol(s,m,e) ==
s="$NoValue" => ["$NoValue",$NoValueMode,e]
+ s = 'noBranch => [voidValue(), $Void, e]
isFluid s => [s,getmode(s,e) or return nil,e]
s="true" => ['(QUOTE T),$Boolean,e]
s="false" => [false,$Boolean,e]
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.