ChubakPDP11+TakeWithGrainOfSalt

  • 10 Posts
  • 14 Comments
Joined 5 months ago
cake
Cake day: February 10th, 2024

help-circle







  • This is egregious. standards(7) says Linux is both SuS and POSIX. Either mkdev.h is neither and I am wrong, or there’s some shit going on because LXRs list it in older versions of the kernel. In fact if you, I mean me, with my Google recommender system cache, search for ‘mkdev.h’, an LXR comes up! Just stupid and egregious. I was looking forward to running them. But see, time’s moving on from POSIX. People are writing cool supersets of these utilities in Rust. Like: fish, ripgrep, fd, exa and oh so many more! Also, Core Utils is entirely useless now. I just got introduced to the ‘Miller’ utility, an AWK-like string processor that, instead of doing line-based, does key-value. There’s jq too. I think I am the ‘new generation’ of terminal users. I am not very young, 31, but when I started using a PC at 10, it was a Windows XP machine — I did not even get to experience the ‘clunky’ days of graphical shells. But it’s been a while now that I am just constantly using Kitty to interface with my system. Barely use the WM. That’s why I have decided to make my own WM that fuses in a terminal but let’s more on or now.

    So yeah Heirloom Toolchest is useless. But at any case, you wanna try the original AWK, someone has pushed it to most of the repositories for Debian-based systems. sudo apt install oawk. It’s good if you suck Kernighan’s dick whilst fondling Aho’s balls like I do. But besides historical reasons why use it. AWK was made useless in fucking 1985 when Perl came lol.




  • True, but see, all these build up on the theoretical regex. The theoretical regex indeed has only 3 operators: dot for concatenation, pipe for alteration and the ‘kleene star’ [re: Sipser’s]. These 3 operators can express a finite state automata. You don’t really need all that other operators. Read this: https://swtch.com/~rsc/regexp/regexp1.html Algorithms like Thompson construction can translate a regex to a non-deterministic automata quite quickly, and then from there you can make a DFA or just simulate the NFA.

    I would not call PCRE ‘regular expression’ really. If you read the article I gave you it explains why they are mostly a practical utility than a theoretical groundwork. The regex in use today is far from the regex one learns about in books.

    I think regex is abused. People use it to parse context-free grammars. Extremely intricate and feature-rich patterns cause people to make mistakes, and end up with security holes!

    That being said, I really enjoy NeoVim’s regex. I also like Perl’s. But I would not rely on them for parsing, or even lexing.
















  • I really recommend creating a compiler or an interpreter from scratch, don’t even use an IR like LLVM or MIR. Just hack and slash your way though a C compiler, it’s the simplest language most people know. Don’t care about ‘optimization’ at first, fuck optimization. Just grab Yacc/Lex or a PEG parser generator that works with the language you like most and have ot generate assembly code for simple expressions. Like, make a bc(1) native compiler! Interprets are fun too. You can use VMGEN to generate a superfast VM in C, and then bind it to another language using SWIG.
    Also never imagine usability. Noobdy is going to use your C compiler for any serious work. It’s just for education. Post it online to receive feedback.

    You cna start by writing DSLs. For example, I am implementing the ASDL language from this old paper.

    Also if you are going to do it as an example in your resume, just stop. Nobody cares, because it’s a trivial task to write a compiler, even if you write backend, forntned, and the LP yourself! Do something money-loving people loike, like making some bullshit mobile app that tracks your gym sweat volume.