Re: Anyone here made their own programming language?
Posted: Sat Oct 17, 2020 12:52 am
Yesterday evening, I published another YouTube video about my programming language: https://youtu.be/YFZ-45ea5mo
Philosophical Vegan Forum
https://831048.arinterhk.tech/
stuxxnet wrote:you've also written a log function that runs in an infinite loop if the input is close to 1Teo Samarzija wrote: Come on now, I have written a programming language that compiles to WebAssembly, I know that stuff.
you're trying to compare sort functions written in an interpreted language to those provided by that language in its native VM
you're overfitting measurement data to come up with a completely insane formula for the comparisons of quicksort
you're using rand in c++ code
you implement custom math functions using highschool maths that just doesn't work if you want to be numerically efficient or just even get a sane result for the whole range of possible inputs.
I'm sorry, but I really don't have much confidence in your judgement calls...
Code: Select all
;This is my attempt to port "rose.aec" to 16-bit DOS, using FlatAssembler.
;My previous DOS example, "anlalogClockForDOS.aec" is 32-bit and is assembled
;using GNU Assembler.
;Notice that we CANNOT use arrays here, as ArithmeticExpressionCompiler uses
;"ebx" to index arrays, which works in 32-bit and 64-bit mode, but doesn't work
;in the 16-bit mode.
AsmStart
format binary as "COM"
org 100h
use16
AsmEnd
y:=0
While y<24
x:=0
While x<79
distance:=sqrt(pow(abs((x-40)/2),2)+pow(abs(y-12),2))
angle:=atan2(y-12,(x-40)/2)
r:=cos(angle*3)*12
If (distance < (r + 0.5) ) | ( (y = 12) & (x > 40-1) & (x < 40 + (13 * 2) ) )
AsmStart
mov dl,'*'
mov ah,2
int 0x21
AsmEnd
Else
AsmStart
mov dl,' '
mov ah,2
int 0x21
AsmEnd
EndIf
x:=x+1
EndWhile
AsmStart
mov dl,0xa ;The newline character
mov ah,2
int 0x21
AsmEnd
y:=y+1
EndWhile
AsmStart
int 0x20
result dd ?
x dd ?
y dd ?
distance dd ?
angle dd ?
r dd ?
AsmEnd
Code: Select all
mkdir ArithmeticExpressionCompiler
cd ArithmeticExpressionCompiler
if [ $(command -v wget > /dev/null 2>&1 ; echo $?) -eq 0 ] # Check if "wget" exists, see those StackOverflow answers for more details:
# https://stackoverflow.com/a/75103891/8902065
# https://stackoverflow.com/a/75103209/8902065
then
wget https://flatassembler.github.io/Duktape.zip
else
curl -o Duktape.zip https://flatassembler.github.io/Duktape.zip
fi
unzip Duktape.zip
if [ $(command -v gcc > /dev/null 2>&1 ; echo $?) -eq 0 ]
then
gcc -o aec aec.c duktape.c -lm # The linker that comes with recent versions of Debian Linux insists that "-lm" is put AFTER the source files, or else it outputs some confusing error message.
else
clang -o aec aec.c duktape.c -lm
fi
./aec analogClock.aec
if [ $(command -v gcc > /dev/null 2>&1 ; echo $?) -eq 0 ]
then
gcc -o analogClock analogClock.s -m32
else
clang -o analogClock analogClock.s -m32
fi
./analogClock
Code: Select all
if [ $(command -v git > /dev/null 2>&1 ; echo $?) -eq 0 ]
then
git clone https://github.com/FlatAssembler/AECforWebAssembly.git
cd AECforWebAssembly
elif [ $(command -v wget > /dev/null 2>&1 ; echo $?) -eq 0 ]
then
mkdir AECforWebAssembly
cd AECforWebAssembly
wget https://github.com/FlatAssembler/AECforWebAssembly/archive/refs/heads/master.zip
unzip master.zip
cd AECforWebAssembly-master
else
mkdir AECforWebAssembly
cd AECforWebAssembly
curl -o AECforWebAssembly.zip -L https://github.com/FlatAssembler/AECforWebAssembly/archive/refs/heads/master.zip # Without the "-L", "curl" will store HTTP Response headers of redirects to the ZIP file instead of the actual ZIP file.
unzip AECforWebAssembly.zip
cd AECforWebAssembly-master
fi
if [ $(command -v g++ > /dev/null 2>&1 ; echo $?) -eq 0 ]
then
g++ -std=c++11 -o aec AECforWebAssembly.cpp # "-std=c++11" should not be necessary for newer versions of "g++". Let me know if it is, as that probably means I disobeyed some new C++ standard (say, C++23).
else
clang++ -o aec AECforWebAssembly.cpp
fi
cd analogClock
../aec analogClock.aec
npx -p wabt wat2wasm analogClock.wat
node analogClock