alyssarosenzweig / scratch-llvm Goto Github PK
View Code? Open in Web Editor NEWCross-compiling LLVM into MIT Scratch, because it's interesting.
License: MIT License
Cross-compiling LLVM into MIT Scratch, because it's interesting.
License: MIT License
Hello,
I have forked the github project and want to improve the code but there is a lot there and it's difficult to figure out how it works. Do you think you could explain in detail the code, especially backend.js and IR.js, so i could know what's happening here.
I want to remake the way the script runs so that instead of doing all this putchar, putnum and stacks stuff, it just adds the closest scratch equivalent of the input functions. Is this possible to do and what parts do I need to change to make this happen. I'd prefer to modify your project rather than starting from scratch as you've already done a considerable amount of the work.
Edit: Actually, perhaps I don't need an llvm if my aim isn't to convert to machine code but is to simply parse c and convert to scratch json, it might be better to keep the natural human readable code.
I do in Bash in Ubuntu 14.04:
clang -S -emit-llvm tests/fizzbuzz.c
node meowcc.js fizzbuzz.ll > project.json
zip fizzbuzz.sb2 project.json
And then I upload fizzbuzz.sb2 to Scratch, but then the program only prints fizzbuzz everytime, as if conditions where always true. I have tested this in Ubuntu 14.04 and Raspbian Wheezy, but with the same wrong results. What version of clang do you use? Is there a way to get this to work in e.g. Ubuntu? Ubuntu clang version 3.4-1ubuntu3 (tags/RELEASE_34/final) (based on LLVM 3.4).
I also have to change 'void main' to 'int main' in all examples.
Simpler examples such as helloworld.c works without problems.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.