mathstodon.xyz is one of the many independent Mastodon servers you can use to participate in the fediverse.
A Mastodon instance for maths people. We have LaTeX rendering in the web interface!

Server stats:

2.8K
active users

#modula2

0 posts0 participants0 posts today

Well, I may have started #aoc2024 a day late, but I wrote a second implementation of a program to calculate the first part of day one in the CP/M version of Turbo #Modula2, which ran fine on #MSX: git.sr.ht/~aperezdc/aoc2024/tr — it
does take its time to run, but it does run!

Amusingly, Turbo Modula-2 gives me the vibe that it got a few things right that made it afterwards into Turbo Pascal. And it's pretty speedy for a compiler that generates native code on a 4 MHz-ish Z80.

My main complain so far is that there is no batch compilation mode, so every time I want to rebuild there's a few keystrokes one has to enter by hand. Granted, it may be automated using NTVCM's key file input flag, but then it's harder to see error messages.

And about error messages: we are spoiled by modern compilers. Turbo Modula-2 has reasonable error messages for the time, but they are abysmal compared to anything coming out of a compiler from the last twenty years. At least using the built-in editor will open the file at the approximate location of parsing errors. Amazingly, compilation may resume from the changed location onwards, incrementally, which I find mind-boggling for something that runs on 64 KiB of memory.

Thanks to Marc Poulhiès, @thesamesam and @mjw there is now a GCC full languages (C, C++, Ada, D, Fortran, Go, Modula2, Objective-C, Objective-C++, Rust and LTO plus libjit) with --enable-checking=yes,extra,rtl CI builder for builder.sourceware.org

builder.sourceware.org/buildbo

It does a bootstrap and runs all testsuites in about 2 hours, every 3 hours. All test results end up in bunsen.

#GCC, #C, #C++, #Ada, #D #Fortran, #Go, #Modula2, #ObjectiveC, #ObjectiveC++, #Rust, #LTO, #libjit

builder.sourceware.orgsourceware buildbotSourceware GNU Toolchain buildbot
Continued thread

Still playing with Modula-2. I now have a copy of Wirth's 3rd edition to help me.

The Pos implementation in the FTL 1.30 CP/M compiler is horribly slow if the substring being checked is longer than the string it's being checked against.

My solution for day1, part 2 of 2023's #AdventOfCode illustrates this nicely. There's a 30% speedup in execution time if you check for this condition before calling Pos, even though it needs additional calls to Length.

Fascinating!

Continued thread

Carrying on with my Modula-2 experiments. Managed to get Advent of Code 2023 Day 1, part 1 working before it was time for dinner. I'm not really grabbed by Modula-2 so far - it seems to have all of the things in it that I used to loathe about Ada, but without many of the positives. Oh well - I will carry on for a few more sessions and then perhaps start playing with Fortran90 - unless there's an epiphany forthcoming!

github.com/psychotimmy/aoc2023

GitHubGitHub - psychotimmy/aoc2023-cpm: Advent of Code 2023 - Turbo Pascal 3.01A under CP/M 2.2.Advent of Code 2023 - Turbo Pascal 3.01A under CP/M 2.2. - GitHub - psychotimmy/aoc2023-cpm: Advent of Code 2023 - Turbo Pascal 3.01A under CP/M 2.2.

Finally got a prime number generator working on FTL Modula-2 for CP/M today!

github.com/psychotimmy/RC2014

There seems to be some oddities in the compiler - especially when trying to combine a number of FLOAT/TRUNC and boolean comparisons into a single statement - not quite sure why at the moment. Makes the code uglier (and slower) than it needs to be.

Starting to get the macros defined for the common keystrokes in the editor, too. I never was a fan of EMACS though ...

GitHubGitHub - psychotimmy/RC2014: RC2014 programsRC2014 programs. Contribute to psychotimmy/RC2014 development by creating an account on GitHub.
Continued thread

Have abandoned Turbo Modula2 as I've hit the ANSI terminals bug - makes it unusable!

"My screen displayed the editor status line on line 1 AND ON line 19 or so. When I tried to move around the text, all cursor activity takes place under line 19, and so the editor, as it stands now, is just about worthless. No page displays, no scrolling, etc. That editor
functionality, just TP's, is the heart of the product."

computer-programming-forum.com

Trying the HiSoft product now ...

computer-programming-forum.commodula2, Turbo Modula-2 ANSI editor bug / Echelon, Inc.
Continued thread

Installed and working, with a "hello world" program compiled.

It's a shame Borland abandoned Turbo Modula-2 before it ever really got going ... seeing Version 1.00 at startup never fills you with a lot of confidence!

However, it's more successful than the current GNU Modula-2 compiler on a Raspberry Pi - which doesn't appear to work at all, sadly.

Replied in thread

@snafu Modula-2 was the language used at Universität Leipzig when I started taking the informatics course there in 1994. I liked it although the compiler we were supposed to use (Mocka for Linux on x86) was a barebones CLI tool that produced non-optimized binaries (and was never ported to the AMD64 platform).

Soon I got my hands on a copy of Topspeed Modula-2 from the makers of Turbo Pascal after they left #Borland. I think this great software is one of the reasons I stuck with MS-DOS longer than I should have, delaying my switch to GNU/Linux at home.

At Zentralantiquariat Leipzig, I bought a copy of #Wirth's Modula-2 book. I still have it. The cover is silver! archive.org/details/programmin

Later, I chose #Delphi to develop a DB driven Windows app in my first student job.

These days, Modula-2 is part of the GNU Compiler Collection. I just typed `apt install gm2` to try it. Not only can it produce optimized binaries – you can also use it to make #Python modules! gcc.gnu.org/onlinedocs/gm2/

Internet ArchiveProgramming in Modula-2 : Wirth, Niklaus : Free Download, Borrow, and Streaming : Internet ArchiveIncludes bibliographical references and index