logo

Jedi: An Experimental Language with Modern Features

4 Pages693 Words248 Views
   

Added on  2019-09-26

About This Document

Jedi is an experimental language that supports modern programming features like lambdas, closures, and dynamic type checking. Learn about Jedi's read-execute-print loop and packages, including Jedi Expressions and Jedi Values. Explore Desklib to get started.

Jedi: An Experimental Language with Modern Features

   Added on 2019-09-26

ShareRelated Documents
JediJedi is an experimental language that supports many features found in modern programming languages:Lambdas, closures, and static scopingEager and lazy executionBlocksVariablesObjectsDynamic type checkingA Jedi SessionJedi's read-execute-print loop (REPL) reads an expression string entered by the user, parses it into an expression object, executes the object, then prints the resulting value:-> 2 + 3 * 517-> 2.0 + 3 * 517.0-> def pi = 3.14ok-> pi3.14-> def square = lambda(x) x * xok-> square(7)49-> def area = lambda(r) pi * square(r)ok-> area(10)314.0-> pi < 3 && z < 10false-> zUndefined identifier: z-> if (pi < 3) x else 100100-> xUndefined identifier: x-> def count = var(0)ok-> countVariable(0.0)-> [count]0.0-> count = [count] + 1done-> [count]
Jedi: An Experimental Language with Modern Features_1
1.0-> while([count] < 100) count = [count] + 1done-> [count]100.0-> write("Hello world")Hello worlddone-> quitbyeNotes:Multiplication has higher precedence than additionConjunction (&&) and disjunction (||) use short-circuit execution (a form of lazy execution)Conditionals (if) use conditional execution (another form of lazy execution)Jedi PackagesJedi consists of three interdependent packages:Jedi ExpressionsNotes:
Jedi: An Experimental Language with Modern Features_2

End of preview

Want to access all the pages? Upload your documents or become a member.