I've mentioned more about why the axiom as stated doesn't work in another post, but here let me talk about how to have an actual syntactic typecode for sets. If the current "set" typecode was renamed to "var", then we could call this typecode "set", but for now let's call it "Set" for disambiguation. Here is an axiomatization of it:
$c Set $.
sA $f Set -A $.
sB $f Set -B $.
sC $f Set -C $.
$( A set variable is a set, and a set expression is a class. $)
sv $a Set x $.
cs $a class -A $.
$( A set expression is provably a set. There is no converse to this axiom,
although you can use a set variable for this purpose, i.e. use isseti,
since a set variable is also a set expression. $)
sset $a |- -A e. _V $.
$( Axioms of set theory $)
snul $a Set (/) $.
srep $a Set ( x e. -A |-> B ) $. $( Not quite replacement, but
works with our expression ran ( x e. A |-> B ) for the replacement
operation. $)
ssep $a Set { x e. -A | ph } $. $( I don't think this follows from srep the way axsep follows from ax-rep $)
spow $a Set ~P -A $.
sun $a Set U. -A $.
som $a Set om $.
spr $a Set { -A , -B } $.
To be useful, this scheme must also have a mechanism for introducing definitions conservatively (this is especially important because "Set A" makes an unconditional sethood assertion). The rule is easy, though: an axiom
sthing $a Set Thing x A -B $.
df-thing $a |- Thing x A -B = expr $.
is admissible if "Set expr" is derivable (i.e. the syntax derivation looks like wceq (cs (sthing ...)) (cs ..)), and it otherwise follows the rules for class definability (i.e. no free variables on the right that don't appear on the left). This allows for the definability of set-respecting operations like { -A }, dom -A, ran -A, <. -A , -B >. , ( iota x ph ), etc. It is conceivable that there are additional set constructors which are sets for non-obvious reasons, like df-har, but usually in these cases there is another way to write the expression that is obviously a set but not obviously the same as the original expression, so the proof work is pushed into the equality instead.
Mario