Skip to content

Add builtin parsing - #305

Merged
CohenArthur merged 2 commits into
jinko-core:feature/improve-parserfrom
SanderJSA:builtin-parser
Oct 18, 2021
Merged

Add builtin parsing#305
CohenArthur merged 2 commits into
jinko-core:feature/improve-parserfrom
SanderJSA:builtin-parser

Conversation

@SanderJSA

Copy link
Copy Markdown
Collaborator

Add builtin support to the parser.
Design change, if builtin doesn't exist, returns the error message instead of unwrapping.
Like so

jinko > @not_builtin(10)
Error type: Parsing
 ===> repl
    |
    | unknown ctx directive @not_builtin
    |

@codecov-commenter

codecov-commenter commented Oct 17, 2021

Copy link
Copy Markdown

Codecov Report

❗ No coverage uploaded for pull request base (feature/improve-parser@9ad12aa). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@                    Coverage Diff                    @@
##             feature/improve-parser     #305   +/-   ##
=========================================================
  Coverage                          ?   87.11%           
=========================================================
  Files                             ?       34           
  Lines                             ?     3065           
  Branches                          ?        0           
=========================================================
  Hits                              ?     2670           
  Misses                            ?      395           
  Partials                          ?        0           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9ad12aa...a71a873. Read the comment docs.

@SanderJSA
SanderJSA requested a review from CohenArthur October 17, 2021 18:32

@CohenArthur CohenArthur left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! The only thing that I'd like to point out is that builtins are a separate thing for now. This isn't super clear, but builtins (as in the functions defined in builtins.rs) are just regular external functions implemented in the interpreter, while jk_insts (which you parse here) are very special (for now). I'm not quite sure what we could do with them, but we could for example think about having a @jit(function_name, another_function, a_vector_of_functions...) jk_inst which would force the jitting of instructions and return their assembly code, or a handle, etc etc etc. Plus, jk_insts are very special in that they are able to take any number of arguments and do not have to go through the typechecker, unlike builtins. While we try to figure out what to do with them, and if they should effectively replace builtins, or if builtins should replace them, could you rename the functions to reflect that they are jk_insts and not builtins?

Thanks a lot for working on all of this! This parser is looking fantastic and I can't wait to merge it in master.

@SanderJSA

Copy link
Copy Markdown
Collaborator Author

No problem, the parser doesn't force any number of arguments atm, just a few unit tests to make sure the arg parser works as expected.

@CohenArthur CohenArthur left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fantastic, thanks a lot :)

@CohenArthur
CohenArthur merged commit 839be8f into jinko-core:feature/improve-parser Oct 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants