gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Escape sequence in gm2


From: Benjamin Kowarsch
Subject: Re: Escape sequence in gm2
Date: Tue, 24 Mar 2020 22:24:24 +0900

Neither Wirth's PIM Modula-2 nor ISO Modula-2 support backslash escape sequences.

Instead, octal literals suffixed with 'C' are used to denote character codes.

DEFINITION MODULE ASCII;
CONST TAB = 011C; (* '\t' *)
CONST NEWLINE = 012C; (* '\n' *)
END ASCII.

then use ...

IMPORT ASCII;

... and ...

WriteChar(ASCII.TAB);
WriteChar(ASCII.NEWLINE);

The common standard libraries usually include a module ASCII with character code definitions.

PS: As an aside, most of the issues you raised in your various posts are addressed in our Modula-2 revision which I believe Gaius intended to support at some point in GM2. Unfortunately, due to circumstances that have to do with putting food on the table and having a roof over my head, i had to take time off from working on our own compiler (https://github.com/m2sf/m2bsk) for all of last year. With a bit of luck I might be able to get back to working on it this summer. Meanwhile, the classic dialects are all there is, even if somewhat outdated.

On Tue, 24 Mar 2020 at 22:06, Hưng Hưng <address@hidden> wrote:
I searched the web many times but found nothing. In C we use a backsplash to represent newline, tab, backspace... but when I use ORD('\n'); in gm2 it always complain that the conststring must be have length 1, it means it only accept one character and doesn't understand the backsplash. Please help.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]