timo binary grammars would actually be super easy, just decode your input as latin1 and you're good to go 00:00
sorry i forgot about \r\n being a single grapheme too. you would have to be a little careful after all 00:34
johnjay i'm not familiar with grammars beyond just ebnf. is this a unicode problem or a general problem 00:39
wayland johnjay: Raku has built-in grammars -- it's one of the features that sets it apart from most other languages ( if interested, see docs.raku.org/language/grammar_tutorial ). Raku grammars work just fine for many use-cases. It's just that there are some encoding issues with unicode sometimes when dealing with the outside world (which is what timo is saying), and they're not yet well-suited to processing binary. I'm not sure I fully understand 00:44
exactly what you're asking -- does any of that help?
johnjay i was just curious what the discussion was about. i was thinking about programming language grammars earlier today esp the syntax around escape codes. 00:49
Voldenet Yeah, `\r\n` in binary grammars is also pain, but you essentially process strings, which are just not expected to be random bytes
johnjay basically i was thinking - have language like python and java basically "standardized" a lot of grammar people accept? Raku stands out in a direct way due to its unique syntax sometimes
apparently python defines literal strings as byte or t or f or like a few different literal types of strings 00:50
meaning, a literal string could be b'\x30\x31\x32' as opposed to '012' 00:51
Voldenet What we meant was the `grammar` feature that allows you making class (sort of) that is created for matching strings slangify.org/
johnjay ok. in general when i hear grammar i think, this is the BNF of a language. 00:52
i only read a little bit of raku so far and hadn't gotten there yet.
Voldenet yeah, not formal grammar (*bnf) you use to make a parser, the grammar is a parser
johnjay apparently i still have to learn something called scott-strachey denotational semantics. which is still a different thing altogether. but it's cool raku has extra stuff for this. most languages don't emphasize parsing that much i think 00:53
Voldenet anyway, when using bytes as strings, you may encounter things like 255 or 0 being weird and there's special handling for spaces or word breaks that make no sense in binary stream 00:57
wayland johnjay: That's a question tangled in the history of languages. Raku and Java and Javascript are all (I think) descended from C, so they all have a little bit of that. But Raku is descended via Awk and Perl, which are not in the ancestry of the languages you mentioned. Another thing is that, since Raku has so many features, it sometimes has syntactic oddities forced on it in the name of preventing conflicts. For example, I'm pretty sure the Raku ternary 00:58
operator ( ?? !! ) is one of these things. As for Python, I just had a quick look, and it's apparently descended from a language called ABC, which is inflience by Algol.
Voldenet I thought python descended from whitespace esolang 00:59
johnjay maybe i have it backwards then. maybe all the languages we use are descended from Algol-like syntaxes and that's why they seem similar 01:00
wet sidewalks cause rain!
wayland johnjay: Traditional parsers first run everything through a lexer, which turns the input into a stream of tokens. Then it runs it through a parser, which is like the BNF side of things. Raku has combined these two into grammars. I've never heard of scott-strachey denotational semantics, and I did a compilers unit in my degree. Having said that, that was quite a number of years ago, and I think semantics was the part I understood the least when going 01:01
through.
johnjay: Haha :) . Depends on how far you go back (FORTRAN?), but yes for the standard paradigm languages. On the other hand, there are a lot of functional languages (I think LISP is the ancestor here), and I traced Table-Oriented Programming back to the 50s one time. 01:05
(It didn't have that name until much later, which is one reason it's been fragmented and unpopular). 01:06
01:34 rmv left 01:40 dgl joined 01:42 MasterDuke joined 01:43 dg left, dgl is now known as dg
disbot4 <simon_sibl> wayland: well especially now I play a lot with text but within eMacs buffer xD and it seems then better option to write elisp functions to do what I need even tho it’s much less convenient 01:51
<simon_sibl> I’ll check that, thanks ! I didn’t know about mattermost, one more account to create and add to my list xD 01:53
<simon_sibl> timo: I wish I have IPv6 but even at my company we don’t have, Hong Kong has amazing speed but for some reason they gate keep IPv6 behind more money 01:54
01:57 kylese left 01:58 kylese joined 02:15 kylese left, kylese joined
johnjay wayland: interesting, thanks 02:18
02:41 MasterDuke left 03:08 silug left 03:11 silug joined, lichtkind_ joined 03:14 lichtkind left 03:42 wayland76 joined, wayland left
wayland76 johnjay: If you know regexes, and a very little OOP, then you probably know enough to learn Raku grammars. 04:31
Note that Grammars by themselves are mainly for turning strings into structured data (ie. parsing a file into its useful components). 04:34
04:48 rmv joined, rmv left, rmv joined 04:52 rmv left 05:01 _________ left 05:05 _________ joined 05:17 abraxxa joined 05:31 abraxxa left 05:32 abraxxa joined
wayland76 Yay, I'm now in the top 75 module authors :) 06:04
06:57 Sgeo left 07:45 dakkar joined 07:46 lichtkind_ left 08:03 rmv joined 08:08 rmv left
ab5tract FWIW I think Raku's ternary is the best-looking of the bunch. I'm sure that it was done it order to free up both `?` and `:` while simultaneously switching to what I consider to be the ternary that all others should look to for guidance. Re-using the visual language of question-asking and logical-not while giving the grammar a fair bit more room to breath 09:55
.. was a very clever decision of the language designers of old
so much so that postfix ? is free for user's to use on their own 10:00
m: sub postfix:<?> ($o) { ? $o }; my $x = 0; dd :$x, :y($x++?)
camelia :x(1)
:!y
ab5tract m: sub postfix:<?> ($o) { ? $o }; my $x = 0; dd :$x, :y(++$x?)
camelia ===SORRY!=== Error while compiling <tmp>
Operators '++' and '?' are non-associative and require parentheses
at <tmp>:1
------> o) { ? $o }; my $x = 0; dd :$x, :y(++$x?<HERE>)
expecting any of:
postfix
ab5tract m: sub postfix:<?> ($o) { ? $o }; my $x = 0; dd :$x, :y((++$x)?)
camelia :x(1)
:y
ab5tract m: sub postfix:<?> ($o) { ? $o }; my $x = 0; dd :x($x?), :y((++$x)?)
camelia :!x
:y
lizmat or to allow them as part of identifiers: raku.land/zef:raku-community-modul...::Piersing 10:01
ab5tract also true 10:02
10:17 Aedil left 10:35 donaldh joined 11:29 rmv joined, rmv left, rmv joined 11:33 rmv left