arturo

Simple, modern and portable interpreted programming language for efficient scripting


Keywords
nim, vm, programming, rebol, ruby, haskell, functional, homoiconic, arturo, bytecode, functional-programming, interpreter, language, programming-language, stack-based, virtual-machine
License
MIT
Install
nimble install arturo

Documentation

Arturo

Simple, expressive & portable
programming language for efficient scripting

License Language Build Status Chat on Discord



The Language

Arturo is an independently-developed, modern programming language, vaguely related to various other ones - including but not limited to Logo, Rebol, Forth, Ruby, Haskell, D, SmallTalk, Tcl, and Lisp.

The language has been designed following some very simple and straightforward principles:

  • Code is just a list of words and symbols
  • Words and symbols within a block are interpreted - when needed - according to the context
  • No reserved words or keywords - look for them as hard as you can; there are absolutely none
factorial: function [n][
	if? n > 0 -> n * factorial n-1
	else 	  -> 1
] 

loop 1..19 [x]->
	print ["Factorial of" x "=" factorial x]

Simple, isn't it?

💡 For more - working - examples, just have a look into the /examples folder

Documentation

For more information about the language and access to the official Reference, please visit the Arturo Programming Language Reference wiki.

Language Reference Language Reference Language Reference Language Reference
Getting Started Language Reference Command Line Library Reference

Installation

The easy way

curl -sSL https://get.arturo-lang.io | sh

Copy-paste the code above in your terminal and Arturo's most recent stable version will be automatically installed. To get the most recent (nightly) build, just use: curl -sSL https://get.arturo-lang.io/latest | sh

If there is any issue with the installation, just let me know and I'll try to fix it. In this case, try one of the methods below.

Manually

💡 Arturo should compile practically everywhere: Windows, Linux, BSD, Mac OS - even Android. If you encounter an issue, or your OS is not supported, drop me a line!

If you want to have the latest cutting-edge version of Arturo, the easiest and most bulletproof way is to build it yourself.

What you'll need first

  • Nim compiler
    if you don't have it installed, all it'll take is 2 simple commands:

    curl https://nim-lang.org/choosenim/init.sh -sSf | sh
    choosenim stable
    
  • Dependencies (only for Linux):

    • gtk+-3.0 (* needed only for non-mini builds)
    • webkit2gtk-4.0 (* needed only for non-mini builds)
    • libgmp-dev

Build & Install Arturo

What you need to do in order to build Arturo and install it is clone this repo and run the installation script.

All the process in a nutshell:

git clone https://github.com/arturo-lang/arturo.git
cd arturo
./install

After this, Arturo will be installed in ~/.arturo/bin. Just make sure the aforementioned path is in your $PATH as per the installation script instructions.

💡 For mini builds - that is without GTK dependencies and a tiny bit less library functions - just install via ./install mini

Pre-built binaries

Arturo also comes with its own pre-built binaries (for now, for Linux and macOS). All you have to do is download one of them and run it - that's it!

For stable versions, you may check out one of the "official" releases.

For being as up-to-date as possible, head over to the Nightlies repo and simply download the latest release.

Alternative ways

Docker

Although it won't cut it, if what you need is the real-deal compiler for everyday use, if you just need a taste of it, the Docker image will absolutely do.

Just use the existing docker image:

docker run -it arturolang/arturo

or (to run a specific local script):

docker run -it -v $(pwd):/home arturolang/arturo <yourscript.art>

Homebrew

If you are on macOS, you can easily install Arturo using Homebrew as well - although I cannot guarantee it will be the latest version:

brew install arturo

Editors & IDEs

If you prefer to use some specific editors, check which one is already supported (if your preferred editor is not yet supported, just drop me a line - or help me include it):

Fonts

The font you use is a matter of personal taste. However, if you still want to know the "official" preference and make Arturo's symbols shine, then I'd strongly recommend you use Fira Code with ligatures turned on. ;-)

Showcase

Modern cross-platform webview-based desktop apps
without HTML/CSS/JS


Portable, Serverless & Lightweight
SQLite-based Graph Database

Contributing

Please read docs/CONTRIBUTING.md for more details and the process for submitting pull requests.

In a few words: all contributions (even if they are just ideas or suggestions) are 100% welcome!

Roadmap

The list of things to fix and/or add could be endless. But here is one, a bit prioritized (if you think you can help, you know the way ;-):

  • Add support for big number handling (via GMP)
  • Enrich the system library
    • Add built-in support for Databases (Sqlite, etc)
    • Implement HTML module
    • Add more Server-related features
    • Implement LaTeX generation module
    • Add custom grammar parser functionality
  • Optimize and refine the bytecode
  • Improve VM performance
  • Add the option of saving intermediate bytecode
  • Add support for a package manager
  • Add UI support (via libui? via webview? both?)
  • Explore different uses of Arturo's dialecting capabilities (SDLs)
  • Implement a basic Arturo compiler (written in Arturo 😊)
  • Go full self-hosted (that's an ambitious one, I know...)

Project structure

To get an initial idea of the project, here's a brief guide to where is what:

Location Description
bin/ The destination of the final binary after compilation
examples/ A list of working examples in Arturo
src/ The main source folder
src/extras/ 3rd party open-source code used by Arturo
src/helpers/ Useful helper methods grouped by category and used mostly by library functions
src/library/ The Arturo standard library functions, grouped by category
src/system/ Components of the Arturo binary, written in Arturo (the REPL, the packager, etc)
src/vm/ The Virtual Machine
src/vm/bytecode.nim A list of all the VM bytecodes along with their description
src/vm/env.nim VM Environment handling (paths, etc)
src/vm/eval.nim The evaluator: where the parse tree turns into bytecode instructions
src/vm/exec.nim The most important VM module, where the main loop is triggered
src/vm/parse.nim The main lexer/parser: turning the initial input into a parse tree, of words, symbols and values
src/vm/stack.nim Manipulation code for the different stacks used by the VM
src/vm/value.nim The main Value object for our Virtual Machine along with numerous overloads, from initialization methods to printing and basic arithmetic
src/arturo.nim The main entry; where all the magic begins
tests/ Different unit tests
tools/ Various tools, documentation generation, etc
version/ Main version & build numbers

The Compiler

The main compiler is implemented in Nim/C as a Bytecode interpreter / Stack-based VM and should run in most architectures.

The main goals are: expressiveness, brevity, performance and portability. (With that exact order)

General schema

Community

In case you want to ask a question, suggest an idea, or practically anything related to Arturo - feel free! Everything and everyone is welcome.

For that, the most convenient place for me would be the GitHub Issues page.

For questions, quick ideas, and discussing generally the language, there is also a dedicated Discord Server for all things Arturo and a Gitter community -- which I will hopefully get familiar with at some point (lol).

Stargazers over time

License

MIT License

Copyright (c) 2019-2021 Yanis Zafirópulos (aka Dr.Kameleon)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.