Calculating offset for SKIP instruction [message #1159540] |
Mon, 28 October 2013 12:01  |
Eclipse User |
|
|
|
My DSL (adding functionality to a DSP assembly language) is going quite well. This is amazing to me as 4 weeks ago I had very little idea what a DSL even was. It turns out that Xtext and Xtend are exactly what I was looking for. I just wish I'd known about them sooner!
Here's my current issue.
I need to be able to count the lines that occur between a line such as:
and
For example:
SKIP (RUN_FLAG, init)
SET_Register(LFO_SPEED, 34)
SET_Register(LFO_WIDTH, 4096)
ReadRegister (POT0)
init:
Next_Instruction(blah)
Needs to parse to:
SKIP (RUN_FLAG, 3)
SET_Register(LFO_SPEED, 34)
SET_Register(LFO_WIDTH, 4096)
ReadRegister (POT0)
Next_Instruction(blah)
My first thought was to start pushing instructions into a FIFO queue as soon as I hit the "Skip" instruction, then count how many are consumed until I find the matching label. After that I could complete the Skip instruction and process the instructions that went into the queue. But this is sounding a little complicated, assuming that there is an easier way.
I am pretty sure that Skip instructions only need to go forward, but I'll double check.
Any suggestions?
Thanks,
GW
|
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.21739 seconds