Earlier quoted context omitted.
Isn’t structure lost in the compilation process? I mean, we already have bits and pieces of what you want, like an assembler to C decompiler, but the output isn’t very nice without the types. And how many languages can run on the CIL in dotnet. Say we create a CIL to lambda calculus compiler. Where do we go from there?
A CIL to LC compiler is effectively an emulator of CIL in LC. That is, every primitive of CIL has a corresponding LC term, which operates on the CIL execution state. So then you can express functions from .NET standard library as terms in LC. Now let's say you do the same for JVM. Now you can start looking at all these lambda terms and search for some similarities. For example, you might notice that some list functio…
Forth: The programming language that writes itself
171–174 of 174 posts
Re: Forth: The programming language that writes itself
#172Earlier quoted context omitted.
> splitting a line into words is a whole project on its own Is it[1]? My version below accumulates alphabetical characters until it encounters a non-alphabetical one, then increments the count for the accumulated word and resets the accumulator. (let (c accumulator (counts (make-hash-table :test #'equal))) (handler-case (loop (setq c (read-char)) (if (find c "ABCDEFGHIJKLMNOPQRSTUVWXYZ" :test #'char-equal) (push (cha…
Hey, this is great! Thanks! It does look a lot like what I was thinking would be necessary. About 9 of the 19 lines are concerned with splitting the input into words. Also, I think you have omitted the secondary key sort (alphabetical ascending), although that's only about one more line of code, something like #'(lambda (a b) (or ( (cadr a) (cadr b))))) Because the lines of code are longer, it's about 3× as much code…
Were I trying to optimise this, I would test to see if a hash table of alphabetical characters is better, or just checking (or (and (char>= c #\A) (char= c #\a) (charAlso worth giving it a shot with (optimize (speed 3) (safety 0)) just to see if it makes a difference.
Yes, definitely more verbose. Perl is good at this sort of task!
Re: Forth: The programming language that writes itself
#173Earlier quoted context omitted.
What would your top two tips for beginning Forth programmers be? Other than "don't use Forth".
Find an existing implementation that runs on some computer you already have, or have an emulator for. Then find a computer you're really into, and port fig-Forth to it, just for fun. Don't copy the source across, type it in with your own changes as you go. Edit: Don't forget to have fun. That's the most important thing. You're doing this because you *can*, and just to see what will happen.
Re: Forth: The programming language that writes itself
#174Forth is lisp in reverse, without the parenthesis. Which, as a big fan of piping things sounds really sweet.