Skip to content

Commit

Permalink
Update index.rst
Browse files Browse the repository at this point in the history
  • Loading branch information
hg0428 committed Aug 31, 2020
1 parent 3b9f8b6 commit 13f5bb7
Showing 1 changed file with 68 additions and 8 deletions.
76 changes: 68 additions & 8 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,21 @@ Getting Started:
########
To get started with your first output do: ``output('hello world!\n')``. There you go, you've officially ran your first program! Take note of the ``\n``. If you (like me) get tired quickly of writing ``\n`` you can go ahead and use ``#include anr`` press enter, and then run ``output('hello world!')``. See! works without the ``\n``. We'll talk more about ``#include`` later, but for now thats all you need to know. Comments start with ``/`` and end with ``\``. Clearing the terminal is done by using ``clear()``.

A Note About Built In Functions:
#########
Most (excluding ``output()``, and ``input()`` ect...) functions do not output things on their own!! As such it is integral that if you want an output from (most) built in functions you output the result by assigning it to a variable, and outputting the variable, or calling the function from inside an output. Like this: ``output(binf())``, or:
::
a = binf()
output(binf)
Now that we've cleared up this common missconception, proceed!

Running Files:
########
To run files all you need to do is run ``#include file-to-run`` this imports all aspects of a file and runs them directly to the terminal.

Math And String Concantonations:
Math And String Concatenation:
########
Math works as usual (Multiplication: *, Division: /, Addition: +, Subtraction: -), and ``ints()`` are defined as ``number(perameter)``. String concantonations is done by simply putting an addition sign between strings: ``'string '+'concantonation!'``, ``'string ' + 'concantonation!'`` is also valid.
Math works as usual (Multiplication: *, Division: /, Addition: +, Subtraction: -), and ``ints()`` are defined as ``number(perameter)``. String concatenation is done by simply putting an addition sign between strings: ``'string '+'concantonation!'``, ``'string ' + 'concantonation!'`` is also valid.
Booleans
########
Expand Down Expand Up @@ -61,11 +69,11 @@ Functions are defined by the ``funct`` keyword. Syntax:
funct myFunction(args) {
do something
}
Function can be called by typing the function's name with parenthese at the end (if the function has parameters include the parameter values too!) like so: ``myFunction()``, or ``myFunction(args)`` if the function was defined with arguments. Function arguments are seperated by commas (``,``). Functions defined by the user run like any other function. To return from a function simply do ``return data``, ``data`` can be equal to anything, a string, a number, function, or a variable ect...
Function can be called by typing the function's name with parenthese at the end (if the function has arguments include the argument values too!) like so: ``myFunction()``, or ``myFunction(args)`` if the function was defined with arguments. Function arguments are seperated by commas (``,``). Functions defined by the user run like any other function. To return from a function simply do ``return data``, ``data`` can be equal to anything, a string, a number, function, or a variable ect...

'Statements':
Directives:
#########
All statments start with ``#``, there are currently 3 statments, ``#include``, ``#ape``, and ``#max-memory``.
All directives start with ``#``, there are currently 3 directives, ``#include``, ``#ape``, and ``#max-memory``.
``#include`` includes the specified module. Syntax:
::
#include file
Expand Down Expand Up @@ -111,7 +119,7 @@ Run the code and look at the output, your html file shows up in the browser. Now
#include server
render_file('index.html')
errorhandler(404, 'error.html')
run_server
run_server()

And try going to a page that does not exist like ``/abc.html`` for example, your error message should come up.

Expand All @@ -122,5 +130,57 @@ In Aardvark you are able to run Python, and C++, this can be done by using the `
exec('print("Hello world in python!")', 'py')

Current Memory:
#######
You can recieve the program's current memory usage by doing ``currentMemUsage()``. This takes no parameters.
########
You can recieve the program's current memory usage by doing ``currentMemUsage()``. This takes no arguments.

Data Types:
########


Tools Module:
########
To include the tools module in your program use: ``#include tools``. This allows you to do things with random numbers, and factorials. First off to use factorials just do: ``factorial(number)``. There are multiple function dealing with random things, first is ``random()``, it returns a random number between 0 and 1. Next is ``randomchoice()``, it chooses a random item from an iterable. Next is ``randint()``, it return a random integer within the specified range.

Database Module:
########
To have access to databeses you first have to include the db module, ``#include db``. There are 2 functions in the db module: ``addKey()``, and ``loadData``. Lets start with addKey; db connects to Json, (it is recomended that you have some knowlege of Json before using this module) to add a key, and value to a Json file. The syntax for this is: ``addkey(key, value, file)``, if nothing is passed into file it will default to ``db.json`` in the folder that Aardvark is kept in. The other function, ``loadData()`` returns the data of a specified Json file. Syntax: ``loadData(file)``, if nothing is passed into the file parameter it will return the data of ``db.json``.

List:
########
List are created by using the ``list()`` function, or []. They can be assigned to variables. See ``list.py`` for more info!

File System Module:
########
To include this module use ``#include filesystem``. This adds 1 more function to your toolbelt: ``newFile()``. The function allows you to create a new file. Syntax: ``newFile(filename, text)``, if nothing is passed into the text parameter it will default to a blank file.

NLP Module:
########
The NLP module consists of many functions useful in Natural Language Processing. Lets start with ``#include nlp``. The first is ``clean()``, it returns only the most important words in the given text. The next is ``GetWordInfo()`` it will return the information for any given word. The following code:
::
#include NLP
GetWordInfo('hello')
Will return a dictionary of all the synonyms, antonyms, and defintions of the given word.
The next function is ``ProcessList()``, this function takes 1 argument, a dictionary, and process it to remove any problems.
The last function is ``GetTopics``, which gets the topics of a conversation, it takes 1 manditory argument, a list of strings, and returns the main topics of the conversation.

Timer module
########
The timer module has 4 functions that can be used by doing ``#include timer``: ``waitSeconds()`` ``waitMinutes()``, ``waitHours()``, and ``currentTime()``. All of the Wait functions take in 1 number perameter, the program will wait until that ammount of time has passed until proceeding with the program. Example:
::
#include timer
output('Hello,\n')
waitSeconds(8)
output('World!\n')
In the code above would output 'Hello,', wait 8 seconds, and then output 'World!'. The other function, ``currentTime()``, takes in 0 perameters, and returns the current time.

Regex Module:
########
See regex documentation for Python https://docs.python.org/3/library/re.html

System Module:
########
The system module currently only has 2 functions: ``blockStdout()`` and ``enableStdout()``, ``blockStdout()`` blocks the stdout, and ``enableStdout()`` reenables it.

Closing:
########
Thats it for now! More features will be added in the future, and syntax will change so make sure to keep up to date with the docs! Thanks!

0 comments on commit 13f5bb7

Please sign in to comment.