4 ms·
COBOL for GCC Development
- calypso 3y agoCOBOL on Dreamcast when?
- cozzyd 3y agoGlad to see gcc getting support for more languages! It's nice to be able to use the same compiler for everything (not that I use cobol, or plan to use it...)
- masom 3y agoPretty surprised to see this given GnuCOBOL (previously OpenCOBOL) has been part of the GNU project for a little while. https://gnucobol.sourceforge.io/ https://gnucobol.sourceforge.io/ It makes sense as OpenCOBOL isn't part of GCC as a front-end, it generates C code that is compliant to various COBOL standards and extensions. That C code can subsequently be audited and/or compiled with GCC/clang.
- jejones3141 3y agoHow does one debug with GnuCOBOL?
- ReleaseCandidat 3y agoUsing gdb. On the GnuCobol site you see a Screenshot of a debugging session in VS Code https://gnucobol.sourceforge.io/ https://gnucobol.sourceforge.io/ https://gnucobol.sourceforge.io/images/VSC_ScreenShot.png https://gnucobol.sourceforge.io/images/VSC_ScreenShot.png
- ReleaseCandidat 3y agoOh, I've mistakenly read that as "Develop GCC using COBOL". And this is not the existing GnuCobol compiler https://gnucobol.sourceforge.io/ https://gnucobol.sourceforge.io/
- deleted 3y ago[deleted]
- lmm 3y agoYeah it's a pretty unfortunate headline. Reads as "COBOL for (GCC Development)" when it's being used to mean "(COBOL for GCC) Development".
- Decabytes 3y agoI've heard that GCC is notoriously difficult to create a front end for and that is one of the reasons people liked using LLVM. Has this improved recently or are people just powering through the internal code to get this working?
- gumby 3y agoThis was one of LLVM’s explicit design criteria, but with its long head start gcc still has more front ends. It’s had so many that some (like chill) have even been removed! It’s not extraordinary that someone would use gcc as a back end for a new language.
- marshallward 3y agoI have only looked at the GCC Fortran frontend. I would not say it is necessarily difficult but rather very ad-hoc and disconnected from the rest of gcc. I don't see many tools for specifying a grammar or tokens. Instead, there are a lot of constructs custom-written to handle Fortran. Looking around, the Go and Rust frontends feel equally disconnected. I'm told that you eventually make your way to the "GCC IR", but it seems like you are largely on your own with how to get there. I did not invest a lot of time here, so I could be wildly off base, but thought I'd at least try to give a very-slightly-hands-on perspective.
- chasil 3y agoOracle Linux packages GNU COBOL in their EPEL distribution. The package is mature. https://www.gnu.org/software/gnucobol/ https://www.gnu.org/software/gnucobol/ $ rpm -q gnucobol gnucobol-3.2-1.el9.x86_64 $ rpm -qi gnucobol | tail -2 COBOL compiler, which translates COBOL programs to C code and compiles them using GCC. It will output intermediate C; one interesting thing is that the MOVE directive is mostly turned into memcpy(). I have been able to get the Oracle Pro*COBOL preprocessor to fully compile and run a demo database connection that connects to the "scott/tiger" schema and runs simple queries. Oracle packages both Pro*C and Pro*COBOL here (look for " Additional files for Pro*C and Pro*COBOL"): https://www.oracle.com/database/technologies/instant-client.html https://www.oracle.com/database/technologies/instant-client.... It built with the two commands: procob MODE=ANSI INAME=procobdemo.pco ONAME=procobdemo.cob cobc -x -fixed procobdemo.cob /instantclient_21_12/cobsqlintf.o /instantclient_21_12/libclntsh.so There is a similar "embedded SQL" implementation for PostgreSQL. https://github.com/opensourcecobol/Open-COBOL-ESQL https://github.com/opensourcecobol/Open-COBOL-ESQL There are a few other free COBOL compilers. http://mainframeking.blogspot.com/2012/01/free-cobol-compilers.html http://mainframeking.blogspot.com/2012/01/free-cobol-compile...
- mkovach 3y agoI want to look at the parser for the COBOL syntax, but I'm not sure if I'll ever be in a place emotionally to do so. Kudos to the folks that are writing the parser!
- marktangotango 3y agoParsing cobol is actually not bad. The grammar is pretty simple; the "rail road" diagrams correspond to the recursive descent parser very directly. https://www.ibm.com/docs/en/cobol-zos/6.1?topic=division-identification https://www.ibm.com/docs/en/cobol-zos/6.1?topic=division-ide...
- mkovach 3y agoInteresting, I remember it be harder than that. But, when I had to write a basic parser during the Y2K storm, I was still a bit green in my programming skillsets. Hmm, yea. I guess I'll have to take a look and see how they handled it. Thanks for the link!
- GartzenDeHaes 3y agoYeah, IFAIK it's not LL1, LL2, nor even LL3.
- gumby 3y agoTIL there is COBOL support in the DWARF standard. I wonder if this gcc FE generates it.
- SubjectToChange 3y agoDWARF supports quite a few languages: https://dwarfstd.org/languages.html https://dwarfstd.org/languages.html
- ChuckMcM 3y agoThis is pretty neat, I'm not a huge COBOL fan but actually got paid once to write code that generated outreach mail for political correspondence using voter registration data. For that, it worked really well and I could certainly appreciate the appeal for business process work. Weirdly though, I get put off by their name, as my brain wants to pronounce it with a long o sound instead of the 'eh' sound from 'works' (werx as a spelling works better for me than worx, no pun intended). It has me wondering if people pronounce 'Torx' screws as 'Turks' screws.
- jancsika 3y agoIsn't the first "o" is a long o? As for the 2nd "o", I don't know. Whatever the case, you should say the entire word slowly and loudly since they are all capital letters. Like, imagine yourself as an inept alien spy. You walk up to a group at a party and interrupt someone in the middle of their story. "HELLO, I AM BOB FROM CORPORATE. I PROGRAM IN COBOL. HOW ARE ALL OF YOU TODAY?" That's how you should pronounce it.
- jareds 3y agoHow much COBOL runs on platforms other then the Mainframe? My limited COBOL experience was while working for a Mainframe software vender. I have not scene anything about people running COBOL in production on non Mainframe platforms, doesn't mean it isn't happening though.
- pjmlp 3y agoThere is no .NET for mainframes, and yet, https://www.microfocus.com/en-us/products/visual-cobol/overview https://www.microfocus.com/en-us/products/visual-cobol/overv...