ChanServ changed the topic of #picolisp to: PicoLisp language | Channel Log: https://irclog.whitequark.org/picolisp/ | Check also http://www.picolisp.com for more information
geo80 has quit [Remote host closed the connection]
orivej has quit [Ping timeout: 240 seconds]
geo80 has joined #picolisp
<geo80> morning!
<geo80> Hi Regenaxer, I saw the changes as well as weekend progress with tankf33der during the weekends for pil21, cool!
<geo80> btw I was wondering if it is fine to add -no-pie at gcc compilation in the official pil21 repo? this is the fix for the seg-fault on my side.
karswell has quit [Remote host closed the connection]
karswell has joined #picolisp
<geo80> Hi Regenaxer,I'm also trying to implement opt but im still confused how to use mockPil
orivej has joined #picolisp
<Regenaxer> Good morning geo80!
<Regenaxer> Yes, -no-pie might be necessary, not sure in which cases (which systems) it is needed explicitly
<Regenaxer> 'opt' has nothing to do with MockPil
<Regenaxer> MockPil is llvm frontend
<Regenaxer> 'opt' is a separate tool operating on the backend
<Regenaxer> The llvm generated by the frontend must be optimized too (adding attributes etc.), but I want to do that later when everything else is stable
<geo80> Hi Regenaxer! noted about -no-pie. I would say first case would be mine, which is building under WSL
<geo80> noted about frontend and backend, thanks! but actually what I wan to mean is
<geo80> I am currently reading the code of loadAll
<geo80> because based in pil64, loadAll and opt are almost similar
<geo80> so i plan to use and modify the code of pil21 loadAll
<geo80> from what I understand, the code of pil21 are in MockPil which will be parsed using llvm.l which then generates the base.ll
<Regenaxer> Yes, the structure of the code in pil64 and piu21 is the same
<Regenaxer> mostly
<Regenaxer> and yes, the procedure is as you describe
<Regenaxer> In the long range, a backend -> Verilog would be cool. I wonder if something like that exists in llvm already
<geo80> ok thanks for confirming
<geo80> ah hmm as far as i know i think not yet coz from what i understand, Verilog is used to model your own customized processor. unlike the current backends supported by llvm are already real general purpose processors
<geo80> but maybe there will be in the future? let me investigate that as well
<geo80> about this code:
<geo80> (de loadAll (Exe)
<geo80> (let (X $Nil P (val $AV))
<geo80> (loop
<geo80> (let Q (val P)
<geo80> (? (=0 Q))
<geo80> (?
<geo80> (and
<geo80> (== (val Q) (char "-"))
<geo80> (=0 (val (i Q))) ) )
<geo80> (setq
<geo80> P (set $AV (i P))
<geo80> X (repl Exe 0 (mkStr Q)) ) ) )
<geo80> X ) )
<geo80> for opt, i want to remove the opt as well as the repl
<geo80> sorry i mean for opt, i want to remove the loop and repl
<geo80> and just X (mkStr Q)
<geo80> is my understanding correct?
<Regenaxer> You could also write a separate test function
<geo80> i see hmm what confuses me is the (?
<geo80> based on the standard pil, this is related to pilog? but for mockPil i assume its different use?
<Regenaxer> yes, I used '?' for a special operator to exit loops
<Regenaxer> Pilog is not needed in MockLisp
<Regenaxer> (probably, and if it were, '?' is for interactive use only)
<geo80> oh! so that's why, so ? is for exiting loop
<geo80> ok let me try redo my code
<geo80> thanks!
<Regenaxer> loop, cond and nond are different in that they accept 'T' as first arg to indicate that they return a value
<Regenaxer> yes, '?' exits
<Regenaxer> different from PicoLisp
<Regenaxer> in PicoLisp, 'loop' accepts (T ...), but only on top level
<geo80> so it exits if the statement becomes false, correct?
<Regenaxer> '?' in MockPil can be inside nested structures
<Regenaxer> it exits if true
<geo80> ah ok2 got it, thanks!
<Regenaxer> Similar to (T (condition) ... in Pil
<geo80> let me redo it and check
<geo80> ok noted
<Regenaxer> '?' works also in 'while' and 'until'
<geo80> ok noted, btw quick question. in the code above, does P and Q have the same value?
<Regenaxer> No, Q in the indirection of P
<Regenaxer> (let Q (val P)
<Regenaxer> both are pointers, as all data in pil
<geo80> ah ok thanks
<geo80> Hi Regenaxer, is this mockPil code:
<geo80> (de _opt (X)
<geo80> (let (X $Nil P (val $AV) Q (val P))
<geo80> (when (and
<geo80> (n0 Q)
<geo80> (<> (val Q) (char "-"))
<geo80> (n0 (val (i Q))) )
<geo80> (setq
<geo80> P (set $AV (i P))
<geo80> X (mkStr Q) ))
<geo80> X ) )
<geo80> equivalent to this PilASM code:
<geo80> (code 'doOpt 2)
<geo80> ld E ((AV)) # Command line vector
<geo80> null E # Next string pointer?
<geo80> jz retNil # No
<geo80> ld B (E) # Single-dash argument?
<geo80> cmp B (char "-")
<geo80> if eq
<geo80> nul (E 1)
<geo80> jz retNil # Yes
<geo80> end
<geo80> add (AV) I # Increment vector pointer
<geo80> jmp mkStrE_E # Return transient symbol
<Regenaxer> _opt is a copy of loadAll?
<Regenaxer> Then it must be about the same ;)
<geo80> ah almost copy but without loop and without repl
<geo80> from what i understand :)
<Regenaxer> ok
<geo80> im not sure how to verify if opt works but what i did is
<geo80> ../bin/picolisp -"de f () (println 'opt (opt))" -f abc -bye
<geo80> this gives me
<geo80> %s open: %s 0
<Regenaxer> Yes, sorry, errors are not implemented yet
<geo80> ah its fine, hmm so you mean (opt) is not working properly?
<Regenaxer> Hmm, I do not understand. Work properly in which way?
<Regenaxer> Also, -expression is not implemented yet
<Regenaxer> What exactly do you want to do?
<geo80> oh! ah sorry so this wont indeed work coz -expression is not yet implemented
<geo80> my aim was to test my implementation of opt if it is working properly
<Regenaxer> A kind of simplified loading?
<Regenaxer> btw, if you write a new function like '_opt', you need also an entry in src/glob.l so that it can be called in the repl as (opt)
<geo80> yes already did
<Regenaxer> ah, good!
<geo80> i also put it above
<geo80> ($LastSym "udp" _udp)
<Regenaxer> So start bin/picolisp, then : (opt)
<geo80> ../bin/picolisp
<geo80> : (opt)
<geo80> -> NIL
<geo80> :
<Regenaxer> yeah, your opt accesses $AV which is empty
<Regenaxer> What exactly do you want to do?
<Regenaxer> Can't you write a more simple direct test case?
<Regenaxer> or try $ bin/picolisp - abc
<Regenaxer> This might work already
<Regenaxer> But as I said, I don't understand what you intend to do
<Regenaxer> 'loadAll' is perhaps a difficult starting point for simple tests :)
<geo80> ah yes its empty
<geo80> but i did try your suggestion
<geo80> ../bin/picolisp - abc
<geo80> : (opt)
<geo80> -> NIL
<geo80> :
<Regenaxer> What exactly do you want to do?
<geo80> ah just want to verify (opt) is working or not :)
<Regenaxer> I mean, why opt? What should it do?
<geo80> ah coz opt was still missing for pil21 and i thought its something i want to try
<Regenaxer> Ah, *that* opt
<Regenaxer> it is very different from loadAll
<Regenaxer> When I said "opt" I meant the llvm tool
<Regenaxer> opt -h
<geo80> oh! i see hmm the reason why i thought it was similar because of the these pilASM codes:
<geo80> # (opt) -> sym
<geo80> (code 'doOpt 2)
<geo80> ld E ((AV)) # Command line vector
<geo80> null E # Next string pointer?
<geo80> jz retNil # No
<geo80> ld B (E) # Single-dash argument?
<geo80> cmp B (char "-")
<geo80> if eq
<geo80> nul (E 1)
<geo80> jz retNil # Yes
<geo80> end
<geo80> add (AV) I # Increment vector pointer
<geo80> jmp mkStrE_E # Return transient symbol
<geo80> # Load all remaining arguments
<geo80> (code 'loadAllX_E)
<geo80> do
<geo80> ld E ((AV)) # Command line vector
<geo80> null E # Next string pointer?
<Regenaxer> hehe, yes, same start. ok
<geo80> # Load all remaining arguments
<geo80> (code 'loadAllX_E)
<geo80> do
<geo80> ld E ((AV)) # Command line vector
<geo80> null E # Next string pointer?
<geo80> jz retNil # No
<geo80> ld B (E) # Single-dash argument?
<geo80> cmp B (char "-")
<geo80> if eq
<geo80> nul (E 1)
<geo80> jz retNil # Yes
<geo80> end
<geo80> add (AV) I # Increment vector pointer
<geo80> call mkStrE_E # Make transient symbol
<geo80> ld B 0 # Prompt
<geo80> call loadBEX_E
<geo80> loop
geo80 has quit [Remote host closed the connection]
geo80 has joined #picolisp
geo80 has left #picolisp [#picolisp]
mtsd has joined #picolisp
mtsd has quit [Remote host closed the connection]
mtsd has joined #picolisp
<Regenaxer> Good morning tankf33der!
beneroth has quit [Quit: Leaving]
orivej has quit [Ping timeout: 265 seconds]
andyjpb has joined #picolisp
<tankf33der> i want try implement this roo
<tankf33der> i want try implement this too
<Regenaxer> With 'till'?
<Regenaxer> (while (till " ") (inc 'Cnt)) ?
<Regenaxer> oops, I mean 'from' ;)
<Regenaxer> (while (from " " "\t" "\n" "\r") ...
<tankf33der> sure.
<tankf33der> they count bytes words and lines separetly
<tankf33der> like wc
<tankf33der> i've create big txt file from tolstoy war and peace :)
beneroth has joined #picolisp
beneroth has quit [Client Quit]
<Regenaxer> I suspect it is a lot faster if you traverse the file twice (till " " "\t") and (till "\r" "\n" ) and take the bytes from (car (info "file"))
<Regenaxer> Reading the whole file into data structures takes awfully long compared to these three operations
<Regenaxer> Cause the OS caches the file, and second traversal is faster
<Regenaxer> And, even *more* fast is if you use the 'lines' function which counts lines most efficiently :)
orivej has joined #picolisp
<tankf33der> but anyway i will read file twice. right ?
<Regenaxer> yes
<Regenaxer> but 'lines' has no further function call overhead like 'inc' and 'till'
beneroth has joined #picolisp
mtsd has quit [Ping timeout: 240 seconds]
mtsd has joined #picolisp
<tankf33der> debuging word count
<tankf33der> :)
<tankf33der> word count the slowest part.
<Regenaxer> yes, naturally
orivej has quit [Ping timeout: 245 seconds]
mtsd has quit [Quit: Leaving]
<tankf33der> all my variations 8x slower than wc
<tankf33der> 100MB file input.
<tankf33der> even this one tested
<Regenaxer> Did you try my proposals?
<tankf33der> sure.
<Regenaxer> Unix wc is fastest of course. Direct C
<Regenaxer> But just line count with 'lines' should be the same as wc
<tankf33der> it is.
<Regenaxer> great
freemint has joined #picolisp
freemint has quit [Remote host closed the connection]
orivej has joined #picolisp
<beneroth> [OT] why good people often don't get a job offer: https://twitter.com/TheWrongNoel/status/1194842728862892033
stultulo has joined #picolisp
f8l has quit [Ping timeout: 246 seconds]
stultulo is now known as f8l