The Gorilla Programming Language

Gorilla

Gorilla Programming Language

Gorilla is a tiny, dynamically typed, multi-engine programming language

It has flexible syntax, a compiler, as well as an interpreter.

The minimized executable size is only about 1.6 MB!

Download the latest release

Play it Online


Credits:

Icon: Binx

Owner
Comments
  • Feature: Right-to-Left parsing for exponentiation operator

    Feature: Right-to-Left parsing for exponentiation operator

    Is your feature request related to a problem? Please describe.

    Parsing for the exponentiation operator (**) is currently left-to-right, when mathematically it should be right-to-left. This could cause unexpected behavior when someone is implementing an algorithm.

    What type of feature are you requesting?

    Syntax/Parsing Improvement

    Please provide some examples of what Gorilla should be like with your feature.

    Gorilla image JavaScript image Python image

    Why should Gorilla have this? Give 2 to 5 reasons.

    Parsing for the exponentiation operator (**) is currently left-to-right, when mathematically it should be right-to-left. This could cause unexpected behavior when someone is implementing an algorithm.

  • Feature: Multiline array declarations

    Feature: Multiline array declarations

    With many languages, multiline array declarations work, and is pretty much required for 2+ dimensional arrays to look pretty when writing the code.

    The code snippets below work

    let oneDimArray = [1, 3, 6]
    
    display(oneDimArray)
    
    let twoDimArray = [[1, 5, 8],[3, 7, 2],[9, 4, 6]]
    
    display(twoDimArray)
    

    but in the case of the 2 dimensional array, that looks really wonky and can get bad fast with increased length or increased dimensions.

    The code snippets below should work, but return errors:

    let oneDimArray = [
      1,
      3, 
      6
    ]
    
    display(oneDimArray)
    
     parser errors:
    	[Line 1] Invalid Syntax: unexpected '; or newline'
    	[Line 2] expected ], got INT instead
    	[Line 2] Invalid Syntax: Expected Newline or ';', got 'INT'
    	[Line 2] Invalid Syntax: Expected Newline or ';', got ','
    	[Line 2] Invalid Syntax: unexpected ','
    	[Line 3] Invalid Syntax: Expected Newline or ';', got ','
    	[Line 3] Invalid Syntax: unexpected ','
    	[Line 5] Invalid Syntax: unexpected ']'
    
    let twoDimArray = [
         [1, 5, 8],
         [3, 7, 2],
         [9, 4, 6]
     ]
    
    display(twoDimArray)
    
     parser errors:
    	[Line 1] Invalid Syntax: unexpected '; or newline'
    	[Line 2] expected ], got [ instead
    	[Line 2] expected ], got , instead
    	[Line 2] Invalid Syntax: Expected Newline or ';', got ','
    	[Line 2] Invalid Syntax: unexpected ','
    	[Line 2] Invalid Syntax: Expected Newline or ';', got 'INT'
    	[Line 2] Invalid Syntax: Expected Newline or ';', got ','
    	[Line 2] Invalid Syntax: unexpected ','
    	[Line 2] Invalid Syntax: Expected Newline or ';', got 'INT'
    	[Line 2] Invalid Syntax: Expected Newline or ';', got ']'
    	[Line 2] Invalid Syntax: unexpected ']'
    	[Line 2] Invalid Syntax: Expected Newline or ';', got ','
    	[Line 2] Invalid Syntax: unexpected ','
    	[Line 3] Invalid Syntax: Expected Newline or ';', got ','
    	[Line 3] Invalid Syntax: unexpected ','
    	[Line 5] Invalid Syntax: unexpected ']'
    
    

    While you're at it, I also would like to propose that the "trailing comma" rule is implemented
    The trailing comma rule in most languages mean that if you have an array, dict, object, list, etc. there can be a singular extra comma at the end, which is useful for reducing the numbers of lines that are changed when commiting code to something like git.

  • Unexpected behaviour when doing operations between type String with type Integer

    Unexpected behaviour when doing operations between type String with type Integer

    When trying to do operations between a String and an Integer in this specific order Gorilla panics

    Example of comparison

    [0] >> "abc" == 10
    

    We expect to get false, but instead we get

    Gorilla 0.3
    [0]>> "abc" == 10
    panic: interface conversion: object.Object is *object.Integer, not *object.String
    
    goroutine 1 [running]:
    _/C_/Users/derek/Desktop/Code/Go_Projects/Gorilla/gorilla/eval.evalStringInfixExpression(0xc00000a10c, 0x2, 0xaadb20, 0xc000064540, 0xaada00, 0xc0000645a0, 0xc0000645a0, 0xc000064540)
            C:/Users/derek/Desktop/Code/Go Projects/Gorilla/gorilla/eval/eval.go:304 +0x5ce
    _/C_/Users/derek/Desktop/Code/Go_Projects/Gorilla/gorilla/eval.evalInfixExpression(0xc00000a10c, 0x2, 0xaadb20, 0xc000064540, 0xaada00, 0xc0000645a0, 0xc00003a0c0, 0x0)
            C:/Users/derek/Desktop/Code/Go Projects/Gorilla/gorilla/eval/eval.go:252 +0x7c5
    _/C_/Users/derek/Desktop/Code/Go_Projects/Gorilla/gorilla/eval.Eval(0xaac840, 0xc00003c0c0, 0xc00002e350, 0xaac840, 0xc00003c0c0)
            C:/Users/derek/Desktop/Code/Go Projects/Gorilla/gorilla/eval/eval.go:62 +0xe68
    _/C_/Users/derek/Desktop/Code/Go_Projects/Gorilla/gorilla/eval.Eval(0xaac6c0, 0xc00003a080, 0xc00002e350, 0xaac6c0, 0xc00003a080)
            C:/Users/derek/Desktop/Code/Go Projects/Gorilla/gorilla/eval/eval.go:37 +0xb38
    _/C_/Users/derek/Desktop/Code/Go_Projects/Gorilla/gorilla/eval.evalProgram(0xc000004520, 0xc00002e350, 0x1, 0x0)
            C:/Users/derek/Desktop/Code/Go Projects/Gorilla/gorilla/eval/eval.go:123 +0xc9
    _/C_/Users/derek/Desktop/Code/Go_Projects/Gorilla/gorilla/eval.Eval(0xaac940, 0xc000004520, 0xc00002e350, 0xc00000a100, 0xb)
            C:/Users/derek/Desktop/Code/Go Projects/Gorilla/gorilla/eval/eval.go:34 +0xc5
    _/C_/Users/derek/Desktop/Code/Go_Projects/Gorilla/gorilla/repl.Start(0xaac3e0, 0xc000006010, 0xaac400, 0xc000006018)
            C:/Users/derek/Desktop/Code/Go Projects/Gorilla/gorilla/repl/repl.go:40 +0x36c
    _/C_/Users/derek/Desktop/Code/Go_Projects/Gorilla/gorilla/gorilla.RunFile()
            C:/Users/derek/Desktop/Code/Go Projects/Gorilla/gorilla/gorilla/gorilla.go:23 +0x448
    main.main()
            C:/Users/derek/Desktop/Code/Go Projects/Gorilla/gorilla/main.go:8 +0x27
    

    Example of addition

    [0] >> "abc" + 10
    

    We expect to get a RuntimeError like this

     Runtime Error:
            [Line 1] type mismatch: STRING + INTEGER (When attempting to run 'abc + 10')
    

    But instead the program panics

    Gorilla 0.3
    [0]>> "abc" + 10
    panic: interface conversion: object.Object is *object.Integer, not *object.String
    
    goroutine 1 [running]:
    _/C_/Users/derek/Desktop/Code/Go_Projects/Gorilla/gorilla/eval.evalStringInfixExpression(0xc0000a20dc, 0x1, 0xaadb20, 0xc0000b6540, 0xaada00, 0xc0000b65a0, 0xc0000b65a0, 0xc0000b6540)
            C:/Users/derek/Desktop/Code/Go Projects/Gorilla/gorilla/eval/eval.go:304 +0x5ce
    _/C_/Users/derek/Desktop/Code/Go_Projects/Gorilla/gorilla/eval.evalInfixExpression(0xc0000a20dc, 0x1, 0xaadb20, 0xc0000b6540, 0xaada00, 0xc0000b65a0, 0xc0000d4080, 0x4)
            C:/Users/derek/Desktop/Code/Go Projects/Gorilla/gorilla/eval/eval.go:252 +0x7c5
    _/C_/Users/derek/Desktop/Code/Go_Projects/Gorilla/gorilla/eval.Eval(0xaac840, 0xc0000d0060, 0xc000088340, 0xaac840, 0xc0000d0060)
            C:/Users/derek/Desktop/Code/Go Projects/Gorilla/gorilla/eval/eval.go:62 +0xe68
    _/C_/Users/derek/Desktop/Code/Go_Projects/Gorilla/gorilla/eval.Eval(0xaac6c0, 0xc0000d4040, 0xc000088340, 0xaac6c0, 0xc0000d4040)
            C:/Users/derek/Desktop/Code/Go Projects/Gorilla/gorilla/eval/eval.go:37 +0xb38
    _/C_/Users/derek/Desktop/Code/Go_Projects/Gorilla/gorilla/eval.evalProgram(0xc0000984a0, 0xc000088340, 0x1, 0x0)
            C:/Users/derek/Desktop/Code/Go Projects/Gorilla/gorilla/eval/eval.go:123 +0xc9
    _/C_/Users/derek/Desktop/Code/Go_Projects/Gorilla/gorilla/eval.Eval(0xaac940, 0xc0000984a0, 0xc000088340, 0xc0000a20d0, 0xa)
            C:/Users/derek/Desktop/Code/Go Projects/Gorilla/gorilla/eval/eval.go:34 +0xc5
    _/C_/Users/derek/Desktop/Code/Go_Projects/Gorilla/gorilla/repl.Start(0xaac3e0, 0xc0000cc000, 0xaac400, 0xc0000cc008)
            C:/Users/derek/Desktop/Code/Go Projects/Gorilla/gorilla/repl/repl.go:40 +0x36c
    _/C_/Users/derek/Desktop/Code/Go_Projects/Gorilla/gorilla/gorilla.RunFile()
            C:/Users/derek/Desktop/Code/Go Projects/Gorilla/gorilla/gorilla/gorilla.go:23 +0x448
    main.main()
            C:/Users/derek/Desktop/Code/Go Projects/Gorilla/gorilla/main.go:8 +0x27
    

    The first one is most likely a bug, because comparisons between different type should return true or false, as they do when you put first the Integer and then the String.

    Gorilla 0.3
    [0]>> 10 == "abc"
    false
    

    On the other hand a binary operation between different types can be an error but this one is probably a bug. The reason being that if you try and do the same operation but letting the left expression be an Integer and the right one be a String you indeed get a RuntimeError and the program doesn't panic.

    Gorilla 0.3
    [0]>> 10 + "abc"
     Runtime Error:
            [Line 1] type mismatch: INTEGER + STRING (When attempting to run '10 + abc')
    

    All operations except multiplication where the left expression is a String and the right one is an Integer panic. By operations I mean Add (+), Substract (-), Multiply (*), Divide (/), Less Than (<), Greater Than (>), Less Than or Equal (<=), Greater Than or Equal (>=), Equal (==) and Not Equal (!=)

  • Feature: Disregard newlines between function header and body

    Feature: Disregard newlines between function header and body

    I can't use the {} brackets in a new line; e.g.

    func hello (any){
    println("hello" + any")
    }
    

    ^this works, but when i use:

    func hello (any)
    {
    println(any)
    }
    

    it returns an error.

  • Allocations and Garbage collector; Use reference/pointer for all gorilla objects.

    Allocations and Garbage collector; Use reference/pointer for all gorilla objects.

    Allocations and Garbage collector; Use reference/pointer for all gorilla objects. Variables should point to a pointer instead of cloned object. Vector should contain pointers as well. Probably need a vm-level allocator and pass it through functions. Not sure how to do the gc though.

  • Extremely slow on if/else statements (Jump, JumpIfFalse)

    Extremely slow on if/else statements (Jump, JumpIfFalse)

    In Gorilla 1.0, Jump and JumpIfFalse instructions work extremely slow. A simple program adding a single if statement slows down by 2 seconds (average 0.2 second per loop). I currently have no idea how to fix it.

  • Add error & return checking for while loop

    Add error & return checking for while loop

    Allows errors to be caught when there are errors inside of a while loop.

    If there is an explicit return value statement, that stops the loop too

    All tests pass (I didn't make any new tests) image

  • Add simple string indexing (and added string indexing test cases)

    Add simple string indexing (and added string indexing test cases)

    Title really says it all.

    Just like arrays have indexing, strings do too now.

    display("Expects 'e'")
    display("Hello"[1]) # Expects "e"
    
    display("Expects 'r'")
    display("Wowzers"[5]) # Expects "r"
    
    display("Expects 'd'")
    let str = "Lorem ipsum dolor sit amet.";
    let str = "padding" + str + "padding";
    display(str[19]) # Expects "d"
    

    Output: image

    Continues to keep old tests working, and passes my tests image

    Once I found where I needed to modify stuff, Go was a relatively ok language to code in. Most of my code was just copy/pasting and modifying to what I needed to modify to get things working. I did have a lot of trouble with this part:

    retString := object.NewString(string(stringObject.Value[idx]), stringObject.Line())
    return retString // stringObject.Value[idx]
    

    because I don't think I should be creating a NewString object, but it at least works I guess.

    Note:

    This PR also adds *.exe to the .gitignore file. If you don't want that change, remove that part.

  • Add .toStr() method to all data types, except booleans & null

    Add .toStr() method to all data types, except booleans & null

    The problem with this is that booleans & null don't have a .toStr() property, and I don't know how to add them, if that's even possible. Another way I thought of doing this is to maybe make a str(anyObject) function, so let me know if that'd be the preferred way. I just added .toStr() since that was the one already used by ints

    Passes all tests, as expected image

Jan 4, 2022
An effective time-series data compression/decompression method based on Facebook's Gorilla.

Gorilla This package provides the effective time-series data compression method based on Facebook's Gorilla.. In a nutshell, it uses delta-of-delta ti

Sep 26, 2022
Unit tests generator for Go programming language
Unit tests generator for Go programming language

GoUnit GoUnit is a commandline tool that generates tests stubs based on source function or method signature. There are plugins for Vim Emacs Atom Subl

Jan 1, 2023
FreeSWITCH Event Socket library for the Go programming language.

eventsocket FreeSWITCH Event Socket library for the Go programming language. It supports both inbound and outbound event socket connections, acting ei

Dec 11, 2022
Simple interface to libmagic for Go Programming Language

File Magic in Go Introduction Provides simple interface to libmagic for Go Programming Language. Table of Contents Contributing Versioning Author Copy

Dec 22, 2021
Elastic is an Elasticsearch client for the Go programming language.

Elastic is an Elasticsearch client for the Go programming language.

Jan 9, 2023
👩🏼‍💻A simple compiled programming language
👩🏼‍💻A simple compiled programming language

The language is written in Go and the target language is C. The built-in library is written in C too

Nov 29, 2022
Lithia is an experimental functional programming language with an implicit but strong and dynamic type system.

Lithia is an experimental functional programming language with an implicit but strong and dynamic type system. Lithia is designed around a few core concepts in mind all language features contribute to.

Dec 24, 2022
accessor methods generator for Go programming language

accessory accessory is an accessor generator for Go programming language. What is accessory? Accessory is a tool that generates accessor methods from

Nov 15, 2022
Http web frame with Go Programming Language

Http web frame with Go Programming Language

Oct 17, 2021
A modern programming language written in Golang.

MangoScript A modern programming language written in Golang. Here is what I want MangoScript to look like: struct Rectangle { width: number he

Nov 12, 2021
A stack oriented esoteric programming language inspired by poetry and forth

paperStack A stack oriented esoteric programming language inspired by poetry and forth What is paperStack A stack oriented language An esoteric progra

Nov 14, 2021
Oak is an expressive, dynamically typed programming language

Oak ?? Oak is an expressive, dynamically typed programming language. It takes the best parts of my experience with Ink, and adds what I missed and rem

Dec 30, 2022
Besten programming language

Besten What holds this repository? Besten Lexer Besten Parser Besten Interpreter Besten Module Loader Besten Lexer Located in ./internal/lexer A set o

Jun 13, 2022
🎅 A programming language for Advent of Code.

?? Adventlang My blog post: Designing a Programming Language for Advent of Code A strongly typed but highly dynamic programming language interpreter w

Dec 28, 2022
An experimental programming language.

crank-lang An experimental & interpreted programming language written in Go. Features C like syntax Written in Golang Interpreted Statically Typed Dis

Dec 6, 2021
Gec is a minimal stack-based programming language

Gec is a minimal stack-based programming language

Sep 18, 2022
Functional programming library for Go including a lazy list implementation and some of the most usual functions.

functional A functional programming library including a lazy list implementation and some of the most usual functions. import FP "github.com/tcard/fun

May 21, 2022
Flow-based and dataflow programming library for Go (golang)
Flow-based and dataflow programming library for Go (golang)

GoFlow - Dataflow and Flow-based programming library for Go (golang) Status of this branch (WIP) Warning: you are currently on v1 branch of GoFlow. v1

Dec 30, 2022