linkrope / oberon2d

Oberon to D Translator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Oberon to D

This tool translates source code from Oberon to D. The translation is purely syntactic. In general, rework is required to run the translated code. Also, error handling is only rudimentary.

Usage

Use dub to build the tool:

dub build

Run the tool, for example, on Hello.Mod:

bin/oberon2d example/Hello.Mod

Save the translated code. Consider prettifying the code with dfmt:

bin/oberon2d example/Hello.Mod > hello.d
bin/oberon2d example/Hello.Mod | dfmt > hello.d

A separate main function must be provided to execute Oberon commands. The library code must be rewritten so that it adapts to D's standard library.

Build and run the example program:

dmd hello.d example/main.d include/*.d
./hello

The example shows, by the way, that Oberon uses floored division while D uses the more common truncated division. (For details, see Division and Modulus for Computer Scientists.)

About

Oberon to D Translator


Languages

Language:D 99.4%Language:Modula-2 0.6%