Converts simple programs written in C to Bash script.
Having the following C code:
#include <stdio.h>
int d = 5 + 1;
// Describes foo function.
int foo() {
return d;
}
int main() {
int g = foo();
for(int i = g; i < 10; i++) {
printf("Hello world");
}
if (12 == 12) {
printf("It works");
}
int i = 10;
while (i < 20) {
printf("Slava Ukraini!");
i++;
}
return 1;
}
It will be converted into the following script:
#!/bin/bash
d=$(( 5 + 1 ))
# Describes foo function.
function foo() {
echo $((d))
}
function main() {
local g=$(foo)
for (( i=g; i < 10; i++ )); do
echo "Hello world"
done
if [[ $(( 12 )) == $(( 12 )) ]]; then
echo "It works"
fi
local i=$(( 10 ))
while (( i < 20 )); do
echo "Slava Ukraini!"
(( i++ ))
done
echo $((1))
}
main
Supported statements:
- if conditions
- for cycles
- while cycles
- simple function declarations without arguments
- return statement
- local variables
- global variables
- increaments
- decreaments
- comment declarations(separate line)