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

Edit detail for SandBoxSPADParser revision 2 of 2

1 2
Editor: Bill page
Time: 2014/03/17 02:52:08 GMT+0
Note:

added:

Click + at the top right of the window to expand the SPAD compilere output to show the parser output in the following examples::

 (+)   help  links  subscribe  changes  refresh  edit

Parsing FriCAS/Axiom code

There are four possible forms of parsed output.

Click + at the top right of the window to expand the SPAD compilere output to show the parser output in the following examples:

 (+)   help  links  subscribe  changes  refresh  edit

fricas
(1) -> )boot $RawParseOnly := true
Your user access level is compiler and this command is therefore not available. See the )set userlevel command for more information.

spad
)abbrev package PASCAL Pascal
Pascal : with ( make_pascal : Integer -> Matrix(Integer) )
  == add
    make_pascal(N : Integer) : Matrix(Integer) ==
        -- coerce here to NonNegativeInteger because this is what
        -- 'zero' requires
        nn := N::NonNegativeInteger
        tab := zero(nn, nn)$Matrix(Integer)
        n : Integer
        tab(1, 1) := 1
        for n in 2..nn repeat
            -- Fill row numer n
            k : Integer
            tab(n, 1) := 1
            tab(n, n) := 1
            for k in 2..(n - 1) repeat
                tab(n, k) := tab(n-1, k) + tab(n-1, k-1)
        tab
spad
   Compiling FriCAS source code from file 
      /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/1379180095272779836-25px002.spad
      using old system compiler.
   PASCAL abbreviates package Pascal 
------------------------------------------------------------------------
   initializing NRLIB PASCAL for Pascal 
   compiling into NRLIB PASCAL 
   compiling exported make_pascal : Integer -> Matrix Integer
Time: 0.03 SEC.
(time taken in buildFunctor: 0)
;;; *** |Pascal| REDEFINED
;;; *** |Pascal| REDEFINED Time: 0 SEC.
Cumulative Statistics for Constructor Pascal Time: 0.03 seconds
finalizing NRLIB PASCAL Processing Pascal for Browser database: --->-->Pascal(constructor): Not documented!!!! --->-->Pascal((make_pascal ((Matrix (Integer)) (Integer)))): Not documented!!!! --->-->Pascal(): Missing Description ; compiling file "/var/aw/var/LatexWiki/PASCAL.NRLIB/PASCAL.lsp" (written 31 OCT 2024 06:48:13 PM):
; wrote /var/aw/var/LatexWiki/PASCAL.NRLIB/PASCAL.fasl ; compilation finished in 0:00:00.012 ------------------------------------------------------------------------ Pascal is now explicitly exposed in frame initial Pascal will be automatically loaded when needed from /var/aw/var/LatexWiki/PASCAL.NRLIB/PASCAL

fricas
)boot $RawParseOnly := true
Your user access level is compiler and this command is therefore not available. See the )set userlevel command for more information.

spad
)abbrev package PASCAL Pascal
Pascal : with ( make_pascal : Integer -> Matrix(Integer) )
  == add
    make_pascal(N : Integer) : Matrix(Integer) ==
        -- coerce here to NonNegativeInteger because this is what
        -- 'zero' requires
        nn := N::NonNegativeInteger
        tab := zero(nn, nn)$Matrix(Integer)
        n : Integer
        tab(1, 1) := 1
        for n in 2..nn repeat
            -- Fill row numer n
            k : Integer
            tab(n, 1) := 1
            tab(n, n) := 1
            for k in 2..(n - 1) repeat
                tab(n, k) := tab(n-1, k) + tab(n-1, k-1)
        tab
spad
   Compiling FriCAS source code from file 
      /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/1379180095272779836-25px004.spad
      using old system compiler.
   PASCAL abbreviates package Pascal 
------------------------------------------------------------------------
   initializing NRLIB PASCAL for Pascal 
   compiling into NRLIB PASCAL 
   compiling exported make_pascal : Integer -> Matrix Integer
Time: 0 SEC.
(time taken in buildFunctor: 0)
;;; *** |Pascal| REDEFINED
;;; *** |Pascal| REDEFINED Time: 0 SEC.
Cumulative Statistics for Constructor Pascal Time: 0 seconds
finalizing NRLIB PASCAL Processing Pascal for Browser database: --->/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/1379180095272779836-25px002.spad-->Pascal(constructor): Not documented!!!! --->/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/1379180095272779836-25px002.spad-->Pascal((make_pascal ((Matrix (Integer)) (Integer)))): Not documented!!!! --->/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/1379180095272779836-25px002.spad-->Pascal(): Missing Description ; compiling file "/var/aw/var/LatexWiki/PASCAL.NRLIB/PASCAL.lsp" (written 31 OCT 2024 06:48:13 PM):
; wrote /var/aw/var/LatexWiki/PASCAL.NRLIB/PASCAL.fasl ; compilation finished in 0:00:00.008 ------------------------------------------------------------------------ Pascal is already explicitly exposed in frame initial Pascal will be automatically loaded when needed from /var/aw/var/LatexWiki/PASCAL.NRLIB/PASCAL

