latest pushes
This commit is contained in:
parent
91b7c54b49
commit
4f922d70cc
@ -1,22 +1,22 @@
|
|||||||
#!/usr/bin/env bellos
|
#!/usr/bin/env bellos
|
||||||
# File: file_operations.bellos
|
|
||||||
|
|
||||||
|
# File: file_operations.bellos
|
||||||
# Demonstrating file operations
|
# Demonstrating file operations
|
||||||
|
|
||||||
# Writing to a file
|
# Writing to a file
|
||||||
echo "This is a test file" > test.txt
|
write test.txt "This is a test file"
|
||||||
echo "Adding another line" > test.txt
|
append test.txt "Adding another line"
|
||||||
|
|
||||||
# Reading from a file
|
# Reading from a file
|
||||||
echo "Contents of test.txt:"
|
echo "Contents of test.txt:"
|
||||||
cat test.txt
|
read test.txt
|
||||||
|
|
||||||
# Using a while loop to read file line by line
|
# Using a loop to read file line by line
|
||||||
echo "Reading file line by line:"
|
echo "Reading file line by line:"
|
||||||
while read -r line
|
for line in $(read_lines test.txt)
|
||||||
do
|
do
|
||||||
echo "Line: $line"
|
echo "Line: ${line}"
|
||||||
done < test.txt
|
done
|
||||||
|
|
||||||
# Cleaning up
|
# Cleaning up
|
||||||
rm test.txt
|
delete test.txt
|
||||||
|
@ -6,9 +6,8 @@ mod utilities;
|
|||||||
use crate::interpreter::interpreter::Interpreter;
|
use crate::interpreter::interpreter::Interpreter;
|
||||||
use crate::lexer::lexer::Lexer;
|
use crate::lexer::lexer::Lexer;
|
||||||
use crate::parser::parser::Parser;
|
use crate::parser::parser::Parser;
|
||||||
use crate::utilities::Token;
|
use crate::utilities::utilities::Token;
|
||||||
|
|
||||||
use glob::glob;
|
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::{self, BufRead, Write};
|
use std::io::{self, BufRead, Write};
|
||||||
|
0
src/executor/executor.rs
Normal file
0
src/executor/executor.rs
Normal file
1
src/executor/mod.rs
Normal file
1
src/executor/mod.rs
Normal file
@ -0,0 +1 @@
|
|||||||
|
pub mod executor;
|
@ -13,7 +13,7 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use crate::utilities::ASTNode;
|
use crate::utilities::utilities::ASTNode;
|
||||||
|
|
||||||
use glob::glob;
|
use glob::glob;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use crate::utilities::Token;
|
use crate::utilities::utilities::Token;
|
||||||
|
|
||||||
pub struct Lexer {
|
pub struct Lexer {
|
||||||
input: Vec<char>,
|
input: Vec<char>,
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
use crate::utilities::{ASTNode, Token};
|
use crate::utilities::utilities::{ASTNode, Token};
|
||||||
|
|
||||||
pub struct Parser {
|
pub struct Parser {
|
||||||
tokens: Vec<Token>,
|
tokens: Vec<Token>,
|
||||||
|
1
src/utilities/mod.rs
Normal file
1
src/utilities/mod.rs
Normal file
@ -0,0 +1 @@
|
|||||||
|
pub mod utilities;
|
Loading…
Reference in New Issue
Block a user