/Shelf

A simple interpreter written in c that I made for learning purposes

Primary LanguageCGNU General Public License v3.0GPL-3.0


Shelf
Shelf Programming Language

A very simple interpreter that currently supports a few functions ↓ See Examples

Hello WorldSet VariableDefine FunctionBuiltin FunctionsLicense

--Pre-Alpha


About

This is a currently in a very early stage so don't expect anything good
If you would like to test this in its pre-alpha stage, please post issues on any bug you find

Making a "Hello World" program

First create a .shf file
The function to output text in the terminal is say()

say("Hello World");

Then you can run it with ./shelf(.exe) file.shf

Set a variable and say it

The syntax to make a variable is set variablename = "content";

set name = "John Doe";
say(name);

Define a function and call it

The syntax to make a function is define functionname(arguments){};

define _function(name){
  say(name);
};

_function("John Doe");

Wait until any key is pressed

The function to wait until a key is pressed is waitfkey() Example:

say("before");
waitfkey("Press any key to continue");
say("after");

Get user input

The function to get user input is readl() Example:

readl("Type your name > ");

Currently you can not store this into a variable

Comments

To make a inline comment you use // Example:

// This is a comment

To make a block comment you use /*(open)*/(close) Example:

/*
This is inside a block comment
:)
*/

Under progress, see Projects