add list functions to stdlib
This commit is contained in:
parent
49ea765e40
commit
b01415d786
4 changed files with 146 additions and 12 deletions
|
|
@ -13,7 +13,7 @@ type Function struct {
|
|||
function Operation
|
||||
name string
|
||||
timesCalled int
|
||||
args int // TODO: Make this a list of expected types (TAGs)
|
||||
args int
|
||||
}
|
||||
|
||||
type FuncTable map[string]*Function
|
||||
|
|
@ -31,6 +31,12 @@ The standard library is loaded during the init step of the repl (or interpreter
|
|||
2. *Create a `Function` to encapsulate your `Operation`.* Make sure to set the `args` and `name` fields. Args will be used to validate function calls and Name will be used in debug/log output.
|
||||
3. *Add your `Function` to the `FuncTable`.* Make sure your `Operations`s get added to the table generated in `GenFuncTable`.
|
||||
|
||||
## Tips
|
||||
- You can use the Log module to add helpful output to your functions.
|
||||
- Try not to clutter the output with unnessesary ERR level logging.
|
||||
- Make sure you properly set the Next element of any Token you swap into a list
|
||||
- Make sure you properly set the Next element of the previous Token as you swap a token into a list
|
||||
|
||||
## License
|
||||
Copyright (C) 2019 Aidan Hahn.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue