Code Monkey home page Code Monkey logo

aria's Introduction

aria

A tiny, easily embeddable lisp-shaped language implemented in C89.

(do

  (= fib (fn (n)
    (if (>= n 2)
        (+ (fib (- n 1)) (fib (- n 2)))
        n)))

  (print (fib 20))) ; prints 6765

Overview

  • Supports numbers (floats), symbols, strings, pairs, lambdas, macros
  • Stack tracebacks with filename and line numbers on error
  • Exception-like error handling
  • Simple implementation and garbage collector
  • Easy-to-use C API

License

This library is free software; you can redistribute it and/or modify it under the terms of the MIT license. See LICENSE for details.

aria's People

Contributors

rxi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aria's Issues

f_exit kills the host app instead of returning control.

Problem:
Calling (exit) in the aria code kills the host application. This happens because (exit) calls the c-language exit function.

Proposed Solution

  1. Adding an int in_shutdown flag and int exit_code member to ar_State will allow the hosting application to examine the result. (For more complex results consider using ar_Value* for the result code instead.)
  2. To do this you'll need to alter any loops that could execute infinitely as the result of an aria-script.
  3. I can make the fix for you if you would like. (I've got 4 alterations for my needs going right now. I'll separate them out if you agree.)

Recommendation: move the UNUSED macro to aria.h

Use Case
The consuming developer wishes to embed an aria console in their application, modeled on the sample main function.

Estimated Impact
Cons: Potential for human error during copy and paste.
Pros: It keeps the coding style neat and consistent with the rest of aria and provides an "out of the box" compilable solution for beginning programmers who want to start extending and embedding aria in another application.

LOW PRIORITY Enhancement Request: Allow explicit garbage collection

This is low priority, but I thought I'd toss it out there.

I tinker with microcontrollers. Lately I've been using aria on a NUCLEOF411RE. It has a whopping 96K of RAM (this is actually large for microcontrollers). I foresee needing to explicitly do garbage collection, in some aria programs, in order to keep enough RAM free to stay operational.

Use secure versions of sprintf, fopen, and wsprintf

Use Case:
Consuming applications need to be as secure as possible. They can be no more secure than their least secure component. By securing the features using these functions you improve the security of client applications.

Estimated Impact:

Cons: There will be some extra coding will need to be done around fopen_s as it returns an error code value.
Pros:

  1. using fopen_s this will more easily allow the code to give more meaningful interpretations of various file system errors, vs, just a simple success/failure on file access.
  2. Doing the rest give peace of mind to consumers.
  3. Some compiler settings will prevent compilation if using the insecure alternatives. Making these changes will allow people to retain stringent security checks in their compilers without special casing the code in aria.c.
  4. I can submit these changes to you if you would like. (I'm 99% done. I've not properly used the return code from fopen_s yet)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.