login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

Boot (more precisely newer dialect called Shoe) is used internally in FriCAS for some of the interpreter and compiler code. Here is a detailed description of the Boot Language

This is a simple example of Boot programming.

Define a function.

fricas
(1) -> <boot>
pairBoot(a,b) ==
  a>b => [-b,-a]
  [a,b]</boot>
You cannot )read the file /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/9211484592716052519-25px001.boot because your user-level is not is not high enough. For more information about your user-level, issue )set userlevel .

Now call it.

fricas
pairBoot(1,4)$Lisp
pairBoot is not a lisp function and so cannot be used with $Lisp.

That's my first Boot function!

You can now write for example:

boot
foobar(x,y) == x + y
boot
 
   You cannot )read the file 
      /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/7491012761112044243-25px003.boot
      because your user-level is not is not high enough. For more 
      information about your user-level, issue )set userlevel .

And call it with

fricas
integer(foobar(2,3)$Lisp)
foobar is not a lisp function and so cannot be used with $Lisp.

In FriCAS (from revision 1049 on) the simplest way to compile and load boot code is to write it into a file and then call something like:

  )read FILE.boot

To debug Boot code add diagnostic printouts using SAY, like

boot
print_bar(x) ==
   SAY(["print_bar", x])
boot
 
   You cannot )read the file 
      /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/6147864484223767607-25px005.boot
      because your user-level is not is not high enough. For more 
      information about your user-level, issue )set userlevel .

fricas
)boot print_bar(123)
Your user access level is compiler and this command is therefore not available. See the )set userlevel command for more information.

Note: Unlike other printing functions SAY prints to terminal even if normal output is redirected to a file. So it is useful for debugging for example Spad compiler, where normal output goes to file.

One can also add breakpoints using BREAK(). When executed BREAK() passes control to Lisp debugger and one can for example find out which code called given place. BREAK() is used in FriCAS sources to indicate conditions that should be always true, but we want visible report if they fail.




  Subject:   Be Bold !!
  ( 14 subscribers )  
Please rate this page: