CSVOL Docs


Welcome to the one-page tutorial on CSVOL 0 programming. By the end of this tutorial, you should be able to:

- Write scripts
- Enter REPL commands
- Publish a file server
- Import commands from SOL
- Import datasets from websites

At the end, you'll also find out about a few of CSVOL's quirks, like optional syntax and error reporting. All of the CSVOL code below works in this repl: https://repl.it/@wichitacpu/CSVOL-Example-2#main.csvol.

Tutorial - CSVOL 0

REPL

To command through the terminal, leave main.csvol blank, or write the following in a .csvol script if you want to call it at a certain time.
      
    PULL REPL
    
Output:

    CSVOL 0.9.4.
    CSVOL Copyright (C) 2020 Abir Haque.
    Developed by the Wichita Computer Programmers' Union.

    REPL enabled.
    Type "HELP" for a list of commands and their usage.
    
End REPL/terminal programming and resume script instructions, if any:

    DROP REPL
    





REPL and Script commands

The following commands work in both a .csvol script and the REPL environment.

Commenting:

    COMMENT This is a comment
    ~ This is also a comment
    ~ A comment must be given the entire line
    
Creating an empty file:

    CREATE FILE file_name
    CREATE FILE delete
    ~ Generates file_name.csv and delete.csv
    
Deleting files:

    DELETE FILE delete
    
Instantiating columns, rows, and cell values:

    ~ Can pull pre-existing files too
    PULL FILE file_name
      CREATE COLUMNS<~{column_1, column_2, column_i}
      CREATE ROWS<~{4}
      ADD {0, 1}<~{apples}
      ADD {0, 2}<~{bananas}
      ~ Must drop file at the end of instantiation.
      DROP FILE
    
Terminal output:

    PRINT TEXT My first file!
    PRINT FILE file_name
    
Output:

    My first file!
    column_1,column_2,column_i
    apples,0,0
    bananas,0,0
    0,0,0
    0,0,0
    
Editing files:

    EDIT FILE file_name CELL {0, 3}<~{FILE file_name CELL {0, 2}}
    EDIT FILE file_name CELL {0, 2}<~{pear}
    EDIT FILE file_name CELL {0, 0}<~{fruits}
    EDIT FILE file_name CELL {1, 0}<~{quantity}
    ~ Add 2 empty rows.
    EDIT FILE file_name ROWS ADD<~{2}
    ~ Below deletes columns from column 2 to column 2 (index starts at 0)
    EDIT FILE file_name COLUMNS DELETE<~{2, 2}
    ~ Below adds columns to the far right of the file.
    EDIT FILE file_name COLUMNS ADD<~{column_3, column_4}
    ~ Below deletes rows from row 1 to row 1 (column name row is row 0)
    EDIT FILE file_name ROWS DELETE<~{1, 1}
    PRINT FILE file_name
    
Output:

    fruits,quantity,column_3,column_4
    pear,0,0,0
    bananas,0,0,0
    0,0,0,0
    0,0,0,0
    0,0,0,0
    
Math operators: +,-,/, and * are supported.

    EDIT FILE file_name CELL {1, 1}<~{MATH {20 - 10}}
    EDIT FILE file_name CELL {1, 2}<~{MATH {{FILE file_name CELL {1, 1}} * 50}}
    
Output:

    fruits,quantity,column_3,column_4
    pear,10,0,0
    bananas,500,0,0
    0,0,0,0
    0,0,0,0
    0,0,0,0
    





Importing from SOL

It's recommended to put import statements at the top of your CSVOL project.

    IMPORT COMMAND csvol-sol Display
    
Output:

    Please wait. Accessing CSVOL's Standard Online Library . . . 
    Please wait. Importing library . . . 
    Done!
    
Running the csvol-sol Display command

    PRINT TEXT Press the exit button to continue.
    IMPORTED Display FILE file_name
    ~ A new window will pop up with a spreadsheet of the file.
    
Output:

    Press the exit button to continue.
    Please wait. Loading GUI . . . 
    Done!
    





Downloading/Syncing online files

As of now, SOL has no importable CSV files.

