clseibold / Lydrige

Lydrige is a simple statically typed interpreted programming language inspired by lisp and C.
https://www.krixano.x10host.com/projects/Lydrige/
MIT License
6 stars 0 forks source link
c interpreter language lisp mpc

Lydrige (Version 0.6.0 alpha)

license Build Status Stories in Ready

View Docs on my Website here. It currently contains almost all of the information provided in this README file in a more organized fashion. For prebuilt downloads, click here. Eventually, most of the documentation in this README file will no longer be provided here, but instead will be provided on the Website (with exception to compilation details, which will be kept in this README file).

Contents

  1. Introduction
  2. Basic Syntax
  3. Builtin Functions
  4. Data Types
  5. Examples
  6. Compiling the Interpreter and Running Examples
  7. Sublime Text tmLanguage File
  8. License

1. Introduction

Lydrige is a simple statically typed interpreted programming language inspired by Lisp. Although originally inspired by Lisp, there are some changes which make the Syntax of the language appear more C-like. Right now the language supports: functions, lists, list-manipulation, input, string, casting, casting a string into different values (string to int, etc.), and more!

You can find even more information about this language on my website at http://krixano.x10host.com/Lydrige, which includes:

2. Basic Syntax

The syntax is similar to the syntax in Lisp. You have an expression that has other expressions or data inside and is separated by spaces. When evaluating an expression, the first item should be a function. This is, however, not needed for List Literals and Q-Expressions. Here is an example of the syntax of a simple print statement: (print "This number evaluates to" (+ 1 1)). This print statement returns () but does print out the arguments to the screen before the return.

You can view an example of what a simple program would look like in version 0.6.0 when this version is complete in the examples/0.6.0NewSyntax.lydg file. This file explains many of the different features of the language and includes changes in version 0.6.0a. This version is not ready to be able to interpret this file yet. However, there are some examples that will work with the current feature-set in the Examples section below.

3. Builtin Functions

Here are the builtin functions in the language. Many of these builtin functions are very common, therefore they were written directly into the interpreter rather than a library. Note that this list does not include the basic operators and conditionals (ex: +, -, *, /, %, ^ (power), ==, >, <, >=, <=, !=), however, they do exist within the langauge.

4. Data Types

Here are all of the data types in Lydrige and how you represent them within the language:

5. Examples

There are examples of programs/functions written in this language in the examples directory. Note that this directory contains code that only works for v0.5.0! It will not work with this version! This directory also includes prelude.lydg, the Prelude for the language, which is auto-loaded in the REPL and in every lydrige program (although, this is not the case for v0.6.0 until the interpreter has been fully rewritten). You can also find files for each of the Standard Library "modules" in the stdlib directory. A sample of how I envision the language to look when v0.6.0 is released can be found in the examples/0.6.0NewSyntax.lydg file.

Until Lydrige is fully rewritten, these examples won't currently work. However, some examples that do currently work are provided below:

6. Compiling the Interpreter and Running Examples

Linux/Mac (requires gcc or clang)

Run make debug to make the debug build or make release to make the release build. To run the debug build, enter make run-debug, and for the release build, enter make run.

Windows (requires mingw/mingw-w64 or clang)

GCC: Run build.bat gcc x64 for 64-bit, or build.bat gcc x86 for 32-bit.
Clang: Run build.bat clang x64 for 64-bit, or build.bat clang x86 for 32-bit.
MSVC: Run build.bat msvc x64 for 64-bit, or build.bat for 32-bit.

To start the program, run build.bat run.

FreeBSD (requires devel/gmake)

You must install devel/gmake in order to use the Makefile. Run gmake debug to make the debug build or gmake release to make the release build. To run the debug build, enter gmake run-debug, and for the release build, enter gmake run.

7. <a name='sublime-text-tmlanguage-7>Sublime Text tmLanguage File

I have provided a tmLanguage file to get Syntax Highlighting for Lydrige in Sublime Text. It is not complete yet, as there are still a few bugs and other things to implement.

8. License

See LICENSE.md and LICENSE-3RD-PARTY.txt

Lydrige Version v0.6.0a Copyright (c) 2016-2017, Christian Seibold All Rights Reserved. Under MIT License

Uses MPC Library under the BSD-2-Clause License Copyright (c) 2013, Daniel Holden All Rights Reserved https://github.com/orangeduck/mpc/

Uses Linenoise Library under the BSD-2-Clause License Copyright (c) 2010-2014, Salvatore Sanfilippo Copyright (c) 2010-1013, Pieter Noordhuis https://github.com/antirez/linenoise/