Our server costs ~$56 per month to run. Please consider donating or becoming a Patron to help keep the site running. Help us gain new members by following us on Twitter and liking our page on Facebook!
Current time: March 29, 2024, 1:48 am

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
WebAssembly
#1
WebAssembly
Hey, guys!
So, I came to an idea that I could make money by making an alternative to AssemblyScript, by making a compiler which compiles AEC (the programming language I designed) to WebAssembly. Until now, AEC targetted only x86 Assembly, so I've been writing a new compiler. I've actually rewritten everything (including the tokenizer and the parser) from JavaScript to C++, because most experienced programmers think C++ is a better language than JavaScript is for those kinds of stuff. After I've written more than 3'000 lines of code, I've managed to compile a simple AEC program to run in a browser.
So, what do you guys think, is it worth to continue developing it? Do you think it's worth to drop out of university to try to make money of that idea? I am not doing well at the university, and most things we learn there seem absolutely pointless to me. I want honest answers.
Reply
#2
RE: WebAssembly
I don't really know what your language brings to the table that is new because I haven't done extensive coding. I've only dabbled a bit. I would say throw free time at your language and compiler and try to find a market to make money while you keep chopping that wood at school.
Reply
#3
RE: WebAssembly
Rhizomorph13 Wrote:I've only dabbled a bit. I would say throw free time at your language and compiler and try to find a market to make money while you keep chopping that wood at school.
I have 5 F's at the university. The only way I can finish the university is maybe if I dedicate all my time to it. So, I can't both develop my programming language and finish the university. By the way, today I've managed to compile some simple algorithms written in my programming language to WebAssembly.
Reply
#4
RE: WebAssembly
I've just managed to compile the Analog Clock in AEC, previously runnable on Linux and DOS (using DJGPP), to be runnable on the web. I had to write a math library for that, because WebAssembly doesn't provide you with "fsin", "fcos" and "fsqrt" like x86 assembly does.
Reply
#5
RE: WebAssembly
I've implemented a Dragon Curve in AEC:
Code:
/*
* This will be my attempt to build a graphical application with AEC.
*/

//Let's import some JavaScript functions...
Function drawLine(Integer32 x1,
                  Integer32 y1,
                  Integer32 x2,
                  Integer32 y2,
                  CharacterPointer color,
                  Integer32 lineWidth) Which Returns Nothing Is External;
Function applyTurtleTransformation(Integer32 translateX,
                                   Integer32 translateY,
                                   Integer32 rotateDegrees)
    Which Returns Nothing Is External; //We won't use the turtle for actual
                                       //drawing, but we will move it and
                                       //rotate it.

Integer32 directionX[4]    := { 0, 1, 0, -1},
          directionY[4]    := {-1, 0, 1,  0},
          currentX         := 15,
          currentY         := 250,
          currentDirection := 0,
          lineLength       := 5,
          lineWidth        := 2,
          currentStep      := 0;

Character path[16384], reversedPath[16384];

//Again, we need to implement string manipulation functions. Like I've said,
//even though this program will be running on JavaScript Virtual Machine, it
//can't call the methods of the JavaScript "String" class.
Function strlen(CharacterPointer str) Which Returns Integer32 Does
    //We can't implement this recursively, like we did in earlier AEC
    //programs, because we will be dealing with large strings which will
    //cause stack overflow.
    Integer32 length := 0;
    While ValueAt(str + length) Loop
        length := length + 1;
    EndWhile
    Return length;
EndFunction

Function strcpy(CharacterPointer dest,
                CharacterPointer src) Which Returns Nothing Does
    While ValueAt(src) Loop
        ValueAt(dest) := ValueAt(src);
        dest          :=     dest + 1;
        src           :=      src + 1;
    EndWhile
    ValueAt(dest) := 0;
EndFunction

Function reverseString(CharacterPointer string) Which Returns Nothing Does
    CharacterPointer pointerToLastCharacter := string + strlen(string) - 1;
    While pointerToLastCharacter - string > 1 Loop
        Character tmp                   := ValueAt(string);
        ValueAt(string)                 := ValueAt(pointerToLastCharacter);
        ValueAt(pointerToLastCharacter) := tmp;
        string                          := string + 1;
        pointerToLastCharacter          := pointerToLastCharacter - 1;
    EndWhile
EndFunction

Function strcat(CharacterPointer dest,
                CharacterPointer src) Which Returns Nothing Does
    strcpy(dest + strlen(dest), src);
EndFunction

//This is the function that's supposed to be called by JavaScript as soon
//as it is ready.
Function init() Which Returns Nothing Does
    CharacterPointer path         := AddressOf(path[0]);
    CharacterPointer reversedPath := AddressOf(reversedPath[0]);
    strcpy(path,"R");
    Integer32 counter := 0;
    While strlen(path) < 8192 Loop
        strcpy(reversedPath, path);
        If mod(counter, 4) = 0 Then
            reverseString(reversedPath);
        EndIf
        strcat(path, reversedPath);
        strcat(path, not(mod(counter,4))?"L":"LLL");
        counter := counter + 1;
    EndWhile
EndFunction

//This function is supposed to be periodically called by JavaScript:
Function step() Which Returns Nothing Does
    If currentStep < 8192 and currentX > 0 and currentX < 500
       and currentY > 0 and currentY < 500 Then
        Integer32 nextX := currentX + directionX[currentDirection] * lineLength,
                  nextY := currentY + directionY[currentDirection] * lineLength;
        drawLine(currentX, currentY, nextX, nextY,
                 currentStep=0?
                    "lightYellow"
                 :path[currentStep]='R'?
                    "red"
                 :path[currentStep]='L'?
                    "lightGreen"
                 :  "lightBlue",
                 lineWidth);
        currentX    := nextX;
        currentY    := nextY;
        If path[currentStep]='R' Then
            currentDirection := mod(currentDirection + 1, 4);
        ElseIf not(currentDirection=0) and path[currentStep]='L' Then
            currentDirection := currentDirection - 1;
        ElseIf path[currentStep]='L' Then
            currentDirection := 3;
        EndIf
        currentStep := currentStep + 1;
        applyTurtleTransformation(currentX, currentY, currentDirection*90);
    EndIf
EndFunction
To accomplish that, I needed to fix a few bugs in the compiler.
Reply





Users browsing this thread: 1 Guest(s)