However, you can use any website publicly hosting CSV files. This website hosts a great deal of CSV files and is an awesome website to connect the interpreter to: https://people.sc.fsu.edu/~jburkardt/data/csv/.

    IMPORT FILE https://people.sc.fsu.edu/~jburkardt/data/csv/ taxables
    PRINT FILE taxables
    
Output:

    "Index", "Item", "Cost", "Tax", "Total"
    1, "Fruit of the Loom Girl's Socks",  7.97, 0.60,  8.57
    2, "Rawlings Little League Baseball", 2.97, 0.22,  3.19
    3, "Secret Antiperspirant",           1.29, 0.10,  1.39
    4, "Deadpool DVD",                   14.96, 1.12, 16.08
    5, "Maxwell House Coffee 28 oz",      7.28, 0.55,  7.83
    6, "Banana Boat Sunscreen, 8 oz",     6.68, 0.50,  7.18
    7, "Wrench Set, 18 pieces",          10.00, 0.75, 10.75
    8, "M and M, 42 oz",                  8.98, 0.67,  9.65
    9, "Bertoli Alfredo Sauce",           2.12, 0.16,  2.28
    10, "Large Paperclips, 10 boxes",      6.19, 0.46,  6.65
    
You can manage this synced file with CSVOL just as you would any other CSV file.




Script-only commands

CSVOL modules:

Creating CSVOL modules are create for dividing tasks. Modules are especially useful for implementing recursion. In your interpreter directory, create a new file ending in .csvol. Here is the contents of the example.csvol module:

    PRINT TEXT Accessed example module.
    ~ Put what ever CSVOL code you want above PULL MAIN
    ~ PULL MAIN resumes spot in main.csvol
    PULL MAIN
    
Calling modules from main.csvol:

    PULL MODULE example
    
Output:

    Accessed example module. 
    
Conditionals:

    IF FILE file_name CELL {0, 3} = TEXT {0}
      PRINT TEXT Empty row.
    CONDITIONAL
    IF FILE file_name CELL {1, 1} <= FILE file_name CELL {1, 2}
      PRINT TEXT Less/equal pears than bananas.
    CONDITIONAL
    IF FILE file_name CELL {0, 1} = TEXT {0}
      PRINT TEXT They don't sell pears.
    CONDITIONAL
    IF FILE file_name CELL {0, 1} != TEXT {0}
      PRINT TEXT Pears are in the store.
    CONDITIONAL
    
Output:

    Empty row.
    Less pears than bananas
    Pears are in the store. 
    





Creating a file server

As previously stated, CSVOL creates/updates a public file server for you. This occurs at the end of every CSVOL run-time session for all files ending in .csv in the CSVOL interpreter directory.

If you are using repl.it, your file server is available at [repl_name].[username].repl.co. To kill the online file server, enter CTRL+C in the terminal.




Miscellaneous:

The following features were implemented to promote easy, rapid development of CSVOL applications:

- Optional syntax:
- Error reporting by file and line:


Optional syntax:

The interpreter ignores tab spaces, brackets, and commas. The interpreter also equates "<~" to white space. However, you can still put such characters in your CSVOL program to aide in code readability. The following lines of code are interpreted exactly the same, whereas the 1st line is much more readable:

    EDIT FILE file_name CELL {1, 2}<~{MATH {{FILE file_name CELL {1, 1}} * 50}}
    EDIT FILE file_name CELL 1 2 MATH FILE file_name CELL 1 1 * 50
    
Error reporting by file and line:

The interpreter will report errors in both the file and line number the error is located.

    33  PULL FILE search
    34    CREATE COLUMNS<~{Term_to_search}
    35    CREATE ROWS<~{1}
    36    ADD {0,1}{8}
    37    DROP FILE
    
Reports:

    CSVOL error ~> File main.csvol ~> Line 36.
    
Needed corrections:

    33  PULL FILE search
    34    CREATE COLUMNS<~{Term_to_search}
    35    CREATE ROWS<~{1}
    36    ADD {0, 1}<~{8}
    37    DROP FILE
    





Congratulations!

You're now a CSVOL programmer!

If you want some inspiration for a CSVOL project, check out the following example CSVOL program, which uses GUIs, calculates a user inputted Nth Fibonacci term, and implements recursive searching: https://repl.it/@wichitacpu/CSVOL-Example#main.csvol.