ChrisHixon / chpeg

Parsing Expression Grammar (PEG) bytecode parser/compiler library
BSD 3-Clause "New" or "Revised" License
13 stars 1 forks source link

Replace in Parser struct individual declarations of members of ByteCo… #14

Closed mingodad closed 2 years ago

mingodad commented 2 years ago

…de by a const pointer of ByteCode

ChrisHixon commented 2 years ago

I think everything has prefixes now. Much of what you've presented in this pull request is in my TODO list.

mingodad commented 2 years ago

Maybe you could also add this macros an replace the hard coded instances like I did here https://github.com/mingodad/chpeg/blob/696339f5802834a49e56371a255e3aeae487b7af/include/chpeg/bytecode.h#L14

#define CHPEG_INST(op, arg) (((arg) << 8) | (op))
#define CHPEG_INST_OP(inst) (inst & 0xff)
#define CHPEG_INST_ARG(inst) (inst >> 8)