Bastard son of Python and Haskell, and failed Scratch
- code.sqy Example of code written in Squancy. Ejemplo de código escrito en Squanchy.
- example.md Parser test example, see the AST. Ejemplo para comprobar el parser y ver el AST generado.
- ir_code.md Comprobar la generacin de código intermedio LLVM y compilación.
Squanchy is a brand new, easy to learn, general purpose, multi-paradigm, compiled programming language created by:
- Marcos V mv-lab
Student at University of Valladolid. Alumno de la Universidad de Valladolid.
Work on the language began on September, 2018.
Related to the courses: Algorithms and computing, Formal Grammars and Languages. Asignaturas relacionadas: Algoritmos y Computación, Gramáticas y Lenguajes formales.
The language is written from scratch (it includes an integrated lexer, parser, code generator etc).
Why?
- Python is lit, that's all, arguably one of the best programming languages ever.
- I wrote the same code in Haskell and Java. Now you see how concise, clean, and perfect is Haskell code:
final int LIMIT = 50;
int[] a = new int[LIMIT];
int[] b = new int [LIMIT-5];
for (int i=0; i< LIMIT; i++){
a[i] = (i+1)*2;
if (i >= 5) b(i-5)= [i];
}
let a = [2,4...100]
let b = drop 5 a
So I tried to put together Python and Haskell (or at least the main features from both) in Squanchy.
This project is licensed under the GNU General Public License v3.0 - see the LICENSE.md file for details
Here is Fibonacci demo program written in Haskell and Squanchy. You can see more code example in example.
fib x
| x < 2 = 1
| otherwise = fib (x - 1) + fib (x - 2)
fib 1 = 1
fib 2 = 2
fib x = fib (x - 1) + fib (x - 2)
Squanchy:
fib (x) -> y ::
if x<2 then y:1 else y: fib(x-1)+fib(x-2)
fib (1) -> 1
fib (2) -> 2
fib(x) -> fib(x-1) + fib(x-2)
If you want to program in Squanchy now, see the tutorials for how to get started.
The features that are currently implemented are as follows:
- Primitive data types
List
,String
,Int
andDouble
- Operators (
+
,-
,*
,/
,**
,%
,:
,=
,>
,<=
,and
,or
, etc.) - Flow control (if/the/else, while loop)
- Constants and global variables
- Lists, Tuples and access
- Functions
- Lambda
The following features are coming soon:
- Flow control (ternary ?, for)
- Data structs
- Dictionaries
- array (like numpy)
- more default functions
- fixed visualisation module
- ...
This is an open source project.
- Gabriel Rodríguez Canal @gabrielrodcanal
You want to contribute? Please do! The source code is hosted at GitHub. If you want something, open an issue or a pull request. If you need want to contribute but don't know where to start, take a look at:
This is the main documentation of the project, only Spanish version (for the moment). Also you can checkout down below all my sources in Bibliography
Before doing anything, see Code of Conduct
Contributing Code
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request
Check this out if you don't know how to start:
- Make it work
- Basic code generation
- Beautiful and Clean Code + documentation !!
- Add data structures and arrays
- IDLE for Squanchy: something easy and minimalist, just write & run like Jupyter.
- Work on the code optimization
- Update tutorials, documentation ...
- a ton of things more
- The Python Language Reference
- Compilers: Principles, Techniques, and Tools 2ed
- Let’s Build A Simple Interpreter
- Parsing Techniques: A Practical Guide
- Using Regular Expressions for Lexical Analysis
- Write your own lexer
- Eiben Github
- Parsing In Python: Tools And Libraries
Pratt Parser implementation.
- Top down operator precedence by Vaughan R. Pratt
- A New Approach of Complier Design in Context of Lexical Analyzer and Parser Generation for NextGen Languages
- Top down operator precedence
- Simple Top-Down Parsing in Python
- Top Down Operator Precedence by Douglas Crockford
- Pratt Parsers: Expression Parsing Made Easy
- Pratt Parsing and Precedence Climbing Are the Same Algorithm
- Review of Pratt/TDOP Parsing Tutorials
- A Pratt Parser implementation in Python
- A Guide to Parsing: Algorithms and Terminology
- Parsing text with Python