fricas
)boot $FlatParseOnly := true
Your user access level is compiler and this command is therefore not available. See the )set userlevel command for more information.

spad
)abbrev package PASCAL Pascal
Pascal : with ( make_pascal : Integer -> Matrix(Integer) )
  == add
    make_pascal(N : Integer) : Matrix(Integer) ==
        -- coerce here to NonNegativeInteger because this is what
        -- 'zero' requires
        nn := N::NonNegativeInteger
        tab := zero(nn, nn)$Matrix(Integer)
        n : Integer
        tab(1, 1) := 1
        for n in 2..nn repeat
            -- Fill row numer n
            k : Integer
            tab(n, 1) := 1
            tab(n, n) := 1
            for k in 2..(n - 1) repeat
                tab(n, k) := tab(n-1, k) + tab(n-1, k-1)
        tab
spad
   Compiling FriCAS source code from file 
      /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/1379180095272779836-25px006.spad
      using old system compiler.
   PASCAL abbreviates package Pascal 
------------------------------------------------------------------------
   initializing NRLIB PASCAL for Pascal 
   compiling into NRLIB PASCAL 
   compiling exported make_pascal : Integer -> Matrix Integer
Time: 0 SEC.
(time taken in buildFunctor: 0)
;;; *** |Pascal| REDEFINED
;;; *** |Pascal| REDEFINED Time: 0 SEC.
Cumulative Statistics for Constructor Pascal Time: 0 seconds
finalizing NRLIB PASCAL Processing Pascal for Browser database: --->/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/1379180095272779836-25px004.spad-->Pascal(constructor): Not documented!!!! --->/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/1379180095272779836-25px004.spad-->Pascal((make_pascal ((Matrix (Integer)) (Integer)))): Not documented!!!! --->/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/1379180095272779836-25px004.spad-->Pascal(): Missing Description ; compiling file "/var/aw/var/LatexWiki/PASCAL.NRLIB/PASCAL.lsp" (written 31 OCT 2024 06:48:13 PM):
; wrote /var/aw/var/LatexWiki/PASCAL.NRLIB/PASCAL.fasl ; compilation finished in 0:00:00.012 ------------------------------------------------------------------------ Pascal is already explicitly exposed in frame initial Pascal will be automatically loaded when needed from /var/aw/var/LatexWiki/PASCAL.NRLIB/PASCAL

fricas
)boot $PostTranOnly := true
Your user access level is compiler and this command is therefore not available. See the )set userlevel command for more information.

spad
)abbrev package PASCAL Pascal
Pascal : with ( make_pascal : Integer -> Matrix(Integer) )
  == add
    make_pascal(N : Integer) : Matrix(Integer) ==
        -- coerce here to NonNegativeInteger because this is what
        -- 'zero' requires
        nn := N::NonNegativeInteger
        tab := zero(nn, nn)$Matrix(Integer)
        n : Integer
        tab(1, 1) := 1
        for n in 2..nn repeat
            -- Fill row numer n
            k : Integer
            tab(n, 1) := 1
            tab(n, n) := 1
            for k in 2..(n - 1) repeat
                tab(n, k) := tab(n-1, k) + tab(n-1, k-1)
        tab
spad
   Compiling FriCAS source code from file 
      /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/1379180095272779836-25px008.spad
      using old system compiler.
   PASCAL abbreviates package Pascal 
------------------------------------------------------------------------
   initializing NRLIB PASCAL for Pascal 
   compiling into NRLIB PASCAL 
   compiling exported make_pascal : Integer -> Matrix Integer
