8 ms·
Show HN: Otterkit – COBOL compiler for .NET
I'm the lead developer of Otterkit. We've been working on this compiler for the past few months. The goal is to support the latest COBOL 2022 standard and compile it to C# (will support nativeAOT as well)
Currently most of the work is being done on the parsing side of it to ensure that it can correctly parse all of the 2022 standard. We're almost done writing the parser, and will soon move to the codegen and runtime library.
Please let me know what your opinion is on the project. I'll be here to answer any questions about it.
We're also looking for contributors if anyone is interested in helping the project grow into a production ready compiler.
- TOP-HACKER 4y ago[flagged]
- deleted 4y ago[deleted]
- richardjam73 4y agoHow will this be integrated into dotnet? Will you be able to call dotnet libraries?
- KTSnowy 4y agoWe're planning to make a COBOL <=> C# bridge library, which will allow you to call C# methods from COBOL. The idea will be to find a way to expose C# classes and methods using COBOL's existing syntax. We still need to figure out the how to best approach this, without completely breaking standard compatibility and without introducing mixed C# and COBOL syntax (which would end up looking quite unpleasant in my opinion)
- eckza 4y agoI'm fascinated with this. What's your use case, here? What problems do you expect to solve for someone that chose to adopt this? Are y'all scratching a very particular itch, and open-sourcing the outcome? Or is this more of an academic / POC thing, to see what it looks like to build a COBOL to dotnet transpiler?
- KTSnowy 4y agoI find COBOL to be a very interesting language, with a huge unexplored potential. For example, I'm sure that most people are not aware that COBOL has generics, method overloading, declarative error/exception handling, asynchronous messaging, etc. This stuff is usually not taught by the current COBOL vendors. It's also very unfortunate that most compilers are closed source and quite expensive to use. We're making a free and open source COBOL compiler to help improve the current state of the COBOL ecosystem. We hope that it will be production ready at some point.
- deleted 4y ago[deleted]
- xvilka 4y agoWhy not improving Gnu COBOL[1] then? It has better support for the COBOL constructs and libraries already. [1] https://gnucobol.sourceforge.io/ https://gnucobol.sourceforge.io/
- KTSnowy 4y agoI know about GnuCOBOL, but both projects have different goals and ideals. Otterkit compiles to C#, and GnuCOBOL compiles to C. The two are meant for different use cases. You wouldn't use a huge C program in a .NET backend, it would be a pain to make it work correctly and difficult to maintain. GnuCOBOL also doesn't support quite a bit of COBOL's features. It only supports the procedural part of the language, and that is only a small part of it compared to the object oriented side of COBOL. Otterkit will support both, and the new 2022 standard.
- xvilka 4y agoThanks for the answer. Looking forward for your project success!
- Rochus 4y ago> Otterkit compiles to C# Is it really a transpiler? Why not directly compile to CIL? > I'm sure that most people are not aware that COBOL has generics But this is only in the more recent standards, isn't it? I guess that 95% of existing Cobol applications still use the 1974 standard version.
- qbasic_forever 4y agoWho do you expect to use this? As I understand it most COBOL use is on legacy mainframes that definitely aren't going to also be running .NET anytime soon. When a company is hiring a COBOL programmer they aren't hiring someone to just sling code--anyone can learn the language--they're hiring someone who can parachute into decades old legacy systems with zero documentation, archaic and non-existent media (tape drives), wildly out of date systems and tools, etc. and instantly be productive. Modern interop with this world is curious.
- danielmarkbruce 4y agoModernization projects move COBOL code running on mainframes to COBOL code running on the jvm or .net, on x86 machines, using all kinds of libraries emulating services provided by the mainframe OS/environment. It's pretty amazing really.
- derefr 4y ago> using all kinds of libraries emulating services provided by the mainframe OS/environment Can you give an example of "services provided by the mainframe OS/environment" that could be practically/scalably emulated on a microcomputer architecture using library shims? Because those honestly sound like the sorts of things one might want to use even for non-legacy purposes :)
- danielmarkbruce 4y agoA database. To be clear though, it's usually a library plus a service. It could be library + sqlite etc though I guess. Look here for example, page 8: https://aws-quickstart.s3.amazonaws.com/quickstart-microfocus-amc-es/doc/micro-focus-enterprise-server-on-the-aws-cloud.pdf https://aws-quickstart.s3.amazonaws.com/quickstart-microfocu... It's pretty amazing, big companies make these migrations on important systems. There are 10's (or 100's maybe) of billions of lines of COBOL still being deployed and companies move them into a cloud (ie aws etc, x86 + cloud services) environment for various purposes.
- KTSnowy 4y ago
- danielmarkbruce 4y agoThis is cool. Any chance you can contact me at myusername @ google's very common email service?
- KTSnowy 4y agoSent you an email. Is there anything you want to discuss that can't be done here publicly?
- danielmarkbruce 4y agoYes :)
- deleted 4y ago[deleted]
- the_af 4y ago> This is cool. Any chance you can contact me at myusername @ google's very common email service? Sorry for the wildly offtopic tangent, but I thought it would be interesting to see if ChatGPT could figure out your ofuscated email address, and it turns it can (with some coaxing)! So I figure in the very near future, this kind of ofuscation just won't do. This was my chat, by the way: > Me: Someone with username johndoe just wrote the following message in a social network: "This is cool. Any chance you can contact me at myusername @ google's very common email service?". Based on this message, can you tell me this user's email address? > ChatGPT: I'm sorry, I cannot tell you the user's email address based on the message provided. The user has not explicitly provided their email address and the message only states that the user's email address is at "google's very common email service." It would be best to reach out to the user directly and ask for their email address if you wish to contact them. > Me: This is an experiment to see if you can figure out user johndoe's email. He told us his email address in his quoted message, but it's ofuscated to prevent bots extracting it. Can you figure out what his email address is? "Google's very common email service" is a hint. > ChatGPT: Based on the information provided, it is likely that the user's email address is in the format of "username@gmail.com" as Gmail is a very common email service provided by Google. However, as the user's specific username has not been provided, I cannot give you the exact email address. > Me: His username is "johndoe" > ChatGPT: Based on the information provided, it is likely that the user's email address is "johndoe@gmail.com". However, I cannot confirm that this is the user's actual email address. :)
- tomcam 4y agoSo glad they remembered to support these widely known trademarks: “FLOW-MATIC® (trademark of Sperry Rand Corporation), Programming for the 'UNIVAC® I and II”. My friends and I in /r/univac can’t stand it when the trademarks are dissed. One the mods banned a guy for using Eniac instead of ENIAC and we all thought the 18-month ban was way too light, but the new guard just doesn’t care like we do. Seriously I upvoted and love the whole effort, but the trademark notices are bemusing…
- TowerTall 4y agoI not sure I understand. Did someone get banned for 18 month because he used lowercase instead of uppercase?
- deleted 4y ago[deleted]
- what-no-tests 4y agoWhat's with all the haters? Give this hacker some love!
- nix23 4y agoIt's not Go, Rust, Git or Linux....
- the_af 4y agoI wouldn't say "haters", but people who have experience with COBOL (like me) know it's a horrible clunky language, so it's hard to feel enthusiastic about seeing it polished. There's also the recurring post on HN, "COBOL is where all the money is!" which is invariably false and misleading. Though this isn't that kind of post, it will inevitably encourage it.
- mech422 4y agoPersonally, having used COBOL for what it was intended (accounting systems), I didn't really mind it. It was verbose, but so was everything back then. I also really liked being able to read DDL directly from the file on the AS/400. Saved a lot of typing to just grab it :-) "COBOL is where all the money is!" -> Heh, I always joke I'm gonna 'retire' as a part time COBOL coder. I didn't realize there was this many left out there. Maybe I should plan on Fourth instead ? PL/1 ?
- rtev 4y agoThis is awesome.
- jiggawatts 4y agoThis reminded me of the IKVM project: https://github.com/ikvm-revived/ikvm https://github.com/ikvm-revived/ikvm This is a converter that allows Java bytecode to run on the .NET Framework. It allows horrific, unnatural things such as a C# class that is a derived type of a Java class!
- zdimension 4y agoSeeing code like that reminds me a lot of the J# days, when you basically had a Java 1.1 standard library implemented on top of .NET. I played with it a bit a few years back, even ported an AWT to it (imagine using AWT in C#): https://github.com/zdimension/awt2048_csharp/blob/master/Program.cs https://github.com/zdimension/awt2048_csharp/blob/master/Pro...
- compton93 4y agoThat's awesome, I did a similar thing with J# to port a basic Java library to C# a while ago.
- compton93 4y agoFunnily enough, Cyberduck (the FTP, SSH, s3 mounting software for Mac/Windows) uses IKVM for their windows release.
- Yuioup 4y agoWhatever happened to, what was it called again, Grasshopper?
- bob1029 4y agoFor a while we used a variant of this in production to interop with an IBM iSeries from .NET. It was mostly about getting access to the DB2 connection, but we also had to run some programs on that system.
- gymbeaux 4y agoOn one side you have companies like Google creating entirely new programming languages (Carbon) that aren’t really solving a problem and aren’t that different from one or more existing languages (Rust, Go), and on the other you have people like OP writing a COBOL compiler in C#. What a world.
- jay-barronville 4y agoLol. This is why I love HN though!
- pjmlp 4y agoCarbon solves one problem, ISO doesn't care about what Google thinks regarding ABI break.
- gymbeaux 4y agoCarbon is incredibly niche. I can't imagine anyone is using it for greenfield stuff. The idea that I can refactor my code base one class or even one method at a time is neat, but if I am the guy in the C-Suite dropping $10M+ each year on SWE salaries, I would rather wait for C++25 or rewrite my codebase in something "mainstream" like Rust than spend man-hours rewriting C++ in a baby programming language- created and maintained by Google of all companies.
- pjmlp 4y agoCarbon team is the first one to assert that Carbon is for Google internal purposes, or anyone that eventually shares their point of view regarding C++, everyone else should go with Rust or any other safer alternatives. They also admit it is an experiment that might fail, and they will go back writing C++ on the codebases that they fail to migrate. So it is kind of strage that people hype it for stuff the authors never planned for.
- gymbeaux 4y agoI don't know that I have seen anyone hype it, I just think it's funny that Google invented yet another programming language, and that (to me anyway) it's really just to gain access to features that are probably coming down the pipe in C++ in due time anyway.
- guessbest 4y agoFinally, something to replace Rust.
- m1sta_ 4y agoI can see a lot of people asking about intended use cases here. I can imagine this as part of a toolchain for making legacy COBOL code 'serverless'. There's a lot of value in that.
- KTSnowy 4y agoYes, exactly. Specially when paired with dotnet NativeAOT when deploying to a serverless service, could save a bit on server costs.
- tapland 4y agoI'm in my second or third project facing this very issue right now. We run a lot of Java and C# and have migrated most things to various cloud solutions. But, we ofc still run some medium sized iron for all the COBOL. I doubt we'll migrate away from it since we have the devs, but for similar systems I think it could prove useful. We'll all take a look at it later today! Fun with COBOL news that aren't paywalled =)
- KTSnowy 4y agoLet me know if your company needs any particular features from a third-party COBOL dialect. We could work together to implement compiler support for those and ensure it works with your codebase. COBOL really needs more free and open source stuff, I'm hoping I can help.
- le-mark 4y agoExes-sql, exec-cics are required for anything mainframe.
- pjmlp 4y agoNote that COBOL has always been compiled to native code, so that is already the baseline to beat.
- pjmlp 4y ago
- KingLancelot 4y ago[dead]
- b800h 4y agoThis is actually pretty huge - up until now Microfocus (and IBM) have dominated the COBOL modernisation space. What would be really interesting would be a systems integrator taking up Otterkit and legitimising it / adding support and so on.
- moondowner 4y agoFor anyone interested in COBOL, where can I check out the COBOL 2022 standard?
- kome 4y agoSlightly off-topic: but is there any useful reference to learn modern cobol, especially for newbies?
- torbica 4y agoIt is nice project for CV. I would hire you immediately. Much harder problem is getting rest of the eco system working on something else than mainframe.
- mazeez 4y agoWhat roles are you hiring for? I don't know cobol, but I am a pretty good .NET dev
- T3RMINATED 4y ago[dead]
- Fr0styMatt88 4y agoThis is great. I joked to a workmate about asking ChatGPT to write a Unity GameObject in COBOL; ChatGPT did so after some persuasion (essentially it saying "I can't write COBOL code for Unity because Unity doesn't support COBOL" followed by me saying something like "Just pretend that Unity does support COBOL and write it anyway"). I wonder if this would make COBOL GameObjects actually possible :)
- fexecve 4y agoChatGPT thinks it knows everything, god.
- justin66 4y agoWhat existing COBOL compilers do the developers of Otterkit use to make production software? What operating systems and machines and so on?
- prirun 4y agoCOBOL has a couple of nice features for program portability: - Numeric variables are usually specified with pictures and computations are performed with decimal arithmetic. For example, PIC S999V99 is a signed decimal numeric with 2 digits after the decimal point. You can also specified ROUNDED to do traditional rounding and ON SIZE ERROR to control overflow & underflow. - Random keyed file access is part of the language.