5 ms·
A Common Lisp Interpreter Built in Cobol
- hprotagonist 8y agoThis is so delightfully insane. I love it.
- simonblack 8y agoThat's how felt about my 8080 disassembler written in COBOL back in the 80s. <grin>
- chris_wot 8y agoHow the hell did you do that?!?
- simonblack 8y agoIf you like I'll post the code. <grin> Only 35 years ago. A few lines from the beginning .... 000010* This program is written in NEVADA COBOL . 000020 000030 IDENTIFICATION DIVISION. 000040 000050 PROGRAM-ID. JACKS-DISASSEMBLER. 000080* Version Number 1.0 000100 000110* AUTHOR. simonblack. 000120 000130* INSTALLATION. Giacomo Software, P.O. Box 584, Hamilton, 3300 000140 000150 DATE-WRITTEN. 29 MARCH 1984. 000160 000170* 000180* THIS PROGRAM PREPARES * 000190* AND DISASSEMBLES INTERMEDIATE PSEUDO-CODE FILES * 000200* INTO 8080 ASSEMBLY LANGUAGE. * 000210* * 000220* 000230 000240 ENVIRONMENT DIVISION. 000250 000260 CONFIGURATION SECTION. 000270 SOURCE-COMPUTER. 000280 CPZ-48000-SBC. > wc /a/comp/development-jvs/cobol-150623/crak80.cbl 293 1121 10002 /a/comp/development-jvs/cobol-150623/crak80.cbl >
- chris_wot 8y agoSeriously, put this on github.
- simonblack 8y ago<grin> Nobody bothers about the 8080 these days. If it had been a disassembler for the Z80, it might be a different matter. But there's dozens of those around, and written in C to boot.
- tombert 8y agoSerious question; outside of purposefully eccentric stuff, does anyone use COBOL for anything new?
- EamonnMR 8y agoThe answer has been "no" for a long time. Once people got excited about Algol they started basing languages on the idea of inline math/expressions. FORTRAN survived by changing; COBOL was mostly abandoned.
- pjmlp 8y agoOn the contrary, modern COBOL supports OOP and there are even compilers for .NET and Java. Naturally no one is writing greenfields applications, rather incrementally refactoring existing codebases.
- TomMarius 8y agoDepends on your definition of new. New business logic certainly is still being written in Cobol.
- protomyth 8y agoOften because of legislation such as new tax codes or new contracts
- mhd 8y agoNew parts of old systems, mostly. There are some huge COBOL application spaces out there, and quite often writing new modules for that with a more modern COBOL mind- and featureset is still easier than writing it with a different technology and then taking the trouble of connecting that to the existing part using eg CORBA.
- mrighele 8y ago> Due to COBOL's lack of functions and recursion, the recursion required for Lisp is built from the ground up using file processing. Does this mean that they are storing the stack as records on a file ? Hopefully they will implement tail recursion as soon as possible :-)
- dan-robertson 8y agoDrives are large so there’s less reason for tail recursion if you stack lives on disk anyway. Also Common Lisp does not require tail recursion and the traditional style doesn’t really use it either
- mrighele 8y agoI was thinking more about performance than space. If you hit the disk for every recursive call (not sure if it is the case, I can't read COBOL) the performance is probably going to be terrible even if the files are memory mapped. Optimized tail recursion would avoid most of that.
- agumonkey 8y agodefine callcc { cp ./stack ./stack.old ; }
- ww520 8y agoThey can definitely implement garbage collection with copying. Just copy all the live objects to another directory and then "rm -fr old-heap."
- flyinghamster 8y ago> Due to COBOL's lack of functions and recursion Wait, what? Someone forgot about the PERFORM verb. Or, are they writing this in an old enough version of COBOL for that not to be present?
- rst 8y agoPERFORM was in the original 1960 COBOL spec -- but attempting to use it recursively was (and may remain) undefined behavior.
- ngcc_hk 8y agoShock, amazed. Anyway 2 years ago.
- nopacience 8y agoGreat you have done in cobol! Please now do it in "brain fuck language"
- sbuttgereit 8y agoFor no good reason, this comes to mind... https://m.youtube.com/watch?v=wx8CEy0yMSY https://m.youtube.com/watch?v=wx8CEy0yMSY
- bluefox 8y agoMore like a very primitive Toy Lisp interpreter.
- bjoli 8y agoI thought so as well. Nobody would call a python-like language "a python". I understand that the balkanisation of lisp is responsible for the fact that anything s-expr based is called a lisp. But, common lisp and scheme are actual, specified languages.
- coldtea 8y ago>Nobody would call a python-like language "a python" Unlike Python, Lisp is not "batteries included". The original and standard definition of Lisp is the handful of special forms in McCarthy's paper. Dev didn't say they made a Common Lisp -- just a Lisp.
- stevelosh 8y ago> Dev didn't say they made a Common Lisp -- just a Lisp. The first line in the README after the title is: > A Common Lisp Interpreter Built in COBOL.
- coldtea 8y agoTrue that, though Common Lisp interpreter is not full Common Lisp e.g. "Common Lisp + its tons of standard libs" -- just "interpreter able to parse Common Lisp".
- lispm 8y agoSee 'language subsets' in the Common Lisp standard. http://www.lispworks.com/documentation/lw50/CLHS/Body/01_g.htm http://www.lispworks.com/documentation/lw50/CLHS/Body/01_g.h... Roughly: A language would be a subset of Common Lisp, when all programs in that language are valid standard Common Lisp programs.