Re: Adding a new builtin function
- Posted by Jerome Dec 30, 2012
- 963 views
Different opcodes have different numbers and types of arguments, of course, though many share these characteristics with each other, as you'll notice the groupings of the various opcodes. When you create a new built-in, you have to put yours in the appropriate place or write a customized version if you need to.
There are a lot of places that need to be updated when you add a built-in. I recommend updating dis.e so that you can take a look at the generated IL code to make sure the front end is working correctly. Assuming you're adding foo() to be similar to cos(), you would just need to add the following to dis.e:
procedure opFOO() unary() end procedure
We should really document this whole process better. Maybe a wiki page.
Thanks for the detailed explanation! I was able to get my function foo working with your help. Also, I would personally like to see a wiki page about some of the inner workings of Euphoria. It would definately be beneficial for me and others!
Thanks,
Ira