Next: , Previous: Conceptual Overview, Up: Top



4 Parsing

Obviously, this sort of functionality is a little tricky to achieve, so here's how we do it.

When a player enters a command, it is parsed by a parser appropriate to their language. The command is parsed into a command word(s) and numbered arguments. Other grammar words are thrown away. The parser then asks around for an object willing to proccess the command given. On each object, the verb records are then used to map the command word(s) to a method on the object and to map the numbered arguments to arguments to the method.

The method is then called with these arguments, and an argument specifying the language the request came in. Normally, the language argument should only be used to pass on to other methods. In particular, for example, the word for 'door' is very different in lojban, so the method for the 'open' command (which will be the same method for both languages, as the same functional thing is being done) will need to pass the 'door' or 'vorme' argument on to a method that looks for an object of that name; that method will need to know what language it should be using to do name comparison.

If the method is happy with the arguments (i.e. the open command on a door will accept the example given, but the open command on a jar will not), it returns an indication of same and the parser stops proccessing. Otherwise, the parser moves on to the next object.

All strings in the MOZ should use the string record format that allows for multilingualism, which is another use for passing language information to methods: they can then output strings in the appropriate language.

In case of failing to find language information, the MOZ will fall back to a default which can be set by a wizard, and which starts at English. If the default can't be found, the first language for which the appropriate information can be found is used. If that fails, an error results.