julgodis / cupcake-compiler Goto Github PK
View Code? Open in Web Editor NEWA compiler for Jonathan Blows new programming language JAI.
License: MIT License
A compiler for Jonathan Blows new programming language JAI.
License: MIT License
I know this is kind of old, but I really want to play around with this fan creation of the compiler.
When ever calling the compiler with the source file as cupcake main.jai
or whatever, there is always an error that reads:
Cupcake (v0.1-alpha)
Error: Module/File not found (path: .\modules\)
There were errors, exiting!
Basically it can never find the file or modules when called so it cannot compile. It also for some reason does not respond to command line arguments like -r, -v, -m, etc. This is on 64 bit Windows 10 and I know it says the executable is win32, but Python runs fine as a win32 executable on 64 bit Windows 10, so why shouldn't this? I heard rumours of there being a new version back in 2018, but that was never put out and we can't even fix this ourselves from showing the source. I would like to know why this behaviour is happening.
UPDATE: This behaviour has been fixed, the lowest post is what relates to the title of the issue now
This was compiled on Windows 10 64-bit with MinGW (g++
). At first, there were a bunch in the big array rodata[]
about the requirement of narrowing conversions from int
to char
:
And then a lot of crossing initialization errors:
I also at the very top, I got a preprocessor error that stdio.h
could not be found. I know that's the standard input-output for C, but C++ has iostream
and none of the standard headers for it end with .h
anymore if I remember correctly.
Take this as you will since I don't know how this can be completely fixed if there are so many, but I mean this is not a necessity per se and I don't need/want this fixed ASAP, however it would be good if the compile succeeded later on in the future, or if the actual compiler comes out.
I have no idea why, but i cant link my test dll file
File mylib.c
:
#include <stdio.h>
#include <inttypes.h>
typedef int32_t s32;
#define DLLEXPORT __declspec(dllexport)
DLLEXPORT void my_hello(void) {
printf("hi from my_hello!\n");
}
DLLEXPORT s32 my_sum(s32 a, s32 b) {
return a + b;
}
File main.jai
:
#import "modules/Print.jai"
#foreign_library "mylib"
my_hello :: #no_context () -> Void #foreign;
my_sum :: #no_context (a: s32, b: s32) -> s32 #foreign;
main :: () {
my_hello();
print("my_sum test: %", my_sum(24, 4));
}
#run main()
Build process:
> clang -shared mylib.c -o mylib.dll
#or
> tcc -shared mylib.c
> cupcake main.jai
Cupcake (v0.1-alpha)
* External: 'my_hello' 6 (0)
* External: 'my_sum' 6 (0)
* Function: 'main' 2 (0)
* Run: 3
-------------------------------------------
Workspace 'program' (2 errors, 2 reports)
.\main.jai:4,1: Error: Unknown foreign procedure 'my_hello' (my_hello)
>
> #foreign_library "mylib"
> my_hello :: #no_context () -> Void #foreign;
> ^
.\main.jai:5,1: Error: Unknown foreign procedure 'my_sum' (my_sum)
> #foreign_library "mylib"
> my_hello :: #no_context () -> Void #foreign;
> my_sum :: #no_context (a: s32, b: s32) -> s32 #foreign;
> ^
There were errors, exiting!
This code:
#import "modules/Print.jai"
test :: () {
print("Hello");
return;
print(" world");
}
main :: () {
test();
}
#run main()
run with cupcake mytest.jai
produces this error:
Cupcake (v0.1-alpha)
Assertion failed at ..\src\ssa\ssa_realloc.cpp:406 inside coloring_spill_find
Condition: false
Internal Compiler Error : Invalid Code Path
Looks like return;
crushes interpreter.
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.