IRC channel logs
2021-10-23.log
back to list of logs
<stikonas>(and change is not upstreamable yet as it breaks other arches) <oriansj>well I guess that is one way to get riscv support for mes-m2 <stikonas[m]>Well, patches can be cleaned up, I just didn't have any spare time yet <stikonas[m]>This was just a quick attempt to see how much porting is necessary <oriansj>well it was only the syscalls, everything else should be relatively portable <markjenkinssksp>I now have 39 tests that apply to my compiler and bytecode_interpreter (arguably that's 78) <markjenkinssksp>I'm testing against M2-Planet and gcc on aarch64, amd64 and x86, so that's 234 variations the bytecode interpreter is being put through. <theruran>markjenkinssksp: so you rolled your own PEG? <markjenkinssksp>Nystrom does describe his approach as hand-written parser vs generated <muurkha>yeah, pratt parsers are not the same as PEGs <muurkha>I feel like PEGs are a lot simpler than Pratt parsers for most things, but they're a lot less efficient, and bog-standard PEGs can't handle left-recursive grammars, so if your PEG parser generator doesn't support Warth's left-recursion hack, you have to learn to refactor your grammar to eliminate left-recursion <muurkha>infix grammars and grammars with postfix operators tend to have a lot of left-recursion <markjenkinssksp>indeed, from what I can see on the wikipedia article about PEG it's a formal thing, whereas the Pratt approach Nystrom spends part III of his book on is an informal approach that he claims is quite common <muurkha>I think Pratt would take exception to both of those claims about Pratt parsers :) <muurkha>operator-precedence parsers are widely used, and so are top-down parsers (PEGs are also top-down, for example), but most operator-precedence parsers are bottom-up <muurkha>and most top-down parsers are either LL or recursive-descent <muurkha>PEG parsers, like Pratt parsers, LL parsers, and LALR parsers, have a linear-time performance guarantee, but PEG parsers can also require linear *space*, which can be a real problem <muurkha>and their constant factors are enormously higher <markjenkinssksp>In fairness, I guess I may have overstated what the sidebar says about commonness, Nystrom says "But in production compilers, where hand-rolled parsers are common, you’d be surprised how many people know it." <muurkha>in this case it parses a system of linear equations