Time: 0 SEC.
(time taken in buildFunctor: 0)
;;; *** |Pascal| REDEFINED
;;; *** |Pascal| REDEFINED Time: 0 SEC.
Cumulative Statistics for Constructor Pascal Time: 0 seconds
finalizing NRLIB PASCAL Processing Pascal for Browser database: --->/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/1379180095272779836-25px006.spad-->Pascal(constructor): Not documented!!!! --->/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/1379180095272779836-25px006.spad-->Pascal((make_pascal ((Matrix (Integer)) (Integer)))): Not documented!!!! --->/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/1379180095272779836-25px006.spad-->Pascal(): Missing Description ; compiling file "/var/aw/var/LatexWiki/PASCAL.NRLIB/PASCAL.lsp" (written 31 OCT 2024 06:48:13 PM):
; wrote /var/aw/var/LatexWiki/PASCAL.NRLIB/PASCAL.fasl ; compilation finished in 0:00:00.008 ------------------------------------------------------------------------ Pascal is already explicitly exposed in frame initial Pascal will be automatically loaded when needed from /var/aw/var/LatexWiki/PASCAL.NRLIB/PASCAL

fricas
)boot $PrintOnly := true
Your user access level is compiler and this command is therefore not available. See the )set userlevel command for more information.

spad
)abbrev package PASCAL Pascal
Pascal : with ( make_pascal : Integer -> Matrix(Integer) )
  == add
    make_pascal(N : Integer) : Matrix(Integer) ==
        -- coerce here to NonNegativeInteger because this is what
        -- 'zero' requires
        nn := N::NonNegativeInteger
        tab := zero(nn, nn)$Matrix(Integer)
        n : Integer
        tab(1, 1) := 1
        for n in 2..nn repeat
            -- Fill row numer n
            k : Integer
            tab(n, 1) := 1
            tab(n, n) := 1
            for k in 2..(n - 1) repeat
                tab(n, k) := tab(n-1, k) + tab(n-1, k-1)
        tab
spad
   Compiling FriCAS source code from file 
      /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/1379180095272779836-25px010.spad
      using old system compiler.
   PASCAL abbreviates package Pascal 
------------------------------------------------------------------------
   initializing NRLIB PASCAL for Pascal 
   compiling into NRLIB PASCAL 
   compiling exported make_pascal : Integer -> Matrix Integer
Time: 0 SEC.
(time taken in buildFunctor: 0)
;;; *** |Pascal| REDEFINED
;;; *** |Pascal| REDEFINED Time: 0 SEC.
Cumulative Statistics for Constructor Pascal Time: 0 seconds
finalizing NRLIB PASCAL Processing Pascal for Browser database: --->/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/1379180095272779836-25px008.spad-->Pascal(constructor): Not documented!!!! --->/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/1379180095272779836-25px008.spad-->Pascal((make_pascal ((Matrix (Integer)) (Integer)))): Not documented!!!! --->/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/1379180095272779836-25px008.spad-->Pascal(): Missing Description ; compiling file "/var/aw/var/LatexWiki/PASCAL.NRLIB/PASCAL.lsp" (written 31 OCT 2024 06:48:13 PM):
; wrote /var/aw/var/LatexWiki/PASCAL.NRLIB/PASCAL.fasl ; compilation finished in 0:00:00.008 ------------------------------------------------------------------------ Pascal is already explicitly exposed in frame initial Pascal will be automatically loaded when needed from /var/aw/var/LatexWiki/PASCAL.NRLIB/PASCAL

From: Waldek Hebisch
Date: 16 March 2014 01:13
Subject: Re: [fricas-devel] Parsing FriCAS/Axiom code
To: fricas-devel@googlegroups.com

Francesco Bonazzi wrote: > > I think that creating a SPAD-to-Julia compiler is a hard task, but > nonetheless I believe that adding CAS support to Julia would benefit both > Julia and the CAS itself. I believe that Julia offers a much easier > learning curve for beginners than SPAD, and the CAS developing community > could become much larger, with considerable improvement to the code. > > I was wondering whether it is possible to use aldor or the spad compiler to > generate the "parsed aldor" format of FriCAS (the -Fap parameter in > aldor), so that the source code parsing would be much easier.

There are four possible forms of parsed output. Typing on FriCAS command line:

)boot $RawParseOnly := true

cause FriCAS instead of compiling to print raw parse tree (that is directly output from the parser).

)boot $FlatParseOnly := true

prints somewhat flattened version of parse tree (bigger parse trees should be more readable, but otherwise this form is not used)

)boot $PostTranOnly := true

prints parse tree after first auxiliary transformation

)boot $PrintOnly := true

prints parse tree after second auxiliary transformation. This form is used by Spad compiler.

> Otherwise, do you have any other suggestions or do you believe that such > work is infeasible by automatic translation?

It is interesting project. Difficulty depends largely on how well Spad concepts map to Julia. IIUC core ideas of Julia are quite similar to Spad, so it looks possible.

-- Waldek Hebisch