jmeaster30 / ocean

A C-like programming language (get it like sea-like like an ocean lol)
GNU General Public License v3.0
0 stars 0 forks source link

Add labels to hydro syntax #60

Closed jmeaster30 closed 10 months ago

jmeaster30 commented 10 months ago

Using the branch and jump instruction without labels is a bit tedious and error prone.

It would be nice to have labels that get resolved to the instruction index when compiling.

Could be simple as a fake instruction that looks like label somelabel and it gets removed from the resulting bytecode but all "somelabel" identifiers turns into the proper instruction index

jmeaster30 commented 10 months ago

Actually we need a construct of a target which can either be an exact index or a label name and on compilation we just add the "label " to some table in the function which can be referenced at run time by a target