Open rpavlik opened 1 year ago
Could we discuss these? Please find my personal email at danielwilkerson.com .
On Mon, Nov 21, 2022 at 3:26 PM Ryan A. Pavlik @.***> wrote:
I've integrated a few PR's, as well as started on a CMake build system, which can successfully build astgen, elkhound, and elsa/ccparse.
You can view, comment on, or merge this pull request online at:
https://github.com/dsw/oink-stack/pull/25 Commit Summary
- 8034e6b https://github.com/dsw/oink-stack/pull/25/commits/8034e6b7e77675c4f3862d13852f583c72fb1590 Update smbase/array.h
- a6c99f4 https://github.com/dsw/oink-stack/pull/25/commits/a6c99f406234cb6396e2586b9dc80050ab27e848 Update elkhound/grampar.y for modern bison
- 5dd5a07 https://github.com/dsw/oink-stack/pull/25/commits/5dd5a073678fcf4b96b65ddc680c079953eed2cc YY_CURRENT_BUFFER workaround amended and smbase placed in path
- 69fd2f0 https://github.com/dsw/oink-stack/pull/25/commits/69fd2f0135a65e790cf088dbf2556fe7a57bf088 Merge branch 'noabody/master' into integration
- 7cb359d https://github.com/dsw/oink-stack/pull/25/commits/7cb359dc43c7dacc7427841c07ebd5a42b840bfa Merge branch 'patch-1' into integration
- 4d91118 https://github.com/dsw/oink-stack/pull/25/commits/4d9111870dfd851cabcbd23732adb02e055486d7 Initial cmake work
- b8186ff https://github.com/dsw/oink-stack/pull/25/commits/b8186ffa7be2ffb9ff1ebd2143f7b40574e33d42 wip
- fa27a5d https://github.com/dsw/oink-stack/pull/25/commits/fa27a5d6f57fa0b20da2c1e5f81a48b0af5ce0d7 Update yacc file
- 1518736 https://github.com/dsw/oink-stack/pull/25/commits/1518736bb68005fb9bf66dc0f6b0028ba4ae7998 update for newer bison
- c407339 https://github.com/dsw/oink-stack/pull/25/commits/c407339966627b7f19d41ff0091c690d83901ba6 almost fix an example build
- cab982a https://github.com/dsw/oink-stack/pull/25/commits/cab982ad25f21e38893e8d1bf28adacad72c26f5 more cmake
- d0cb5e9 https://github.com/dsw/oink-stack/pull/25/commits/d0cb5e97bf73198d3a844efc70cca74ea049e3c6 More progress
- 4522455 https://github.com/dsw/oink-stack/pull/25/commits/452245564518be6a323ea445e43a94ad58c6e1d4 wip
- 75ff1d3 https://github.com/dsw/oink-stack/pull/25/commits/75ff1d3f62a364616233a3308efef8ed878fd6d8 fix builds
- b5c0cfa https://github.com/dsw/oink-stack/pull/25/commits/b5c0cfaf1b4e6b0bc40af4f2dbc75b42dbe9e76b Fix include guard sanitization
- 5a1bed4 https://github.com/dsw/oink-stack/pull/25/commits/5a1bed4631c972568845e7ccb63034ab592dd565 More work on building
- 910d2e5 https://github.com/dsw/oink-stack/pull/25/commits/910d2e53745627b9a024af321164a997bf04bd76 start cleanup
- badf051 https://github.com/dsw/oink-stack/pull/25/commits/badf0515ca1f80812ec66e7d85d0b476130d49fd Be able to generate everything
- fdb1f3f https://github.com/dsw/oink-stack/pull/25/commits/fdb1f3f371e3c588e9ab2784566d1a31b6560653 Remove more things we can generate
- be4742f https://github.com/dsw/oink-stack/pull/25/commits/be4742fbe727142490ea8524179a2dcadf976c84 Small cleanup
- d688865 https://github.com/dsw/oink-stack/pull/25/commits/d6888657010b566cabc88f49c53332f4dbf1c7a7 Rename elkhound-lib
- fe057c8 https://github.com/dsw/oink-stack/pull/25/commits/fe057c85a9eb738652dc854ca7e9135a0b37da45 Stop using ofstreamTS
File Changes
(24 files https://github.com/dsw/oink-stack/pull/25/files)
- A .cmake-format.py https://github.com/dsw/oink-stack/pull/25/files#diff-98833b0bd4bd79e3d14bc2d8997160c053cc8671f94f26445e44947b9070e077 (25)
- M .gitignore https://github.com/dsw/oink-stack/pull/25/files#diff-bc37d034bad564583790a46f19d807abfe519c5671395fd494d8cce506c42947 (3)
- A CMakeLists.txt https://github.com/dsw/oink-stack/pull/25/files#diff-1e7de1ae2d059d21e1dd75d5812d5a34b0222cef273b7c3a2af62eb747f9d20a (103)
- A ast/CMakeLists.txt https://github.com/dsw/oink-stack/pull/25/files#diff-ee009cf4c645692f990d4d3db48c23bd7f2316938b4ebc9356d8bbfde2f7cebf (81)
- D ast/agrampar.codes.h https://github.com/dsw/oink-stack/pull/25/files#diff-9b9068f36e99f71abc01839170ede3c29828f6acad3cbdf14a010cac2bb6d51e (34)
- M ast/agrampar.h https://github.com/dsw/oink-stack/pull/25/files#diff-beecdb0f2b448187698d23ee35c0075f5b9726ac4bead4910f50c835afba081e (6)
- D ast/agrampar.tab.cc https://github.com/dsw/oink-stack/pull/25/files#diff-80b2804dc124d9b575aab263a36a1ee43ba4fba987178c24740d3875b19cc026 (2103)
- D ast/agrampar.tab.h https://github.com/dsw/oink-stack/pull/25/files#diff-3666aa6d221b60ad1962fa93ee0e03cf3de1c3957ef44a8ebe62771474cbf34e (141)
- M ast/agrampar.y https://github.com/dsw/oink-stack/pull/25/files#diff-001c3ebc995e859747e25810eaaaf7508ccb3d3ee194749f1d4e5a25bfe00177 (13)
- M ast/astgen.cc https://github.com/dsw/oink-stack/pull/25/files#diff-be9ea476790fdebe6acb8faa9842be670184ec1e079cacff70f090c6bed3cad5 (15)
- M ast/exampletest.cc https://github.com/dsw/oink-stack/pull/25/files#diff-a1587b2c7a903e9fa73b33c5723417dee79286366441fd31d8f52c4e5674389a (3)
- M ast/gramlex.cc https://github.com/dsw/oink-stack/pull/25/files#diff-4290c3a0ef22345dac5ad5bd63e97229c093f91073ddd7bf7b7eeec337e7ad3c (8)
- A elkhound/CMakeLists.txt https://github.com/dsw/oink-stack/pull/25/files#diff-aa79caa189863afda1d7c6a2d7c00c2d351377d6ac10b9d8a68d050c6f953d3a (109)
- M elkhound/emitcode.h https://github.com/dsw/oink-stack/pull/25/files#diff-04fda0e521c16ef3c05a21750fae50949f32a6b26b4a14eb2d8425b57129bb9a (4)
- M elkhound/glr.cc https://github.com/dsw/oink-stack/pull/25/files#diff-36b60a218c3740170e8c2141293caaf779e78bd14609fc01f6381d35f8e9396d (3)
- M elkhound/gramanl.cc https://github.com/dsw/oink-stack/pull/25/files#diff-a1ecf5471492e14462f078161245aa5b8dd2afe205f6a37b11ba83ec906e2703 (7)
- D elkhound/grampar.codes.h https://github.com/dsw/oink-stack/pull/25/files#diff-02238312bb061fbd332b2f999364baebcc3182425b976cbd664aa7b0a6291a4c (30)
- D elkhound/grampar.tab.cc https://github.com/dsw/oink-stack/pull/25/files#diff-9bfda9d6393be8d49ae31f7f7898e4952103c84916168111f6bf678f5264b058 (2056)
- D elkhound/grampar.tab.h https://github.com/dsw/oink-stack/pull/25/files#diff-a4a906b7164a86ce969dde7f5a9b5341f818a42127d0f8eff7ed39e083bc4e5b (136)
- M elkhound/grampar.y https://github.com/dsw/oink-stack/pull/25/files#diff-bf0433f32929e9c512ce3d9bd2bb4df06770be13cd0fdedba7e3415cfa841959 (13)
- A elsa/CMakeLists.txt https://github.com/dsw/oink-stack/pull/25/files#diff-09046542eae8c31605911965d51bf0a43374f99b0da00da343d7bc443f77c54b (230)
- M elsa/make-token-files https://github.com/dsw/oink-stack/pull/25/files#diff-a4667fedc9029232672e7235a7ec9766f7d4964e402199f04718e9c52b147f80 (2)
- A smbase/CMakeLists.txt https://github.com/dsw/oink-stack/pull/25/files#diff-4d2dab2720076fdd470c47e47e27fb3ee53f7420d4ce69860d4d01b342ee2d2a (280)
- M smbase/configure.pl https://github.com/dsw/oink-stack/pull/25/files#diff-d9acd76096ea12cacf69f71cdab19ff36ecec249a1748066cf7bcebf63409d73 (1)
Patch Links:
— Reply to this email directly, view it on GitHub https://github.com/dsw/oink-stack/pull/25, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAL6XCEAEPSCU3OJ4M7HNLWJQAJBANCNFSM6AAAAAASHFHJIM . You are receiving this because you are subscribed to this thread.Message ID: @.***>
This work has been done a couple times already it would seem :)
https://github.com/KubaO/elkhound is cloned from a repo that had cmake transition done in 2019. Tim Wanders did that work, according to the repo messages. It looks like elkhound is used by text adventure game aficionados to parse the adventures.
I've done some work on it so that it's self-contained with MSVC - winflex and winbison are included as a part of the build. Not used on Unix of course. Thanks to cmake, the root folder of the repo can be opened with recent versions of Visual Studio.
I've also dragged a lot of the code into the next decade. My goal is to keep it building with C++14.
There were a couple little bugs here and there I caught - related to 64-bit compatibility and heisenbugs.
I dropped all the containers in smbase (yes, all of them) and replaced those with C++ standard library. ASTList is a thin wrapper around std::vector, kept just to avoid having to do mechanical modifications that cause noise in the diffs.
This took some work to keep the whole thing working correctly (I hope). The changes consist of small self-contained commits, and my intention was to keep the thing building and passing tests for every commit. There are 230 commits done over the last month's worth of evenings :) I needed a GLR parser nicer to use than Bison, and that's how I found elkhound.
The original code used linked lists a lot and that's a performance killer on modern systems - at least with typical allocators. Where I could, I moved from lists of pointers to vectors of ideally values, or pointers if absolutely necessary. There are very few places where std::forward_list and std::list had to be used, and I'm not convinced those will stay that way.
I've also included fmt::format, and a free-standing implementation of string_view. The code is being slowly migrated to use those as/when needed.
The overall idea is to use movable values to where they help maintain performance while obviating old optimizations. E.g. I've carefully de-optimized the GLR core to make the code readable by the average person (like myself :). The generated code is still excellent due to man-centuries of effort spent on modern compilers :)
Long-term, I imagine this should use the excellent mimalloc memory allocator, since it provides very lightweight heaps, with excellent locality based on object size; creating and destroying them often is no problem.
I've integrated a few PR's, as well as started on a CMake build system, which can successfully build astgen, elkhound, and elsa/ccparse.