PDA

View Full Version : A couple of questions on ZScript's design.



Revfan9
03-24-2009, 06:47 AM
These questions are geared more towards the developers, although if anyone else can answer them that'd be fantastic as well.

1. Why, for ZASM, does there have to be 2 instructions for each operation, one for static values and one for registers? Ex. ADDV and ADDR. In my mind at least, it would be easier to implement values as being static, and registers as being variables that point to values. Was it for compiler optimization reasons? A hack to get around ZC's architecture? Or was it a design decision (Registers are used like addresses in memory rather than as variables, and thus referring to a "pointer" requires different syntax than just referring to a normal value)?

2. Why was ZScript designed as a clone of C, a procedural language, when the context under which the language is meant to be used could very clearly benefit from classes? (I myself have complained about this before, esp. with the akwardness that is "This->") Was it due to the developers working on it having more experience with C? Was it to be able to "borrow" compiler optimization techniques from projects like GCC? I'd really like to know this one.

I'd like to know the answers of these questions because they pertain to a project I am working on whose details I am not yet ready to discuss.

pkmnfrk
03-24-2009, 07:51 AM
2. Why was ZScript designed as a clone of C, a procedural language, when the context under which the language is meant to be used could very clearly benefit from classes? (I myself have complained about this before, esp. with the akwardness that is "This->") Was it due to the developers working on it having more experience with C? Was it to be able to "borrow" compiler optimization techniques from projects like GCC? I'd really like to know this one.

I'd like to know the answers of these questions because they pertain to a project I am working on whose details I am not yet ready to discuss.

Though I have absolutely no business responding here, I'll hazard a guess that it's because C is rather easy to parse. Having recently created a compiler for such a pet-project, I found it easy to build the compiler, and extend the syntax the way I needed it to.