lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hello List,

at which places do I have to modify code to add new operators?
I quite often need a // b and a // b + 1 so i thought about adding /+
and /-, where /- is like // (only added for symmetry). I'm not sure if
I think this is a good idea, but it seemed easy enough to try out. 

Well, obviously you have to add a new token, the parser has to omit the
right operation, the opcode has to exit, the virtual machine has to be
edited and the code generator has to be updated. That means changes in

lcode.c
llex.c
lobject.c
lopcodes.*
lopnames.h
lparser.c
lstrlib.c -- duh
ltm.h
lua.h
lvm.c

Ok, that's more than I expected, anything else to look for? The
required changes seem simple enough.

And one more question: the 'K' suffix in opcodes denotes constant
operands, but at what point does a // 2 becomes OP_IDIVK? The lexer
only emits TK_IDIV.

Kind regards,
Patrick