wink_ has quit [Remote host closed the connection]
hoppetosse has joined #zig
<daurnimator>
time consuming idea: writing a PEG system in zig
<daurnimator>
inspired by ljmccarthy's paste a couple of days ago (https://www.godbolt.org/z/tVrsh-) I think we could have an lpeg-like system where much of it works at comptime!
<daurnimator>
hryx: I know you like PEGs...
<hryx>
daurnimator: you know it. I like Lua, I like lpeg, I like zig... I like zpeg?
<daurnimator>
hryx: sure...
<daurnimator>
hryx: though I would use it to implement some things that should probably be in the standard library. so I don't think it really gets to have a name :P
<hryx>
that would be a cool project
<daurnimator>
If I undertook it. It would probably be mostly done by porting lpeg
<daurnimator>
I wonder how much translate-c can do....
<hryx>
There's only one way to find out
hoppetosse has quit [Ping timeout: 245 seconds]
ltriant has joined #zig
ltriant has quit [Ping timeout: 244 seconds]
Ichorio has joined #zig
Ichorio has quit [Read error: Connection reset by peer]
<hryx>
if anyone is familiar with stdlib allocators and feels like checking out a tiny PR, would love to know if this was correct or not: https://github.com/ziglang/zig/pull/2310
<hryx>
it's not blocking the recursive parser rewrite, but would helpe debug it
<hryx>
*help
<daurnimator>
hryx: huh.... if we had a PEG in the std library.... could/should we use it to parse zig itself?
shritesh has quit [Quit: Segmentation Fault]
<hryx>
daurnimator: I don't know enough about software parsers to have a valid opinion. but I feel like a bespoke parser fits Zig because the language is SO simple — wouldn't it be more performant than a geenric parser library?
<hryx>
*generic. not sure of that makes sense
<daurnimator>
hryx: maybe. but I wouldn't expect it to be more than a factor of 2-3x.
ltriant has joined #zig
<hryx>
daurnimator: in the spirit of zig supporting other language communities (especially C) I think a PEG in zig would be a great project. so if you created that, I def support it!!
<hryx>
and would love to be part of it if I can help at all
<hryx>
regardess of performance factors, heh :P
ltriant has quit [Ping timeout: 246 seconds]
_whitelogger has joined #zig
very-mediocre has joined #zig
ltriant has joined #zig
ltriant has quit [Ping timeout: 268 seconds]
<andrewrk>
emekankurumeh[m], you're correct it's planned to have zig fmt fix whitespace
<andrewrk>
I think nobody including me has gotten around to doing that
<hryx>
dang I was way off then. would it be zig fmt, or some other part of the toolchain? hm
<andrewrk>
hryx, honestly probably the tokenizer would just relax its restrictions
<hryx>
that seems like the right approach
<hryx>
Token.Id.FixThis or something
<hryx>
bleh
<hryx>
hope your talk preps are going well andrewrk. I submitted a PR related to the recursive rewrite, but it might be misguided
<andrewrk>
hryx, I have a couple minutes, maybe I can help
<hryx>
awesome, that would be great andrew
<hryx>
#2310
<andrewrk>
hryx, ah right, I looked at this on my phone earlier. did this help you diagnose the issue with the parser?
<hryx>
yessir, it came about when I was debugging that
<andrewrk>
what was the issue?
<hryx>
my original cause to investigate was: I was suspicious at 1 deallocation but 0 bytes freed
<hryx>
I added debug printing everytime `shrinkFn` is called
<hryx>
Also added some stack trace from the FailingAllocator
<hryx>
I think my methods are currently crude though. I need to figure out a more sophisticated troubleshooting approache
<andrewrk>
but did you figure out why the tests were failing?
<hryx>
Not yet :<
<andrewrk>
maybe I can take a quick peek at that
<hryx>
So maybe I should take another day or two to look into it
<hryx>
ah, ok
<andrewrk>
"deallocations" is kind of a weird concept with the new allocator API. I'm not sure what that field is used for other than diagnostics
<andrewrk>
I think to keep the previous concept of a "deallocation", it would increment when the new_size == 0
<hryx>
that was my though too. maybe it doesn't map well to realloc/shrink
<hryx>
ooh interesting
<andrewrk>
and there would be a new field "allocations" which increments when the old_size.len == 0
<hryx>
so does the old "deallocations" correspond with "free"? i.e. len == 0?
<andrewrk>
which no longer is identical to index. `index` is precisely: the number of realloc() that will succeed before it will fail
<hryx>
ranther than "size == less than old size"
<andrewrk>
or rather index just counts reallocs(), and fail index is the number of realloc() that will succeed before it will fail
<hryx>
ahhhhh
<hryx>
ok yeah, since this FailingAllocator seems rather specific to parser_test.zig, it's worth a reconsideration
<andrewrk>
the point of "index" is test coverage. the point of "allocations"/"deallocations" is to print helpful text
<hryx>
Ok, I have a game dev meetup tomorrow all day at my warehouse. I'll use the time to think more deeply about that interface
<hryx>
cc tyler569 BTW, tomorrow in san francisco
<andrewrk>
is your wip branch available somewhere?
<hryx>
ah yes andrewrk one sec
<andrewrk>
oh neat do we have irc members meeting in person?
<hryx>
yeah, tyler and I met up in person in SF this week! there are some smart folx in the zig world
<hryx>
tyler569 is working on Zig inside an OS like you
<hryx>
andrewrk: would it help if I made a WIP pull request of that branch? I didn't want to create noise on the repo until it was close to review-ready
<hryx>
sorry, my usual paste dumpster (hatstebin) acting funny right now. If you add that to the top of paser_test.zig you can see
<hryx>
Funny thing is, if you change the spacing to non-canonical (so that zig fmt will change it), you will get a normal fmt test failure, not the same issue
<hryx>
no andrewrk! I asked that because I wasn't sure if it is semantically meaningful
<andrewrk>
hryx, Test 1/1 zig fmt: slim boi...error: NotImplemented
<andrewrk>
is what what you're expecting?
<hryx>
(sorry, since hastebin isn't loading -- I think you were linking to the "to `return try` or not to 1return try`" question)
<hryx>
andrewrk: no, I get a different error. I'll paste in 1 sec
<andrewrk>
do you have unpushed commits to the branch?
<andrewrk>
or local changes
<andrewrk>
or is stage2-recursive-parser the wrong branch
<hryx>
Facepalm, I do have uncomitted changes. Gimme like 3 minutes and I'll sort that out! *.__.*
<andrewrk>
no worries
<andrewrk>
I'll need to get to bed soon though
<hryx>
no worrie homie
<hryx>
It looks like with my latest changes, I'm also getting error.NotImplemented andrewrk. I'll have to look into it tomorrow!
<andrewrk>
ok sounds good. this weekend/next week are going to be crazy for me but after that I'd be happy to help if you get stuck
<hryx>
I'll report back once I have a reprocable situation :P
<hryx>
Of course, don't even think about it for now
<hryx>
excited to see the recorded talk
<andrewrk>
I did a practice run with a few people, and got some good feedback
<andrewrk>
I was hoping to be done but it seems I have a lot to improve... so be it
<hryx>
User feedback. good for public speaking, good for game dev too.
<hryx>
don't be afraid to revise
<andrewrk>
good night
<hryx>
And you're lucky if you have friends who are capable of giving you quality feedback on your work
<hryx>
night!
slugm has joined #zig
slugm_ has joined #zig
hio has quit [Quit: Connection closed for inactivity]
slugm_ has quit [Remote host closed the connection]
<hryx>
sorry emekankurumeh[m] I tagged the wrong nick. See my previous response ^ It's still an open question for me
ltriant has joined #zig
ltriant has quit [Ping timeout: 246 seconds]
hobomatic has joined #zig
ltriant has joined #zig
ltriant has quit [Ping timeout: 244 seconds]
hio has joined #zig
redj has quit [Read error: Connection reset by peer]
hobomatic has quit [Quit: Page closed]
\u is now known as meowray
slugm has quit [Ping timeout: 244 seconds]
slugm has joined #zig
ltriant has joined #zig
slugm has quit [Remote host closed the connection]
slugm has joined #zig
ltriant has quit [Ping timeout: 268 seconds]
_whitelogger has joined #zig
hoppetosse has joined #zig
slugm has quit [Remote host closed the connection]
slugm has joined #zig
slugm has quit [Ping timeout: 246 seconds]
slugm has joined #zig
very-mediocre has quit [Ping timeout: 256 seconds]
very-mediocre has joined #zig
slugm has quit [Ping timeout: 246 seconds]
slugm_ has joined #zig
slugm_ has quit [Ping timeout: 250 seconds]
slugm has joined #zig
Ichorio has joined #zig
ltriant has joined #zig
ltriant has quit [Ping timeout: 246 seconds]
very-mediocre has quit [Ping timeout: 256 seconds]
slugm_ has joined #zig
slugm has quit [Read error: Connection reset by peer]
ltriant has joined #zig
bketelsen has quit [Ping timeout: 268 seconds]
ltriant has quit [Ping timeout: 268 seconds]
Akuli has joined #zig
Akuli has quit [Quit: Leaving]
slugm__ has joined #zig
slugm_ has quit [Ping timeout: 246 seconds]
<tgschultz>
No wonder my old allocator broke in 0.4.0, the rewrite for the allocator API change never calls HeapFree
<mikdusan>
does exporting a packed struct to C define it in C or just forward declare?
<andrewrk>
tgschultz, I mistakenly assumed HeapRealloc to 0 would free, and didn't test it
klltkr has joined #zig
<andrewrk>
mikdusan, packed structs are allowed to participate in C ABI. I don't think that's covered by tests yet
<tgschultz>
Freeing when new_size == 0 definitely fixes my problems, but I haven't been able to find documentation that says one way or the other what ReAlloc's behavior is with dwSize = 0
<andrewrk>
I think that's a missing feature from h file generation
<andrewrk>
h file generation might be one of the things we consider implementing in userland
<mikdusan>
ok so to make sure i have a handle on this, wrt `.d parser` and stage1 now being a hybrid,
<mikdusan>
i should now be able to implement .d parser in .zig, then possibly create a struct/handle in C to track a heap-allocated Zig structure and use it that way from C land?
<andrewrk>
yeah that'll work fine
<andrewrk>
you get to decide where the API boundry will be
<andrewrk>
you could also have the zig code call the cache_* functions directly
<tgschultz>
Am I correct that the allocator API no longer requires that shrink return memory with the same base address as it was passed?
<andrewrk>
tgschultz, I don't think that was ever a requirement, but you're correct that it's certainly not a requirement now
<andrewrk>
the important distinction of shrink is that it must not fail
ltriant has joined #zig
<tgschultz>
yeah, I seem to have remembered the old guarantee incorrectly.
ltriant has quit [Ping timeout: 245 seconds]
SimonNa has joined #zig
redj has joined #zig
bketelsen has joined #zig
Ichorio_ has joined #zig
Ichorio has quit [Ping timeout: 255 seconds]
shritesh has joined #zig
<mikdusan>
andrewrk: stage0/stage1 compiler uses -std=c++11 in command line. ok to use c++11 feature to mark a function as [[noreturn]] ?
hoppetosse has quit [Ping timeout: 250 seconds]
slugm__ has quit [Remote host closed the connection]
Ichorio_ has quit [Read error: Connection reset by peer]
jjido has joined #zig
Ichorio has joined #zig
ltriant has joined #zig
ltriant has quit [Ping timeout: 245 seconds]
Ichorio has quit [Quit: Leaving]
Ichorio has joined #zig
_whitelogger has joined #zig
<andrewrk>
mikdusan, in general, for stage0/1 we want to support a wide range of compilers. remember the whole point of maintaining stage0/1 is bootstrapping
<andrewrk>
once self-hosted is what we ship, stage1 won't change very much, and changes that make it work on older compilers will be improvements, since they shorten the bootstrapping process
<mikdusan>
we'll probably need either [[noreturn]] or ATTRIBUTE_NORETURN defined in userland.h if the idea is to use stage2_panic in shims.
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<mikdusan>
i'm uncertain if userland.h should avoid including util.hpp for ATTRIBUTE_NORETURN because it seems like userland.h should be as thin as possible
Ichorio has quit [Read error: Connection reset by peer]
suirad has joined #zig
Ichorio has joined #zig
<suirad>
with c-translate being moved to zig/userland, it seems logical at that point to assume we will be able to `try @cImport({}) catch |e| {@panic("{}", e);}`later on?
<suirad>
andrewrk: also, is feature-set of the final stage-1 figured out?
jjido has joined #zig
ltriant has joined #zig
ltriant has quit [Ping timeout: 246 seconds]
<andrewrk>
suirad, I think you misunderstand what it means for translate-c to be implemented in userland
<andrewrk>
ahh, "userland" is overloaded now.
<andrewrk>
it'll be implemented in zig, but still in the compiler
<suirad>
sure, however because the compiler evaluates comptime, @cImport or even @import itself could potentially return errors and be handled. hypothetically
jjido has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<suirad>
I
<andrewrk>
mikdusan, that's fine we can split off the stuff from util.hpp into another .h file
<mikdusan>
ok.
<andrewrk>
util.hpp is c++; userland.h is C, that's one reason it can't include util.hpp
<suirad>
I'm sure someone more creative could think of another use case. The only realistic one that stands out for me would be catching the @cImport error, checking for a specific known missing file ("whatever.h wasnt found") and printing out something like "If you are missing whatever.h, you probably want to install examplelib and run again"