-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduction? #3
Comments
Yeah, the first thing I want to know when investigating a new language is, what does the code look like. |
Hi @JeffreyBenjaminBrown, thanks for the feedback! I will certainly keep it in mind. Mirth is a work in progress and isn't close to being released yet. |
Ah. Did you know it's on Hacker News? |
Ah, yeah, I found out via Twitter 😅 |
I'll try to guess the semantics from the source example.
UPDATE: my wrong, there's lambda. With the mysterious |
Hi @suhr, to answer your questions (this isn't the right place, but...):
|
To follow up on this, what state is this in currently? I know that it's WIP, but about how usable is it in general? I'm pretty interested in the general idea behind it, but it's also a bit difficult to tell exactly how developed the language is. |
Hi @arabelladonna! Thanks for your interest! Mirth is a WIP, and it's really only available for fun and experimentation at the moment. Please don't rely on it in any serious way, because it is very unstable. I'm working on the first version of the Mirth compiler in Mirth itself. I think that should tell you a little bit about how much of the language there is (there's enough to write a compiler!) but also allude to the instability involved. There is a bootstrap interpreter for Mirth, implemented in Python ( If you are interested in exploring for yourself (caveat explorator!), you may find the Mirth files |
I just happened to get on GitHub to see that a "self-hosting low-level" version of Mirth just went up. I had a few questions:
EDIT: I found the post about the new compiler on the Patreon. So this is a more minimal language and the type system and other features aren't in yet? I also noticed that the compiler seems to just recompile itself at the moment (I was having issues finding code that might handle command line arguments), but I suppose you could theoretically replace |
Quite a bit different. The focus this time was to build a small low-level language to write a self-hosting compiler, while following the basic idea for Mirth. It doesn't have a working type system yet, but on the other hand, it does self-interpret and self-compile. Top-level code is interpreted at compile time, and it can invoke compiler procedures like
Linux + Windows support is something I'm planning to tackle next. Part of that will involve adding the ability to read header files (to some extent) and interact with C libraries. Right now this doesn't self-compile on Linux, because it's hard-coding some values for MacOS. That should be easy enough to fix for now. But I would be very surprised if it works against any sort of Windows–POSIX compatibility layer. My plan for Windows is to program against the Win32 API directly, but we'll see (I don't have any experience there, so I'm sure it will be a learning experience). Thanks for the tip about |
Yes. At the moment you could put your own code instead of Sorry for this terrible UI! It's really not ready for users! |
Thanks for the response. I will probably keep an eye out for Windows support and wait for that to be in before I start playing with the new implementation, then. I did notice that there's the |
It's merely informative for now, no part of the type signatures is currently being used. (That will change soon.) |
I see that there's a basic type checker and a basic form of FFI now. I went ahead and tested it in MSYS2 and got the snake example running. It seems like one could now mess with the language a bit, so I just had a few questions:
|
Very nice :-) I wonder if it will work in MSVC. I should try it.
There's currently no way to specify what build target you want, so the compiler outputs everything that is specified with an
Great question! The Examples are These are being ignored by the compiler right now, so they will likely suffer a bit of an overhaul once they start being enforced.
I think you can remove all of the contents from Happy hacking :-) (But please understand that the language is unstable, I may break your program.) (Note to self ... work on modules & improving the compiler interface. :-) |
Okay, I am absolutely sure that I'm just not understanding how something works (I've worked with Forth some, but not a lot), but I did what I usually do and attempted to recreate Project Euler problem 1 in Mirth to get a feel for it. I know that I could definitely do this in a more "idiomatic" Forth manner using only the stack, but I wanted to get a feel for how one would work with variables and whatnot in Mirth, so I did not do it in an "idiomatic" Forth manner. Here's what I've got:
It builds and runs, but never outputs anything. A few things I'm not sure about:
Update: As I was typing this, it hit me that it might be the New code (barely changed):
Error:
Line 4124 is the line with the beginning of the On another note, I assume that there's no way to work with C structs yet (due to padding)? Update 2: I got so bogged down in the type conversion that I forgot to increment EDIT: I realized I royally messed up the conditional and forgot to test against 0, so that's fixed now. New code:
Update 3: Ohhhhhhh. I think I get what the error is now. It's Update 4: Swapping the branches did not fix my error; it's exactly the same (though I suspect that that may have fixed an error that I would have encountered later?). Hrm. And it is pointing at the |
Hi @arabelladonna, you are very brave. :-) I'm going to try to help, but it's ok if you have more questions.
Probably
The You do need to supply both branches. Using
They are initialized to 0. :-) (Actually that's currently ensured by the various operating systems, and Mirth doesn't perturb that property. If at some point I port Mirth to an operating system where that isn't guaranteed, I will initialize the global buffers to zero on that OS.)
It looks like you are using it correctly to me. The convention in Mirth is, for example, This is the kind of bug the rudimentary type checker would catch though :-)
Mea culpa, Here's the type signature for the Why is this poorly designed? Well ... usually the condition you want to test will have to be repeated twice -- once before the loop and once after the loop. Further the test value isn't usually something you care about, so it doesn't make sense to have to drop it manually in the loop. I'm going to replace it with a 2-argument As for the error "failed to unify branches", it's a little confusing but it really is talking about the two branches of |
Okay, I've updated it and see that I need to use Now I've got the following, which looks a lot cleaner.
I understand the concept, but I'm still struggling with why it's telling me what it's telling me. I tried adding a |
You need to re-compute the condition at the end of the while. :-)
|
Ohhhhh. Maybe I didn't understand, heh. Going back and looking at other Thanks for the help. Now it's evident that I've made a critical error somewhere, though, as nothing is being printed, so I'll take some time and figure that one out. |
Ah, you may need to use |
@arabelladonna #61 fixes the while loop. |
Am I doing anything wrong in trying to use the new module system? I have the following code, which is updated from my previous example, and it looks like it should be fine, but it's not outputting a
The command I'm using is |
Hi Ari! The compiler doesn't take any command line arguments yet. Fortunately the fix is easy in this case: add an |
I'm surprised, as Mirth is strongly-typed, why not have a Boolean type? |
That's a temporary issue. It doesn't have a boolean type yet. :-) I'm trying to focus on improving the type checker before making too many more changes to the primitive types. |
Just saw the commit about the new syntax. How stable is it? |
I think it would be best to assume that nothing is stable at the moment. That said, the new syntax is actually the same as the old surface syntax from before we switched to a self-hosting compiler. This syntax is what I intend for the future (plus some additional flexibility to support pattern matching). |
This same thing (unexpectedly getting posted on HN/lobsters) happened to me for one of my languages too. The appetite for concatenative programming languages is really strong right now so I made a concatenative programming discord server. It's linked on the concatenative.org wiki. (Edit: Do please also support Mirth. The concatenative discord is more general and less exclusive than the Mirth discord that you can access from the project's patreon.) |
Mirth sounds great, but how can I get into it? In order of priority, I think it needs:
The text was updated successfully, but these errors were encountered: