CalcuList: a Functional Language Extended with Imperative Features
CalcuList (Calculator with List manipulation), is an educational language for teaching functional programming extended with some imperative and side-effect features, which are enabled under explicit request by the programmer. In addition to strings and lists, the language natively supports json objects. The language adopts a Python-like syntax and enables interactive computation sessions with the user through a REPL (Read-Evaluate-Print-Loop) shell. The object code produced by a compilation is a program that will be eventually executed by the CalcuList Virtual Machine (CLVM).
💡 Research Summary
The paper presents CalcuList, an educational programming language that blends a functional core with optional imperative features. CalcuList’s name stands for “Calculator with List manipulation”. Its design philosophy is to enforce pure functional programming by default—functions cannot access or modify global state—while allowing side‑effects only when the programmer explicitly enables them. This contrasts with languages such as Haskell, where side‑effects are encapsulated in monads; CalcuList instead relies on an attribute‑grammar based semantic framework that checks, at compile time, whether a function touches any global variable. If a function does not contain any side‑effecting statements, it is guaranteed to be pure.
The language adopts a Python‑like syntax and is accessed through a REPL (Read‑Evaluate‑Print‑Loop) shell. Basic types include double (64‑bit floating point), int (32‑bit), char (Unicode), bool, null, and a meta‑type “type”. Compound types are immutable strings, mutable lists, and mutable JSON objects (JavaScript Object Notation). Functions are first‑class values; they are defined by a name, a parenthesized comma‑separated parameter list, a colon, and an expression that computes the return value. No explicit type annotations are required for parameters or return values; static type checking is performed only for constant literals, while the rest of the type checking occurs dynamically at run time.
Arithmetic operators (+, –, *, /, //, %) behave like in Java/Python, with automatic promotion to the most general numeric type. The + operator is overloaded to concatenate strings and lists. Comparison operators work on numbers, booleans (false < true), and strings (lexicographic order). Equality/inequality can compare values of any type. Logical operators follow Java syntax (!, &&, ||) with short‑circuit evaluation.
Strings are immutable; slicing syntax s
Comments & Academic Discussion
Loading comments...
Leave a Comment