-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: cairo runner #30
Conversation
dcc3ab7
to
6651ee7
Compare
@@ -0,0 +1,8 @@ | |||
CAIRO_0_PATH=cairo_programs/cairo_0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we have a strategy for cairo1 files as well?
with another cairo-compile binary? or rather scarb?
it can wait
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think Lambda does it but installing the cairo-1 compiler and then just compiling. We don't really have to handle scarb right? Scarb is more to compile whole projects, if we are just compiling a couple of single files, should be able to use the raw compiler.
.trunk/trunk.yaml
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add the cairo-format formatter as well (you can copy/paste from kakarot)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this the fibonacci implementation used in other repo? as it's not the most efficient one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see also the cairo paper, section 3.4 Cairo programs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you want the cairo paper optimized one? It seems hard to read but can do
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just tried with low level, it's nice, can update if you want
this.initializeSegments(); | ||
const result = this.initializeMainEntrypoint(); | ||
this.initializeVm(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is confusing because we get as intermediary result result
which is eventually returned. Why not
this.initializeSegments();
this.initializeVm();
return this.initializeMainEntrypoint();
but I think that the content of these functions should be inlined here, they are small and it doesn't help readability
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after pulling the PR locally, I definitely think that you should inline everything and remove all the initializeX
functions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mmmmm that might be a lot of code inlined into one function, worried this will not improve the lisibility nor the testing.
src/vm/virtualMachine.ts
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you case use default
in all the switch instead of leaving the switch to return
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also plz put the early return in the branches to keep the main case at the most top level
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the src/vm/virtualMachine.ts
file is hard to read
Adds the cairo runner to the code base, and allows to run fibonnaci! Resolves #18