<seadragon-droid>
marijnfs: Have you tried stepping through with a debugger to see what goes wrong? It looks like nng_socket is just a struct containing a single uint32_t so I'd be surprised if you're hitting a C FFI bug
<seadragon-droid>
Does it work if you build a executable and run that, instead of using the test harness?
benjif has quit [Remote host closed the connection]
benjif has joined #zig
seadragon-droid has quit [Ping timeout: 268 seconds]
notzmv has quit [Read error: Connection reset by peer]
notzmv has joined #zig
a92 has joined #zig
rzezeski has quit [Ping timeout: 258 seconds]
karrick has quit [Ping timeout: 258 seconds]
kushalp has quit [Ping timeout: 268 seconds]
<pixelherodev>
I'm stuck on the hardest part of my zig compiler: the name! :(
r0bby has quit [Ping timeout: 272 seconds]
<pixelherodev>
cig is too obvious, and dumb
<fengb>
Just do zig backwards
<pixelherodev>
No.
procnto has quit [Read error: Connection reset by peer]
r0bby has joined #zig
<pixelherodev>
For a reason that's obvious if you say that out loud
procnto has joined #zig
<a92>
Zag?
<pixelherodev>
Pretty sure that's reserved
<pixelherodev>
Andrew had a use for that IIRC
<pixelherodev>
Even if not, I know of at least one project using that already :P
karrick has joined #zig
<a92>
Zog? Zug? Zeg? Zyg?
rzezeski has joined #zig
<pixelherodev>
Zyg is a good enough temporary name, actually ;)
kushalp has joined #zig
<a92>
:D Is this thing published online anywhere?
<pixelherodev>
I'm literally starting on it rn
<pixelherodev>
Needed to figure out what to pass to mkdir ;)
<pixelherodev>
...
<pixelherodev>
> #zyg is already registered to freenode-placeholder-account.
<pixelherodev>
:(
<a92>
Zog, Zug, and Zeg are still suggested
<a92>
Or Yig, or Zif, or Zih
cole-h has joined #zig
<g-w1>
lig (light zig)
<pixelherodev>
##zyg i guess
<fengb>
zig--
<pixelherodev>
Now for the actually hard part: figuring out the design :P
moo has quit [*.net *.split]
neptunepink has quit [*.net *.split]
GrooveStomp has quit [*.net *.split]
danyspin97 has quit [*.net *.split]
dominikh has quit [*.net *.split]
jicksaw has quit [*.net *.split]
raggi has quit [*.net *.split]
nickster has quit [*.net *.split]
signop has quit [*.net *.split]
bkleiner has quit [*.net *.split]
Thalheim has quit [*.net *.split]
kandinski has quit [*.net *.split]
sjums has quit [*.net *.split]
companion_cube has quit [*.net *.split]
<andrewrk>
I think the actually hard part will be sticking to the project for any duration of time
<pixelherodev>
That's probably very true, yeah
earnestly has quit [Ping timeout: 268 seconds]
moo has joined #zig
danyspin97 has joined #zig
jicksaw has joined #zig
dominikh has joined #zig
signop has joined #zig
raggi has joined #zig
bkleiner has joined #zig
nickster has joined #zig
sjums has joined #zig
companion_cube has joined #zig
kandinski has joined #zig
Thalheim has joined #zig
neptunepink has joined #zig
GrooveStomp has joined #zig
<companion_cube>
is it written in C?
<pixelherodev>
companion_cube: yes
<companion_cube>
What's its reason to be, if I may ask ? (not critizing)
moo has quit [Read error: Connection reset by peer]
<pixelherodev>
companion_cube: emphasis on simplicity
<a92>
That's a design goal, not a reason for creation
<pixelherodev>
Actually, it's both
<pixelherodev>
IMO, stage2 is too complex
<companion_cube>
Like the zig tcc?
<pixelherodev>
Sorta, yeah
<pixelherodev>
tcc/cproc analogue, basically
<a92>
TZC!
<pixelherodev>
zproc ;)
<pixelherodev>
tzz is decent too :)
mokafolio has quit [Quit: Bye Bye!]
<a92>
But doesn't the second C stand for compiler?
<a92>
Or would it be a Tiny Zig Zompiler
mokafolio has joined #zig
mokafolio has quit [Client Quit]
<pixelherodev>
Tiny ZigZags?
* pixelherodev
shrugs
<pixelherodev>
I'm going to focus on the actual work lol
<pixelherodev>
I have a temporary name, that's all I need
mokafolio has joined #zig
mokafolio has quit [Client Quit]
mokafolio has joined #zig
chiefkemist has joined #zig
forgot-password has quit [Ping timeout: 260 seconds]
forgot-password has joined #zig
Ristovski has quit [Quit: 0]
forgot-password has quit [Ping timeout: 260 seconds]
FireFox317 has quit [Remote host closed the connection]
FireFox317 has joined #zig
<briyoman>
hi guys ! So i'm new to zig but i've been watching videos from both Andrew and Zig showtime channels. I'm looking forward to writing code in this language !
<briyoman>
but i've recently run into a weird problem
<briyoman>
so i use this Void Linux virtualbox instance with 2 CPU cores and about 1.5 gigs of RAM to play around with stuff
<briyoman>
so its a very low resource machine...
<briyoman>
when i try to build zls, or any other zig code using `zig build` i run into a problem where
<pixelherodev>
briyoman: Zig's stage1 uses atrocious amounts of memory
<briyoman>
the cpu shoots up to 100 % and the virtualmachine hangs
<pixelherodev>
You'll need probably 4GB+
<briyoman>
pixelherodev ah i see
<briyoman>
oh wow... damn
<briyoman>
xD
<pixelherodev>
Stage2 is much much more efficient
<pixelherodev>
And my compiler (which I started working on last night :P) will be as well
<pixelherodev>
But stage1 isn't quite ready and mine isn't *remotely* ready :P
<briyoman>
xD
<briyoman>
that means i'm going to have to try and do what i was doing in C now 😭
<briyoman>
oh well... i'll keep up with zig's development and wait for stage2 😜
<pixelherodev>
:)
<FireFox317>
briyoman, you can also build the zig program on your host machine and then run it in the vm :P
<pixelherodev>
That's heavily contextual
<pixelherodev>
There's plenty of legitimate reasons not to want to
<briyoman>
FireFox317 yeah i could 😂 but then 😂
hnOsmium0001 has quit [Quit: Connection closed for inactivity]
<FireFox317>
I know, pixelherodev, but it is an option :D
<briyoman>
i'll probably just end up running it on the host machine itself 😂
<briyoman>
i mean i was using the virtualmachine for fun, so its all cool xP
<pixelherodev>
:)
<FireFox317>
briyoman, zig won't put files all over the place on your machine (only in known locations, such as global cache), so its pretty easy to clean up on your host machine :P
<briyoman>
heh yeah ig
<briyoman>
😂
ur5us has quit [Ping timeout: 268 seconds]
chiefkemist has quit [Remote host closed the connection]
chiefkemist has joined #zig
chiefkemist has quit [Ping timeout: 260 seconds]
ur5us has joined #zig
jokoon has joined #zig
Nilium has quit [Ping timeout: 256 seconds]
briyoman has quit [Remote host closed the connection]
Nilium has joined #zig
chiefkemist has joined #zig
<ifreund>
pixelherodev: this is the suckless C zig compiler you were talking about? nice
chiefkemist has quit [Ping timeout: 260 seconds]
<ifreund>
also is that acme?
<pixelherodev>
ifreund: yes, and yes :)
<pixelherodev>
I "remotely" logged into my 9front box :P
<pixelherodev>
More design notes than code so far :P
<ifreund>
lack of syntax highlighting is a little jarring but it works alright for simpler languages like C I guess
<pixelherodev>
Honestly, it took like a day of getting used to
<pixelherodev>
But now I haven't noticed *at all*
<pixelherodev>
I think syntax highlighting is a waste of information
<pixelherodev>
Highlighting can be very useful, but syntax highlighting is *not*. Syntax highlighting means that I'm processing the syntax whenevr I glance around; without it, it's easier to focus
<pixelherodev>
Tactful highlighting to bring attention to specific details, sure; highlighting *everything* reduces the effect completely
<ifreund>
I agree that there's a balance to be struck, but I'm not sure I'd be happy with absolutely none
<ifreund>
maybe I just need to try it out for a bit
* pixelherodev
shrugs
<pixelherodev>
I'm not trying to convince you
<pixelherodev>
I don't care if you prefer it with; that's the beauty of individual choice (which is of course just an abstraction over determinism, but that's not the point)
<ifreund>
true that
<pixelherodev>
Oh god it's five am. I've spent nearly seven hours on this now...
<ifreund>
night o7
<pixelherodev>
Who said I was stopping? :P
<pixelherodev>
I just got it lexing its first tokens, I can't stop now!
<ifreund>
heh
<pixelherodev>
Feels weird to be doing this properly from the beginning, to be honest
<pixelherodev>
Last time I did a compiler, I half-assed the whole thing with the intent of whole-assing it later
<pixelherodev>
This time, I designed the entire thing, then the entire AST, then ran through some tests cognitively, then wrote the whole parsing architecture...
chiefkemist has joined #zig
<ifreund>
you have the source online yet?
<pixelherodev>
Nope
<pixelherodev>
Sample fully lexed, I think this is a decent commit spot
<scientes>
I knew a guy in San Francisco that was really into plan 9
<scientes>
I think he was the main push on porting go-lang to plan9
<scientes>
(which is ironic, given that most of the core go team is the former core team of plan 9)
<ikskuh>
pixelherodev: what are you working on?
<pixelherodev>
ikskuh: lightweight zig compiler
<scientes>
ikskuh, look at the link, it is a zig tokenizer+parser
<ikskuh>
oh no :D
<ikskuh>
have fun
<scientes>
pixelherodev, are you going to try to just compile to C?
<ikskuh>
writing a compiler for a language without spec :D
<pixelherodev>
Oh yeah, and it requires libmp (arbitrary precision math lib from Plan9)
<ikskuh>
i don't think that's a good idea right now
<pixelherodev>
Why not?
<pixelherodev>
ahhh
<pixelherodev>
Truew
<pixelherodev>
s/w//
<scientes>
I think it is a great idea
<pixelherodev>
scientes: no
<scientes>
I would love to see another implementation
<pixelherodev>
Might not bother with a CBE for this
<ikskuh>
scientes: it's a horrible idea as it is doomed to fail
<scientes>
I also would like to port my favorite zig features to C
<pixelherodev>
ikskuh: false!
<ikskuh>
are you going to implement all accepted proposals right from the start?
<pixelherodev>
Yep
<ikskuh>
as it would be kinda stupid not to do it :D
<scientes>
ikskuh, you are doomed to fail
<ikskuh>
always
<ikskuh>
even then, having a language that is changing
<scientes>
or rather
<scientes>
ikskuh, your a towel
<ikskuh>
i just don't think it's worth the time before a language spec
<ikskuh>
because anything might change
<ikskuh>
and then phd needs to change that stuff live
<scientes>
yeah, but it isn't implementing zig
<scientes>
it is implementing zyg
<scientes>
look at the name
<ikskuh>
i think that's just the name and the compiler should be zig compliant
<pixelherodev>
^
<pixelherodev>
It is 100% intended to be compliant :P
<scientes>
ikskuh, lua manages to continue despite having 5.1, 5.2, and 5.3 which are all incompatible, and the highest performing implementation, luaJIT is 5.1
<pixelherodev>
I might end up cutting stuff out
<pixelherodev>
but I'm definitely not *adding* anything
<ikskuh>
scientes: i think it's sad that luajit doesn't go up to more modern versions
<ikskuh>
that's one reason i don't use it
<ikskuh>
it makes stuff harder for people
<scientes>
ikskuh, except that the later versions broke compatibility for no good reason
<scientes>
and they are not "lua 6"
<scientes>
it is like the perl 6 or python 3 mess
<ikskuh>
true, but afaik they don't follow semver ;)
<ikskuh>
daurnimator, can you elaborate on the lua versioning?
<ikskuh>
and scientes: when we have two non-compatible zig compilers
<ikskuh>
the zig project failed
<ikskuh>
because it's about maintainable software
<ikskuh>
and when your other compiler has extensions or whatever
<scientes>
ikskuh, that is not a reason to dissuade people
<ikskuh>
the code will not be portable and maintainable anymore
* ikskuh
gooles dissuade
* scientes
deprecates zig :)
<ikskuh>
but it's okay you don't agree with mie
<scientes>
to speak or a word whose meaning changed
<ikskuh>
*me
<ikskuh>
i just think the energy is better spent on creating a zig spec
<ikskuh>
instead of another compiler that might differ from the main one
<ikskuh>
and then there are two unfinished versions of the "same" language
<ifreund>
multiple compiler implementations is a good thing to have
<scientes>
"unfinished"
<ifreund>
We don't have a spec yet, but by the time pixelherodev's compiler is reaching usability I expect a complete spec will be a lot closer
<ikskuh>
i don't disagree with having multiple compiler implementations
<ikskuh>
but i disagree with the chosen time to create one
<ifreund>
I feel very strongly that people should work on whatever they are most passionate about when it comes to free time open source work
<pixelherodev>
Okay, got it building on Linux :)
<ifreund>
having an alternative implementation already usable before zig hits 1.0 would a great thing IMO
<ifreund>
also a pure C implementation prioritizing simplicity is pretty ideal for bootstrapping
chiefkemist has joined #zig
<pixelherodev>
SHM fails on Linux :P
<pixelherodev>
> main.c.93: failed to allocate SHM
<pixelherodev>
ikskuh: also, as I said, there *will be no extensions*
<pixelherodev>
I absolutely will not add anything that isn't supported by the official compiler
<pixelherodev>
No exceptions.
<pixelherodev>
I might choose *not* to support features (for instance, I'm absolutely not going to add a sloppy mode, regardless of whether upstream does), but I won't support anything upstream doesn't
<ikskuh>
good :)
<ifreund>
I really hope "sloppy mode" gets rejected
<pixelherodev>
Parsing is done by subprocesses, which write the results into memory shared with the parent, which does the restof the work once all parsers are done
<pixelherodev>
The best part is that there's *maybe* 100 lines of code to support that, if not less
<pixelherodev>
took a bit of effort, but I found a straightforward way to do it without breaking POSIX :)
<ifreund>
oh that's not bad, I was about to question if parsing was enough of a bottleneck to make the complexity worth it
<pixelherodev>
ifreund: the reason it's only parsing is that only parsing is simple enough for it to be worthwhile
<pixelherodev>
I tried figuring out a design for sema, but it required wayyyy too much effort
<pixelherodev>
With parsing, we can do it per-file, and there's no worry about recursive dependencies
<pixelherodev>
Sema might still be doable if I can think of a simple enough design
<pixelherodev>
The key requirement is that processes need to not *have* to wait for each other
<pixelherodev>
The parsing processes have *no locks*, and *no synchronization* whatsoever
<pixelherodev>
Which means they get 100% of the benefits of parallelism
<ifreund>
you might want to add a license by the way
<pixelherodev>
tabs are *not spaces*, ansi!
<pixelherodev>
:P
<pixelherodev>
ifreund: I know
<pixelherodev>
done
<pixelherodev>
thanks
knebulae has joined #zig
<ifreund>
no problem, the FSF would still be disappointed in your lack of copyright headers though ;P
<pixelherodev>
The FSF can go FSF themselves
<ifreund>
also sr.ht says your commit was made "4 hours from now", might want to check your system clock
<pixelherodev>
Headers in files have no legal effect
<pixelherodev>
ifreund: ughhh right I know
* pixelherodev
shrugs
<pixelherodev>
THAT's why mk is always rebuilding when I switch systems!
<pixelherodev>
Alrighty, imports time :)
<pixelherodev>
might do a stream later; haven't done one since before term started :P
<pixelherodev>
and it'll be a good opportunity to play with libva lol
<pixelherodev>
s/opp[a-z]*/excuse/
<ifreund>
s/\[a-z\]/\./
<pixelherodev>
that'd match the rest of the line, no?
<ifreund>
s/\\\./\[^ \]/
<ifreund>
you're right, I missed your intent :P
<pixelherodev>
;)
earnestly has joined #zig
<pixelherodev>
ifreund: i lied! There is a tiny bit of synchronization, but it's just the parent waiting for a child to either give it a path to spawn a parser for or exit
sord937 has quit [Ping timeout: 240 seconds]
sord937 has joined #zig
chiefkemist has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
wootehfoot has joined #zig
chiefkemist has quit [Ping timeout: 264 seconds]
marijnfs has quit [Quit: WeeChat 2.8]
wootehfoot has quit [Read error: Connection reset by peer]
<pixelherodev>
Another design bonus: since each process runs on its own, I can use a single `static struct {} ctx` to store all lexer / parser state, and not need to pass everything around :P
notzmv has quit [Ping timeout: 268 seconds]
alexpana has joined #zig
chiefkemist has joined #zig
tane has joined #zig
Michcioperz has left #zig [#zig]
chiefkemist has quit [Ping timeout: 260 seconds]
forgot-password has joined #zig
notzmv has joined #zig
<semarie>
pixelherodev: with shm, are you able to run several zig compilation concurrently ? or will they share the same memory segment (at least on POSIX) ?
<pixelherodev>
semarie: It's concurrent
<pixelherodev>
As of a minute ago, it's now able to parse multiple files in parallel
<semarie>
yes, but you are not running on POSIX :p
<pixelherodev>
It works on POSIX
<semarie>
if I didn't mess myself, calling shm_open("/zyg", O_RDWR | O_CREAT, S_IRUSR | S_IWUSR)
<pixelherodev>
Yep, it does that
<semarie>
on all several processes should get the same shm segment
<pixelherodev>
#ifdef _PLAN9_SOURCE segattach(...) #else {15 lines of doom}
<pixelherodev>
Not quite
<pixelherodev>
It currently does one segment per process
<pixelherodev>
(which is one per input file)
<pixelherodev>
I'm going to improve that later, since that won't scale well
<semarie>
for POSIX reading, if process1 uses shm_open("/zyg") and process2 uses shm_open("/zyg") too, it is the same
<pixelherodev>
Only the parent process uses shm_open
<pixelherodev>
it then fork()s off workers
ifreund1 has joined #zig
<pixelherodev>
which inherit the shared memory segment
<companion_cube>
watching a talk on "reducing C++ accidental complexity"
<semarie>
but if I call "zyg foo.zig" in one term, and "zyg bar.zig" in another term ?
<companion_cube>
I think zig has some room :D
<pixelherodev>
semarie: then currently it'll crash :P
<pixelherodev>
It *will* use PID
ifreund has quit [Ping timeout: 264 seconds]
<pixelherodev>
e.g. shm_open(aprintf("/zyg.%d", getpid())
<pixelherodev>
)
<semarie>
pixelherodev: ok. for now it isn't important. all the best for your project :)
<pixelherodev>
Thanks :)
* semarie
has blood in eyes due to unchecked asprintf return before use
<semarie>
:D
<pixelherodev>
not asprintf
<pixelherodev>
aprintf
<pixelherodev>
It's a custom util function which allocates or FATALs :P
<pixelherodev>
Oh yeah, another side benefit of the design: the parser processes never need to bother freeing memory
<pixelherodev>
The OS will take care of it when they exit() :P
<pixelherodev>
I honestly think I can get basic tests compiling within a day or three
<pixelherodev>
But "basic tests" aren't exactly useful :P
<pixelherodev>
The only real pain point I see is the comptime engine
<pixelherodev>
Everything else is smooth sailing from here, now that the design is completed and (at least somewhat) tested
<mfiano>
Hello
<g-w1>
I would say you can make it even simpler than stage2 if you want by making one ir instead of 2 and just making sure you dont have any comptime stuff left over after analyzing it.
ifreund has joined #zig
ifreund1 has quit [Ping timeout: 264 seconds]
waleee-cl has joined #zig
<pixelherodev>
g-w1: it's already designed to be simpler than stage2 :P
<pixelherodev>
No incremental compilation, no embedded linker...
donniewest has joined #zig
<g-w1>
that is what im saying ... I think analysis can be done with 1 ir instead of 2
jokoon has quit [Quit: Leaving]
mfiano has left #zig ["WeeChat 2.9"]
<pixelherodev>
@g-w1 Yes, but partly because my design involves doing analysis on the AST instead of on an initial IR
xackus has quit [Ping timeout: 240 seconds]
<LanceThePants>
So I use zig-bootstrap to create toolchain for arm-linux-musl. Doesn't look like it's been updated for 0.7.1, and when I manually update zig in the repo it fails with musl error. When might zig-bootstrap be updated to build for 0.7.1?
<ifreund>
LanceThePants: you want the 0.7.x branch of zig-bootstrap
<ifreund>
the master branch tracks zig master
<ifreund>
note that there was an 0.7.1 tag pushed to the repo as well
<LanceThePants>
ifreund: Oh sweet, thanks for that info!
asie has quit [Quit: WeeChat 2.9]
xackus has joined #zig
forgot-password has quit [Ping timeout: 265 seconds]
forgot-password has joined #zig
forgot-password has quit [Ping timeout: 260 seconds]
<ifreund>
sigh, looks like memoization of comptime functions taking slices as parameters is busted
<pixelherodev>
ifreund: good news! I can make it even simpler!
<pixelherodev>
Turns out I'm an idiot!
<ifreund>
wonderful1
<pixelherodev>
I've been using lockfiles to avoid spawning multiple processes for the same file
<pixelherodev>
How do you think I clean up at the end?
<pixelherodev>
*By listing the lock files*
<pixelherodev>
This is a serious facepalm moment
<pixelherodev>
I have an array of the *LOCK* files
<pixelherodev>
Not the actual files
<pixelherodev>
like... why?
cole-h has joined #zig
stzsch has quit [Read error: Connection reset by peer]
pjz has quit [Ping timeout: 246 seconds]
pjz has joined #zig
dbohdan has quit [Ping timeout: 246 seconds]
pixelherodev has quit [Ping timeout: 264 seconds]
dbohdan has joined #zig
pixelher- has joined #zig
pixelher- is now known as pixelherodev
dbohdan has quit [Ping timeout: 246 seconds]
dbohdan has joined #zig
nore has quit [Ping timeout: 264 seconds]
nore has joined #zig
a_chou has joined #zig
marnix has quit [Remote host closed the connection]
marnix has joined #zig
benjif has joined #zig
wootehfoot has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
hnOsmium0001 has joined #zig
<andrewrk>
ifreund, can you try reverting 84549b42678fa1f2755b2ec7bf4f4936d8f513af
seadragon-droid has joined #zig
<ifreund>
andrewrk: doesn't seem to have made a difference
xackus has quit [Ping timeout: 272 seconds]
SebastianKeller has joined #zig
a_chou has quit [Remote host closed the connection]
ur5us has joined #zig
mokafolio has quit [Quit: Bye Bye!]
mokafolio has joined #zig
mokafolio has quit [Quit: Bye Bye!]
mokafolio has joined #zig
mokafolio has quit [Client Quit]
mokafolio has joined #zig
marnix has quit [Read error: Connection reset by peer]
marnix has joined #zig
mokafolio has quit [Quit: Bye Bye!]
marnix has quit [Ping timeout: 264 seconds]
ifreund has quit [Ping timeout: 264 seconds]
ifreund has joined #zig
bastian[m] has joined #zig
sord937 has quit [Quit: sord937]
mokafolio has joined #zig
mokafolio has quit [Client Quit]
seadragon-droid has quit [Quit: -a- IRC for Android 2.1.59]
nikki93 has quit [Ping timeout: 244 seconds]
Snetry has quit [Quit: left Freenode]
Snetry has joined #zig
nikki93 has joined #zig
bastian[m] has left #zig ["User left"]
bastian[m] has joined #zig
mokafolio has joined #zig
forgot-password has joined #zig
FireFox317 has quit [Ping timeout: 256 seconds]
bastian[m] has quit [Quit: issued !quit command]
nvmd has joined #zig
xackus has joined #zig
donniewest has quit [Quit: WeeChat 3.0]
forgot-password has quit [Ping timeout: 264 seconds]
dch has quit [Ping timeout: 244 seconds]
strmpnk has quit [Ping timeout: 244 seconds]
forgot-password has joined #zig
l1x has quit [Ping timeout: 264 seconds]
nikki93 has quit [Ping timeout: 260 seconds]
dputtick has quit [Ping timeout: 260 seconds]
nvmd has quit [Ping timeout: 240 seconds]
ur5us has quit [Ping timeout: 264 seconds]
wootehfoot has quit [Read error: Connection reset by peer]