IRC channel logs

2022-03-31.log

back to list of logs

***ChanServ sets mode: +o janneke_
***pigeons_ is now known as pigeons
***alMalsamo is now known as littlebobeep
***ChanServ sets mode: +o janneke
***ChanServ sets mode: +o janneke
***ChanServ sets mode: +o janneke
***ChanServ sets mode: +o janneke
<unmatched-paren>does anyone know a good introduction to lex and yacc, and [LA]LR parsing in general?
***Server sets mode: +cnt
<muurkha>unmatched-paren: I learned about it from the Dragon Book when I was a kid, but I didn't really understand it
<muurkha>I used ocamlyacc to write the Bicicleta parser, so I did eventually understand it well enough to use, but I still couldn't write an LALR parser generator
<muurkha>so conceivably I may not be the best source of information
<muurkha>but I think it may be better nowadays to just use PEG
<unmatched-paren>muurkha: apparently PEG is slightly less powerful, but i'll give it a go...
<muurkha>well, it's slower
<unmatched-paren>hm
<muurkha>but it can parse every language LALR can parse, and it's a lot easier to understand
<unmatched-paren>probably doesn't matter for a bootstrap compiler anyway
<unmatched-paren>it's just pascal, nothing too tricky, no significant whitespace evilness or anything
<muurkha>I wrote an introduction in https://github.com/kragen/peg-bootstrap
<unmatched-paren>still, ocaml doesn't seem to have a PEG library...
<muurkha>but there are probably better introductions
<muurkha>yeah, the path of least resistance might be to just use ocamllex and ocamlyacc
<unmatched-paren>or ocamllex and menhir
<muurkha>but if you find yourself getting frustrated trying to figure out what a shift-reduce conflict is, keep PEGs in mind as an alternative
<muurkha>you can write a usable PEG library in 100 lines of code
<unmatched-paren>how about parser combinators?
<unmatched-paren>they seem to fit really well with functional languages
<muurkha>those are more a user interface to a parsing library than they are a parsing algorithm
<unmatched-paren>...except the parser combinators for ocaml all seem to be unmaintained :(
<unmatched-paren>menhir it is, then -.o.-
<muurkha>parsing libraries don't need to be maintained usually
<muurkha>they usually don't get security holes ;)
<unmatched-paren>fair enough :)
<unmatched-paren>i managed to get menhir building under ocaml-4.07, but i couldn't figure out how to make the install phase work
<unmatched-paren>i might just do ocamllex
<muurkha>it's probably the path of least resistance
<unmatched-paren>yeah
<unmatched-paren>well, menhir is just as easy on the latest ocaml
<unmatched-paren>but i seem to be running into problems on 4.07
<muurkha>nothing is *quite* so easy to install as something that's already installed
***civodul` is now known as civodul
<drakonis>raku does PEGs but the bootstrap path might be a little rough
<drakonis>since you might want to bootstrap perl
<stikonas>drakonis: there are no issues with perl
<unmatched-paren>well, no *bootstrapping* issues, at least ;)
<stikonas>we build perl in live-bootstrap
<drakonis>hm, nice.
<drakonis>good to know
<unmatched-paren>are there actually compilers in perl?
<unmatched-paren>well, there's a C compiler in vimscript, so anything is possible, i guess!
<drakonis>well, not perl i guess
<drakonis>raku is very amenable to building these
<drakonis>actually, i recall seeing a compiler built with perl
<drakonis>it was used for a toy fp language
<drakonis> https://github.com/Raku/nqp
<stikonas>perl bootstrap is here: https://github.com/fosslinux/live-bootstrap/blob/master/parts.rst#33perl-5000 (we build it in a few stages because perl used a bit of perl scripts in the build process (mostly stuff like generating some header files)
<drakonis>oh, nice.
<drakonis>how amenable is the bootstrappable project to the idea of other languages for bootstrapping steps?
<drakonis>the most common one so far seems to be scheme
<stikonas>drakonis: we use whatver we have bootstrapped
<stikonas>there are no limitations
<drakonis>i see
<drakonis>cool.
<stikonas>live-bootstrap basically bootstraps GCC but on the way we must bootstrap some other languages
<stikonas>as GCC depends on them
<stikonas>e.g. bash, perl, etc...
<stikonas>(bash and perl is due to GNU Autotools)
<oriansj>and there is the guile bootstrap which would be the bootstrapped scheme