axiom-developer
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Axiom-developer] No progress on notangle


From: Waldek Hebisch
Subject: Re: [Axiom-developer] No progress on notangle
Date: Sun, 18 Feb 2007 23:13:52 +0100 (CET)

Ralf Hemmecke wrote:
> Unforunately, I am a lisp illiterate. :-( So I don't even know how to 
> start your program on test files. So I would like to give a little 
> (meaningless) testfile.

If you have sbcl you can do (assuming that you have saved the program
int the file "nono2.lisp"):

(load "nono2.lisp")
(untangle "input.file" "output.file")

For timing:
(time (untangle "input.file" "output.file"))

Other Lisps require extra commands to compile the code but at least
up to version 1.0 sbcl automatically compiles the code.

> 
> The output of notangle on the program below is
> 
> ----------------------
> foo(x: Integer): Integer == z := 1
>                              for i in 1.. x repeat
>                                  h := 1
>                                  for j in 1..i repeat
>                                      h := h + j
>                                      h := 2*h
>                                  h := if h > 100
>                                         then
>                                           h-2
>                                         else
>                                           h+2
>                                  h := 3*h
>                                  z := h
>                              z
> ----------------------
> 
> Does your program give the same result?
>

No.  First I have noticed that notangle behaves in rather inconsitent
way.  I do not want to waste time trying to find out exact rules used
by notangle.  With pile semantics it seems better to integrate
notangle like processing with Spad scanning and treat each hunk as
a pile (IMHO having piles spanning hunk boundary is just confusing
and error prone).

To supporting such feature would require storing information about
all line endings.  This is not very hard, but I do not want to
invest much more time in this program unless other find it useful.
Also note that the reason to use Lisp is so that the program can
run inside Axiom process.  For external program I would use C
which probably would be faster to write and would give faster
program.  Note that this is not intended to be a general remark
about languages: I simply know C better (most of the time for
writing program was actually spent in CL manuals), I know C tools
for scanning, I have a collection of C utility routines which
make the task easier.

> Furthermore what about the option "-L" that can be given to notangle?
> That is particularly useful if your compiler emits a column number for 
> error messages. #pile mode is bad in that case anyway, but there are 
> also files that are indentation-independent.
>

That could be easily addedd: the program traces line numbers anyway
(for debugging purposes) so it would be easy to store them together
with chunks and emit when needed.

> ---BEGIN aaa.spad.pamphlet
> <<*>>=
> foo(x: Integer): Integer == <<foo body>>
> @
> 
> <<foo body>>=
> z := 1
> for i in 1.. x repeat
>      <<auxiliary computation>>
>      h := <<post computation>>
>      <<binding z>>
> z
> @
> 
> <<auxiliary computation>>=
> h := 1
> for j in 1..i repeat
>      h := h + j
>      h := 2*h
> @
> 
> <<post computation>>=
> if h > 100
>    then
>      h-2
>    else
>      h+2
> @
> 
> <<binding z>>=
> h := 3*h
> z := h
> @
> ---END aaa.spad.pamphlet
> 

BTW:  is the the test program supposed to be in good literate style?
both <<auxiliary computation>> and <<binding z>> change h without
any hint about such possibility in <<foo body>>.  I find such
practice _very_ bad for readability.



-- 
                              Waldek Hebisch
address@hidden 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]