Something to do with nanopasses

2004-10-11 11:14; in Adam's PhD Stuff, occam syntax, Education; 139 words

Matt also pointed me at "A nanopass infrastructure for compiler education" (if you have a Kent account, use chain to read that).

The idea of nanopasses strikes me as elegant because it'd be easy to write and test extensions to a language by inserting new passes. For instance, I sometimes find myself wanting a BREAK statement to immediately exit an occam loop. Since it's possible to rewrite:

WHILE continue.condition
  do.something ()
  IF
    exit.condition
      BREAK
    TRUE
      SKIP
  do.something.else ()

as:

INITIAL BOOL foo IS TRUE:
WHILE (continue.condition AND foo)
  do.something ()
  IF
    exit.condition
      foo := FALSE
    TRUE
      do.something.else ()

it would be fairly straightforward to drop in an extra pass to do that transformation automatically. You could implement CONTINUE and RETURN (with the Python semantics) the same way.

Doing this would offend the single-exit-point purists, of course, but they could always just disable that pass.

occamnet revamp

2004-10-09 20:34; in Adam's PhD Stuff, occamnet, Networking; 147 words

My third-year project was an IP stack for RMoX. In fact, I wrote it as a userspace process on Linux talking to the Linux IP stack using SLIP, and Fred later ported it to RMoX.

Obviously, it'd be useful to have a proper IP stack. occamnet as it currently stands has a few good features (I've done all the tedious stuff, like coming up with headers and writing code to do IP checksums properly) and a lot of bad ones (no TCP, at least one obscure bug in UDP, incomplete ICMP, dubious user API). Beating this into shape, and writing some network card drivers for RMoX so that it's actually useful, will be a useful project.

One of my specific plans is to make use of the new nested mobiles support to have a less clumsy representation of IP packets.

Here's the occamnet project writeup I did.

Categories

Contact: <ats@offog.org>

Copyright © 2004 Adam Sampson