Skip to content
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

Actual interpreter for microcontroller? #18

Open
dragoncoder047 opened this issue Oct 18, 2022 · 3 comments
Open

Actual interpreter for microcontroller? #18

dragoncoder047 opened this issue Oct 18, 2022 · 3 comments

Comments

@dragoncoder047
Copy link
Contributor

From the readme:

CognaC (the Cognate Compiler) compiles Cognate sources directly into C. This produces very small and rather fast binaries, allowing Cognate to outperform most dynamic languages. This also makes Cognate a candidate for scripting in embedded environments, such as microcontrollers.

... but microcontrollers can't compile and run C. Is there a "pure interpreter" for a microcontroller somewhere that actually executes the code instead of transpiling it to C? If there isn't, how do I make one out of this code here?

@StavromulaBeta
Copy link
Collaborator

The intention is for code to be compiled for the microcontroller from C - that way small microcontrollers can be used without the overhead of an interpreter. Maybe the word scripting is misleading here(?). I'm planning to explore actually running Cognate on a microcontroller once I've got the new compiler feature complete and stable.

@dragoncoder047
Copy link
Contributor Author

dragoncoder047 commented Oct 18, 2022

I was worried of that. What I want to do is hook up the microcontroller directly to a storage device (flash drive, SD card, etc), have it read the .cog files and execute them onboard, without having to be connected to a regular computer to do the compiling. I'm going to be using an ESP32, which has megabytes of both RAM and flash, so memory consumption and speed are not concerns at least for me.

@StavromulaBeta
Copy link
Collaborator

Ah yeah that'd be a problem with the current implementation. I'll almost certainly ship a small interpreter with the new compiler once it's done, but CognaC in its current iteration won't be much help here, sorry!

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

No branches or pull requests

2 participants