Skip to content

This project implements a readable syntax for the Wolfram Language which is based on newline and indention.

Notifications You must be signed in to change notification settings

weihongliang233/Readable-Wolfram-Language

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Readable-Wolfram-Language

Wolfram language(Mathematica) is a Lisp-like programming language. It's code is actually abstract syntax tree / S-expression.

Traditional Lisp syntax lacks readability, and there is a Readable Lisp S-expressions Project . Our readable-WL project implements similar indention and newline based syntax.

Example:

g    
    a
        b+c
        (*comments*)
        d
            e


    a
        
        b[c,d,e]
        
        d
            e

Translate it into normal WL expression.

Transform[test]

(* g[a[b + c, d[e]], a[b[c, d, e], d[e]]] *)

Import the Wheel.wl file and you can use the translator.

<<"Wheel.wl";
test=
"
g    
    a
        b+c
        (*comments*)
        d
            e


    a
        
        b[c,d,e]
        
        d
            e
";

Transform[test]
(* g[a[b + c, d[e]], a[b[c, d, e], d[e]]] *)

Known Issues

  1. Evaluation Control.

    The translator uses ToExpression. During the lexical analysis, the expression is synchronously evaluated, which is in a different order than the standard evaluation order of WL.

  2. String, Code Injection

    a = ToString[1 + "2"];
    b = ToExpression[a];
    a == b
    (*False*)

TODO

  1. Translate normal WL expression into readable-WL.
  2. Deal with issue1.

About

This project implements a readable syntax for the Wolfram Language which is based on newline and indention.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published