Skip to content

Commit 2ca1b46

Browse files
committed
Rust Compatibility!
1 parent b79565f commit 2ca1b46

5 files changed

Lines changed: 30 additions & 5 deletions

File tree

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ lua:
1717
https://github.com/rjpcomputing/luaforwindows/releases <br>
1818
GO:
1919
https://golang.org/doc/install?download=go1.10.3.windows-amd64.msi <br>
20-
Elixir: https://repo.hex.pm/elixir-websetup.exe
21-
20+
Elixir: https://repo.hex.pm/elixir-websetup.exe <br>
21+
Rust : https://win.rustup.rs/ <br>
2222
## Language Support
2323
Other Versions of the langauges work, these are just the tested versions
2424
<center>
@@ -32,6 +32,7 @@ Other Versions of the langauges work, these are just the tested versions
3232
| Go |1.10.3| X | X | |
3333
| Elixir |1.6.6| X | | |
3434
| Batch |win10| X |X | |
35+
| Rust |1.27.0| X | | |
3536
</center>
3637

3738

interpreter.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ findBounds <- function(script, startingVal = 1){
3636
upperBound <- 0
3737
moduleName <- 0
3838
for(i in startingVal:length(script[,1])){
39-
if(script[i,] == "**R" || script[i,] == "**python" || script[i,] == "**js" || script[i,] == "**lua" || script[i,]== "**go" || script[i,] == "**Elixir" || script[i,] == "**bat"){
39+
if(script[i,] == "**R" || script[i,] == "**python" || script[i,] == "**js" || script[i,] == "**lua" || script[i,]== "**go" || script[i,] == "**Elixir" || script[i,] == "**bat" || script[i,] == "**rust"){
4040
lowerBound <- i
4141
moduleName <- script[i-1,]
4242
for(j in i:length(script[,1])){

logos.png

84.6 KB
Loading

mainScript.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,17 @@ echo hi again
7373

7474
**/
7575

76+
testRust
77+
**rust
78+
fn main() {
79+
// The statements here will be executed when the compiled binary is called
80+
81+
// Print text to the console
82+
println!("Hello World! from rust");
83+
}
84+
**/
85+
86+
7687
** name1
7788
** module2
7889
** rtester 4
@@ -82,6 +93,8 @@ module2 **<< rtester
8293
** goMod 4
8394
** testElixir
8495
** testBat
96+
** testRust
97+
8598

8699
testname
87100
**js

processRequest.R

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,25 @@ processFunction <- function(indexIn, argument = ""){
5656
writeLines(as.character(w), con = "runner.bat", sep = "\n", useBytes = FALSE)
5757
result <- shell(paste("runner.bat", argument), intern = T)
5858
file.remove("runner.bat")
59-
try(
60-
for(i in 1:length(result)){
59+
try(
60+
for(i in 1:length(result)){ #This is to remove the spacing & console prompt output
6161
if(result[i] == ""){
6262
result = result[-(i:(i+1))]
6363
}
6464
},
6565
silent=TRUE)
6666
return(result)
6767
}
68+
if(script[titleRows[indexIn],] == "**rust"){
69+
file.create("runner.rs")
70+
writeLines(as.character(w), con = "runner.rs", sep = "\n", useBytes = FALSE)
71+
shell("rustc runner.rs", intern = T)
72+
result <- shell(paste("runner.exe", argument), intern = T)
73+
74+
file.remove("runner.exe") # .rs files compile into .exe and .pdb which tha can be run
75+
file.remove("runner.pdb")
76+
file.remove("runner.rs")
77+
return(result)
78+
}
6879
}
6980

0 commit comments

Comments
 (0)