News for hackers. Stuff that matters.

murisitarusenga

Thanks. No, no further plans at the moment. I just wanted to see what a program in L2 might look like.
I designed a programming language, L2, a while ago by stripping C down to a minimal core and adding Lisp-style procedural macros to it. In addition to the original bootstrapping compiler written in C, I've now built a self-hosting compiler for it.
Re:Show HN: Strictured Programming [pdf] on Saturday April 07, 2018 @12:30PM (#16781424)
What is linked is an experiment where I construct programs according to certain rules. While I do not list what these rules are, imagine the sort of rules that constrain one when making a mathematical proof.
Thanks.
My conjecture is that through studying the linked algorithms (as you would a math proof), one can learn a decent amount of linear algebra.
Though you jest, Forth did influence certain decisions in L2's design. In particular, by using continuations you can make an L2 function temporarily leave a variable amount of data at the top of the stack in order for the caller or some other function to use.
I will try to read into the details of Scheme's implementation of continuations...

The reason I made the claim about efficiency is because Scheme's continuations have an unlimited lifetime. This is in contrast to L2's continuations that can only have a dynamic lifetime. (The rules for manipulating continuations in L2 are analogous (and only analogous) to the rules for returning the addresses of local variables in C.) So I just assumed that Scheme implementations must occur an overhead for the greater generality of their continuations.

Thanks for the link. I am not sure if I see the similarity. L2 neither uses the heap nor garbage collection nor are its programs converted into continuation-passing-style. Am I missing something?
Thank you. I personally struggled to understand Scheme continuations from their English descriptions, so I made a point of including concrete implementation details in my write-up.

Thank you for the link to PreScheme. It seems to have exactly the same goals that I was aiming for. I will look into it.

I'm not sure if this is correct. Googling fexprs takes me to this Lambda the Ultimate post: http://lambda-the-ultimate.org/node/3640#comment-51665. There it says that fexprs map from s-expressions (of the operands to fexpr) to a value (which replaces the fexpr call). L2's macro system does not do this. L2 maps from s-expressions (of the operands to the macro) to s-expressions (that are supposed to replace the macro call).
I'm not sure of the exact definition of a runtime... The best I can say is that the instructions emitted by the compiler correspond directly to the commands in the source file.

You are certainly correct about the Lispyness. I've not yet had the opportunity to use a macro assembler, so I cannot say how similar L2 is to it. To aid your comparison, I think L2 is also quite similar to B language.

L2 is an experimental programming language that maps efficiently to machine code (like C). I think it is interesting because I have not seen 1) control flow primitives that are like Scheme's continuations but that are also efficient 2) L2's variant of s-expressions that do not need a symbol or string data type 3) a macro system that is equivalent to but operates differently from Common Lisp's