Questions tagged [modula-2]

Modula-2 is a procedural programming language, created as a revision of Pascal. It was intended to fix shortcomings of Pascal which its designer, Niklaus Wirth, intended only as an instructional language. Modula-2 supports separate definition and implementation modules, coroutines, data abstraction, machine access support, and an extensive standard library for I/O, math, etc.

The Stack Overflow use of this tag is for questions related to any dialect or superset implementation of Modula-2.

The language and library documentation is the book Programming in Modula-2, 3rd edition, Springer Verlag, Berlin, 1985, by Niklaus Wirth. ISBN 978-0387116747

The Wikipedia article links to over two dozen implementations, four dialects, eight supersets, and eight derivative languages.

18 questions
3
votes
1 answer

How does Oberon's object oriented model differ from standard OOP?

I've been reading Wirth's books on Oberon--or at least trying to--and I'm hitting a mental road block when it comes to figuring out what is going on regarding object oriented programming in Oberon. I know his method is supposed to simplify object…
clay
  • 1,757
  • 2
  • 20
  • 23
2
votes
7 answers

Modula-2 Developer?

Guess no new project is implemented in languages like Modula, Ada , Oberon .. anymore (right?). But still there are legacy systems floating around, popping out here and there looking for their creators. They cant find them because they might be…
javadude
  • 1,763
  • 1
  • 19
  • 38
2
votes
2 answers

Why are module and procedure names repeated after the body?

In Modula-2 and Oberon each module and procedure declaration must end with the name of the module or procedure. It is not needed in Pascal. I have never really understood the motivation for this. Can someone enlighten me?
August Karlstrom
  • 10,773
  • 7
  • 38
  • 60
2
votes
0 answers

Modula-2 Word Frequency Counter

What I am trying to do is create a Modula-2 program that takes a file and returns a number of words in the read file as well as the frequency of each word that is read. Like if a file said, "The fox fox fox jumped over the lazy dog." The output…
Jason
  • 23
  • 2
2
votes
2 answers

Shortest REPEAT statement Modula-2

I'm doing a homework assignment in which I have been provided a snippet of text titled "EBNF Description of Modula-2's Syntax" and the question asks: "Give an example of the shortest REPEAT statement in Modula-2. ('Shortest' means fewest number of…
Ryan Tibbetts
  • 412
  • 1
  • 8
  • 22
1
vote
1 answer

Importing modules with gm2

I am doing a little programming exercise in Modula2. I am using the gm2 compiler on Ubuntu Linux (10.04). I have gotten some code to compile but I am unable to import certain modules which, to my understanding, should be included in the compiler…
Giorgio
  • 5,023
  • 6
  • 41
  • 71
1
vote
1 answer

Address of 32 bits integer in Modula-2 on a Big Endian architecture

I have this line of code in modula-2 on a Big Endian processor : Ptr := ADR(My_32_Bits_Integer) I want to know if Ptr will be equal to the adress of the most significant byte (so the littlest address) or the less significant byte (so the biggest…
backlash
  • 777
  • 1
  • 6
  • 12
1
vote
1 answer

shortest record type in Modula-2

Homework assignment 1. Give an example of the shortest record type in Modula-2. (“Shortest” means fewest number of lexemes.) EBNF definition of RECORD RecordType = RECORD FieldListSequence END. FieldListSequence = FieldList {“;”…
john r
  • 21
  • 3
1
vote
0 answers

Rotating pictures

I am currently programming a Tower Defence game for university and i stumbled upon a problem: i want my towers to rotate towards the monster it is shooting at. The towers are bitmaps and we are supposed to program in a language called Modula 2: If…
Samuel
  • 18,286
  • 18
  • 52
  • 88
1
vote
2 answers

How to set sublime-text to always show auto-complete suggestions

The code completion feature works really well when I type Java code, but I've recently made a build system for Modula-2, and while the auto-complete works when I press ctrl+space, it doesn't suggest the words on it's own. I have to hit ctrl+space…
programstinator
  • 1,354
  • 3
  • 12
  • 31
0
votes
0 answers

How do I make Windows check boxes work on click?

I've been afraid to ask as I'm sure the answer is very simple, but I've been bashing my head against the wall for several days on this one simple thing now and am making no forward progress. I have a basic window with a checkbox inside of it like…
Brian Knoblauch
  • 20,639
  • 15
  • 57
  • 92
0
votes
0 answers

Random numbers from Win32 API?

Working on a Win32 API GUI application in Modula-2 (ISO) and there does not appear to be a way to generate random numbers in the libraries. Before I roll my own PRNG (for fun simulation purpose only, does not need to be cryptographically sound), is…
Brian Knoblauch
  • 20,639
  • 15
  • 57
  • 92
0
votes
1 answer

Fatal error (13): No program entry point with XDS Modula-2?

I'm using the current bundled binaries from https://github.com/excelsior-oss/xds (as of 12/6/2020) with just the most basic Hello World MOD file: MODULE HelloWorld; FROM STextIO IMPORT WriteLn, WriteString; BEGIN WriteString("Hello, World!"); …
Brian Knoblauch
  • 20,639
  • 15
  • 57
  • 92
0
votes
1 answer

Type equivalence in Pascal-like languages

The Oberon-2 language report "The Programming Language Oberon–2" has the following definition in appendix A: Two variables a and b with types Ta and Tb are of the same type if Ta and Tb are both denoted by the same type identifier, or Ta is…
August Karlstrom
  • 10,773
  • 7
  • 38
  • 60
0
votes
1 answer

Modula-2: how to assign a procedure to a pointer?

I am stuck with the assignment of a procedure to a pointer in Modula-2. PROCEDURE print(node : Node_ptr); BEGIN (* some code *) END print; TYPE Node_ptr = POINTER TO Node; TYPE Visit_ptr = POINTER TO PROCEDURE (Node_ptr); TYPE Node =…
c4bbage
  • 113
  • 3
1
2