<quote>
Over the last few months, I managed to create a website for nom which I hope will be useful to document this tool that so far nobody except me uses. I continue to be convinced by the revolutionary nature of nom in terms of it’s ability to parse certain types of regular, context-free and context-sensitive languages. But there are several outstanding tasks which I am unlikely to solve in the next few months because my attention is going to be elsewhere.
One important task is to use the tape register marks
as a way to implement type-checking and type inference in nom. The mark
capability in conjunction with the recently implemented go
command
variant, should be sufficient to implement type checking, which means that
nom could be used to define useful programming languages. At the moment,
Nom is more useful for parsing and translating text data formats (like JSON
or XML) than it is for coding languages.
Another important task is to elaborate on the “higher-level” parsing language which was started in /eg/toybnf.pss . This language should be easier to use and therefore more accessible than the nom language because it doesn't require learning the different registers and structures of the Pep virtual machine.
Another very useful thing would be to just translate the ℙ𝕖𝕡 🙵 ℕ𝕠𝕞 translators to other languages using AI as a helper. I have already done this once with Perl and it worked very well. It greatly speeds up the work of creating translator scripts and it would make ℙ𝕖𝕡 🙵 ℕ𝕠𝕞 translatable to many many languages. I would like to do translators for zig, kotlin, forth, R and Php. Zig is interesting because it creates binaries that are relatively tiny. Kotlin is worthwhile because it is used in App development. An “R” translation might be good because it would allow science and data people to discover ℙ𝕖𝕡 🙵 ℕ𝕠𝕞 (wishful thinking), and php is so ubiquitous that I would have to do it. I also need to update some of the old translators (java, python, ruby, tcl etc) to use the new grammar, and the new approach to unicode code points and grapheme clusters.
But the most fascinating and potentially revolutionary translation would be Forth. This is because Forth can and does run easily on tiny machines with no operating system, and if I can get ℙ𝕖𝕡 🙵 ℕ𝕠𝕞 to compile via Forth it would open up new techniques for programming small machines. But the Forth translation also has big challenges. Firstly, forth is not really a “friendly” language to use for large-ish projects and secondly it has absolutely zero memory management out-of-the-box, and it’s a very small box. That means no malloc no nothing. DIY at it’s most pure. But it is do-able and would be interesting also for learning about memory management techniques.
The trickiest aspect is managing the string memory in the tape (which is an array of strings). But a simple strategy might be maintaining a list of pointers to string memory buffers and copying and swapping as needed, so if a string grows too large for it’s buffer (which it will, because the whole point of the tape array is to build bigger and bigger strings in lower and lower tape cells, culminating in the whole compiled string existing in tape-cell 0) then we need to combine buffers and arrange the pointers accordingly. A key aspect of this may be estimating which is the last tape-cell containing “meaningful” content. By meaningful I mean, text that we are going to need again at some point. If all of this is unintelligible, don't worry: just go and read the docs at www.nomlang.org/doc/
There are a few capabilities and registers which should be added to the machine: A “state” type variable which is just a text register which can be used as a “flag” for a particular parsing state. At the moment I often use the accumulator for this, which normally works more or less ok, but has the disavantage of not being very readable.
Software still seems to me far more complex than it needs to be, and this impression is only reinforced by exploring modern development systems such as Flutter and Dart. This latter is an impressive effort by Google because of it's cross platform nature, but each app folder or development folder, before any real code has been written, takes up nearly 1/2 a gig of disk space. The question is: what on earth is all that code? Maybe the fault is of the operating systems on which Flutter and Dart have to compile. But does it really have to be like this.
Here are a couple of ideas that may be naive, in a question and answer format (I haven't got my wizz-bang text-to-html nom script to recognise a Q&A or an FAQ format yet, so I just have to put it all in a code block.)
Q: Whats your big idea? A: Lets just write a simple tiny universal virtual stack machine that **includes** all the machine peripherals and will run anywhere... anywhere? Q: What do you mean by anywhere? A: Like anything from an Attiny to ARM or whatever Q: You don't know much about chip architecture do you? A: No, but I've played around a bit with an arduino and I know what the phrase "Harvard Architecture" means. A: Anyway, how do you know what the peripherals are attached to the given actual real silicon machine? Q: Well, the VM just includes a signature at the top which indicates what opcodes are available and if the opcode is available for a 3-axis gyrometer, then the machine has that periferal. Q: But there are an infinite number of peripherals, aren't you going to run out of opcodes? A: Utf8 solved that problem, you just have a variable length opcode. Q: That's going to be slow, decoding variable length opcodes? A: What's the rush? Computers are too fast anyway Q: So what's the advantage of this UniVM anyway? A: Don't you know how good stacks are? Especially if you have got 2 of them. They can do anything, almost. Q: This is starting to sound like that gobble-de-gook language FORTH from back in the late 80's. I had a book about it once with funny drawings in it. Is that what you're talking about? A: Please don't mention that word, because old people will start up with the FORTH jokes and the condescending smile. Q: But a 2 stack virtual machine? Come-on... A: OK, OK the idea comes from forth. But its an idea, not a language. And you can't kill ideas. Anyway, did you know that there is a forth-like machine in bitcoin and Apple had a forth boot-loader at one point? And postscript is pretty cool, and its got a stack machine inside it. Q: Anyway, are the opcodes also universal? A: Absolutely. You see every problem we currently have in software pretty much comes down to *naming* If you get naming right everything else falls into place. Q: This is starting to sound pretty fringe. Have you ever actually held down a 9-5 job? A: That's another topic I will be avoiding. But naming is important. All languages are reference systems, a reference from daylight-world to the story-world (Warlpiri: Tjukurrpa). Q: What have you been smoking and what is Warlpiri? A: Nothing, just had a few strong lattes, but these ideas are valid. Warlpiri is an Australian language. Programmers get to name things, and that is possibly the most important part of their job. And programmers also love self-referential systems such as compilers that compile themselves and code that documents itself (like Donald Knuths "Literate programming") and data structures that can contain themselves and functions that call themselves. And recursive acronyms like GNU etc. You wouldn't believe the rubbish that was written about recursive functions, as if they were going to somehow save the world. Q: So how can we improve naming? A: Well, the web has a universal naming system and it seems to work OK. Maybe we could adapt that. Q: Have you ever written something that compiles itself? A: Glad you asked. Yes, pep:nom and it does it in the most multifaceted way. Q: So you've got a naming system and a universal stack-based virtual machine. What next? A: Get rid of operating systems. Q: What??? We need them! they do all sorts of amazing things that I don't understand like "managing my hardware". Also, they let me multitask and switch between my only-fans account and my stock-exchange predictor which is based on these incredible regular expressions that I wrote. A: Without an operating system, computers would boot up so fast that you could turn it off-and-on again when you want to switch between "legitimate" activities. Q: That doesn't sound very practical, and besides, I have been told that I need an operating system and that's the end of the story. This sounds like Communism or something. Next you will tell me that I dont need a web-browser? A: How did you guess? Q: Because we are the same person. You are a dangerous pot-smoking radical who needs to time-travel back to the 60's and stay there. So, anyway why are browsers bad? (If I wasn't you I wouldn't be bothered to ask that) A: Thanks for asking. Browsers aren't *bad* they are just silly. They were designed to display a bit of bold and italic text, a few hyperlinks and those lovely <tables> that they still haven't managed kill-off despite millions of hours of W3C committee meetings. And you wouldn't believe the rubbish that was written about hyperlinks as if they were as interesting and important as hyperspace. Q: But browsers are great for internet banking, no? A: Well... the thing is... that the bank didn't write any of the code in the browser, or any of the code in the operating system for that matter, so that makes a lot of code the bank has absolutely no idea about. Q: And? A: Have you heard of the phrase "What can go wrong, will go wrong"? Q: Way too many times. It's a dumb cliche that overly timid people trot out at every opportunity. Microsoft Windows has thousands of geniuses working on it. Of course it is secure. A: The geniuses are the ones you've got to watch out for. Anyway, lets just say, that there's a lot of potential null pointers and what not, and wouldn't it be better to do your internet banking on a platform that is more or less understandable? For example, A bit of tcp/ip code combined with a few protocol messages to the banks servers and that's all. What more do you really need? I mean, you could probably write that in about 100K of code or less. Q: what about SSL or SSH or whatever? A: No idea what that is, but it sounds like something to do with security, so yes, you probably need to encrypt stuff in a way that the Israeli's can't sell your log-on to that weirdo "prince" from Saudi Arabia. Q: Doesn't sound like you have really thought this through? A: Not true. I mean you can have SSL without an operating system or a web-browser. Just like you don't need systemd to create a colourful pixel animation. Q: Are you just trying to sound techy? A: Yeah, but it's still true. Go into a book-store and try to find a old computer where you can search the catalogue without having to open a web-browser. I mean, its a local catalogue of the books that are currently in that store. Why do I need a web-browser and an operating system for that? I am not going to be alt-tabbing to my only-fans account in the bookstore. Q: I don't think we are getting anywhere. Time to cycle home no? A: OK but I am still right. Simplicity is king.
The point of this rambling, unread and unreadable blog-post, is that I am going to be concentrating on other things in the coming months, probably trying to develop 4 apps with a team of smart ambitious young coders from a country where nobody gets paid very much (Colombia might be a good option) (whom I haven't found yet). The four apps will be written in Dart/Flutter and will probably be called something like:
fins aviat M