Coder Social home page Coder Social logo

bergerapi / acl Goto Github PK

View Code? Open in Web Editor NEW
10.0 2.0 1.0 851 KB

A simple scripting language made in c++

License: GNU General Public License v3.0

CMake 0.49% C++ 97.79% Python 1.72%
interpreter language script script-language scripting scripting-language

acl's Introduction

ACL

ACL is a simple and easy to learn language.

ACL is a compiled language, made with C++. For code examples look at the examples/ folder.

We would appreciate a star or even a fork.

Syntax

<_> = required, [_] = optional. Conditions can be surrounded in () if you wish, and you may also end lines in ;.

Keywords

  • Variable declaration - let <varName>

  • If statement - if <condition> {}

  • Else statement - else [if <condition>] {}

  • For loop - for <var> in range([from], <to>) {}

  • While loop - while <condition> {}

  • Import - import <file>

continue and break are supported in loops.

Operators

  • Assignment - =
  • Addition - +
  • Subtraction - -
  • Multiplication - *
  • Division - /
  • Mod - %
  • String concate - +
  • Equal to - ==
  • Lesser than - <
  • Lesser than or equal to - <=
  • Greater than - >
  • Greater than or equal to - >=
  • And - &&
  • Or - ||

acl's People

Contributors

bergerapi avatar iamcheeseman avatar peu77 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

iamcheeseman

acl's Issues

Add switch statement

with either of these syntaxes:

switch h {
    case "h" {
        println(h)
    }
    default {}
}

or

switch h {
    case "h":
        println(h)
    default:
        code()
}

Conditional assignment

With syntax similar to one of these:
let thing = "h" if condition else "g"
let thing = if condition "h" else "g"

String concatenation breaks with math

Was making a fibbnaci program, wrote this:
println("iter #" + i + 1 + ": " + x)
Output was:

iter #01: 1
iter #11: 1
iter #21: 2
...

I could fix it by doing this instead:
println("iter #" + (i + 1) + ": " + x)

Add constants

No constants wouldn't be an issue if it weren't for booleans.

Error Handling like Rust

Is your feature request related to a problem? Please describe.
My problem is, that I have code which doesn't work, and the system, just gives me a dumb runtime error, without any informations about the error.

Describe the solution you'd like
Like Rust:
image

While loop is executing one time after it should

Code:

let true = 1
let false = 0

let inWhile = true

let i = 1
while inWhile {
    print("While loop is at " + i)
    if i == 5 {
        inWhile = false
        print("Exiting while loop!")
    }
    i = i + 1
}

Output:

While loop is at 1
While loop is at 2
While loop is at 3
While loop is at 4
While loop is at 5
Exiting while loop!
Exiting while loop!

Import entire folders

Is your feature request related to a problem? Please describe.
If I wish to import every file from a folder, i would have to write

import folder/foo.acl
import folder/bar.acl
import folder/fizz.acl
import folder/baz.acl

Describe the solution you'd like
If you import a folder, it automatically walks the folder and imports every .acl from within
The above example would instead be written as

import folder

Describe alternatives you've considered
Perhaps it would make sense to instead

import folder/*.acl

Perhaps this could be added in tandem and have import folder simply be syntax suger, but that would require more complex parsing of the import string, and may simply be unnecessary. In this example, the *.acl approach would be cumbersome.

import outerFolder

versus;

import outerFolder/*.acl
import outerFolder/*/*.acl #You have to specify how many folders deep a file is that you're looking for

Additional context
std could simply be a folder of the standard folders, importing specifically math could be

import std/math.acl

I feel this to be a clean approach

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.