Re: [Factor-talk] Peg Parser Definition

2020-11-22 Thread Alexander Ilin
Thanks for the [=[ suggestion, it works just as well! 22.11.2020, 19:17, "John Benediktsson" :Yes, here's how (currently depending on the implementation behavior, but this has worked for a long time). For example, in the urls.private vocabulary there's a parser for URLs, and you can get the peg par

Re: [Factor-talk] Peg Parser Performance

2020-11-22 Thread Alexander Ilin
If I remove all => actions, the time goes down to 120 seconds.  23.11.2020, 00:18, "John Benediktsson" :I suspect it’s a lot of “swap prefix >string” type stuff that’s different, but I can help you profile this a little later today or tomorrow.   On Nov 22, 2020, at 1:07 PM, Alexander Ilin

Re: [Factor-talk] Peg Parser Performance

2020-11-22 Thread John Benediktsson
I suspect it’s a lot of “swap prefix >string” type stuff that’s different, but I can help you profile this a little later today or tomorrow. > On Nov 22, 2020, at 1:07 PM, Alexander Ilin wrote: > >  > Hello! > > I put the code into a vocab, restarted the Listener and repeated the test >

Re: [Factor-talk] Peg Parser Performance

2020-11-22 Thread Alexander Ilin
Hello!  I put the code into a vocab, restarted the Listener and repeated the test like so: IN: log-db EBNF: parse-csv-line [=[   quotedColumn = "\""~ (!("\"") .)* "\""~ quotedColumn*       => [[ first2 swap prefix [ >string ] map "\"" join ]]   unquotedColumn = (!("\t") .)*   column = ( quotedColum

Re: [Factor-talk] Factor and MacOS arm64

2020-11-22 Thread John Benediktsson
Right now the compiler doesn’t make a correct boot quotation to jump into after the binary loads the factor image. My M1 technically comes in a couple days, so I hope to help with the effort soon! Doug worked on the arm64 assembler and now we have to implement the compiler hooks properly with

Re: [Factor-talk] Factor and MacOS arm64

2020-11-22 Thread Steve Davies
On Sun, 22 Nov 2020 at 20:30, John Benediktsson wrote: > It is being worked on in the arm64 branch on GitHub. > > Ah - gotcha. I do know ARM assembly, but I know so little about Factor I doubt I can contribute much. I checked out the arm64 branch and I see it compiles! If I run the one in vm-a

Re: [Factor-talk] Peg Parser Performance

2020-11-22 Thread John Benediktsson
When you run that in the listener it uses the non optimizing compiler. You should use the EBNF: word [=[ ... ]=] form and then refer to word for it to be a compiled parser. It’ll be much faster. Or wrap all that in a : foo ( — ) ... ; > On Nov 22, 2020, at 11:49 AM, Alexander Ilin wrote:

[Factor-talk] Peg Parser Performance

2020-11-22 Thread Alexander Ilin
Hello! I've got my first test results, and I'm having some doubts. The following code runs almost 200 seconds on a 20Mb file: "file-name.csv" [ utf8 [ input-stream get [ EBNF[=[ quotedColumn = "\""~ (!("\"") .)* "\""~ quotedColumn* => [[ first2 swap prefix [

Re: [Factor-talk] Factor and MacOS arm64

2020-11-22 Thread John Benediktsson
It is being worked on in the arm64 branch on GitHub. It requires some additional compiler support within Factor, but since Doug and I both now have shiny new M1 computers, we both have good incentive to get it working. If you have knowledge of ARM assembly and want to help, that would be grea

[Factor-talk] Factor and MacOS arm64

2020-11-22 Thread Steve Davies
Hi, What would it take to build Factor for the MacOS M1 (arm64) systems? I do see in the code that there is some stuff for Linux ARM, which I think is actually complete (I'll try to build it on a Raspberry Pi tomorrow). There is also some stuff in build.sh for Apple iPhone/IPad hardware with arm6

Re: [Factor-talk] Peg Parser Definition

2020-11-22 Thread John Benediktsson
Yes, here's how (currently depending on the implementation behavior, but this has worked for a long time). For example, in the urls.private vocabulary there's a parser for URLs, and you can get the peg parser from an EBNF: word. \ parse-url "ebnf-parser" word-prop main of Most of our EBNF: w

Re: [Factor-talk] Peg Parsing Files

2020-11-22 Thread John Benediktsson
Right now this is true: binary stream-seekable? But none of the decoders allow stream-seeking. Maybe we should support that for ascii and other 8-bit encodings... On Sun, Nov 22, 2020 at 3:17 PM Jon Harper wrote: > I didn't know about the seekable streams implementation in factor: > https://

Re: [Factor-talk] Peg Parsing Files

2020-11-22 Thread Jon Harper
I didn't know about the seekable streams implementation in factor: https://docs.factorcode.org/content/article-stream-protocol.html We have: "/tmp/toto" ascii stream-seekable? f "/tmp/toto" (file-reader) t ! it works, stream-seek can rewind or fast forward and stream-read1 will get the bytes