clarkduvall / jsol Goto Github PK
View Code? Open in Web Editor NEWJSON programming language
License: Apache License 2.0
JSON programming language
License: Apache License 2.0
JSOL: JavaScript Object Language JSOL is an interpreted language represented by JSON. Since any JSOL program is completely written in JSON, its data structures and functions can be represented (and edited) in any language that has a JSON parser and JSOL interpreter. This allows for easy passing of complete programs between applications. PSOL is a cleaner syntax for JSOL. A PSOL program can be parsed into JSOL using parser.py. Examples of PSOL can be found in the examples/psol directory, or in test_data/psol. Check out http://jsol.org for an online JSOL/PSOL playground. This is the very first version, so there are many improvements to be made. Features - Closures - First class functions - String, list, number, dictionary, null, and function types - Fully representable in JSON. - Easily extendable with modules (see examples/file_reader.jsol). Syntax Basic - '{"a": 5}' -> assignment - '"add": {...}' -> function definition - '["add", "a", "b", "a"]' -> function call - '{"lit": "hello"}' -> string literal - '["import", {"lit": "file"}]' -> import a module Lists - '{"lit": [1, 2, 3]}' -> list literal - '["l", 0]' -> get first element in list - '["l", 0, 5]' -> set first element in list to be 5 - '["del", "l", 0]' -> delete and return first element in list - '["ins", "l", 0, 5]' -> insert 5 into the beginning of the list Dictionaries - '{"lit": {"a": 5, "b": 2}}' -> dictionary literal - '["d", {"lit": "a"}]' -> get the value with the key "a" - '["d", {"lit": "a"}, 5]' -> set "a" to be 5 in the dictionary If block - '["if", | <cond>, [...], | <cond>, [...], | ... | [...] | ]' -> if/else Examples The examples/jsol directory has some example programs. Run examples by typing 'jsol.py examples/jsol/<name_of_example>' - fib.jsol - outputs the Fibonacci sequence using a closure - recursive.jsol - an example of a recursive function - quick_sort.jsol - an example of sorting a list by passing in a compare function - file_reader.jsol - prompts the user for a filename and then prints the file to the screen. Uses the 'file' module. - passer.py - ./passer.py (in main directory) illustrates passing a JSOL program between applications - editor.py - ./editor.py shows how a JSOL program can be edited on the fly Most of these examples also have a PSOL version in examples/psol. Run these by typing 'parser.py examples/psol/<name_of_example>' Testing Run tests using 'run_tests.sh' Future - Better error handling/messages. - More examples. - Documentation. - Porting into other languages (probably starting with JavaScript). Created by Clark DuVall http://clarkduvall.com
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.