Coder Social home page Coder Social logo

pounce-lang / js-core Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 0.0 852 KB

Core elements of a Pounce (pounce-lang) interpreter, parser, preprocessor written in TypeScript. Pounce types are being developed (a preprocess type checker is in beta)

Home Page: https://pounce-lang-show-case.netlify.app/

JavaScript 26.46% TypeScript 73.03% HTML 0.51%
joy-language forth-like concatenative-programming-language interpreter programming-language

js-core's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

js-core's Issues

implement `explain`

example
[0 1 [dup2 +] 3 times] explain -->

[] [0 1 [dup2 +] 3 times] 
[0 1 [dup2 +] 3 ] [times]
[0 1] [dup2 + [dup2 +] 2 times]
[0 1 0 1] [+ [dup2 +] 2 times]
[0 1 1] [[dup2 +] 2 times]
[0 1 1 [dup2 +] 2] [times]
[0 1 1] [dup2 + [dup2 +] 1 times]
[0 1 1 1 1] [+ [dup2 +] 1 times]
[0 1 1 2] [[dup2 +] 1 times]
[0 1 1 2 [dup2 +] 1] [times]
[0 1 1 2] [dup2 +]
[0 1 1 2 1 2] [+]
[0 1 1 2 3] []

if-else strict mode

type checking for if-else strict mode requires both paths have the same type footprint

cycleCount escape valve for purr

purr() should return an unfinished stack and program list (combined) if the maximum cycle count is exceeded. Same for the development interpreter.

Add Tree and Graph types to Pounce

without having to use nested lists to describe trees or graphs, give these structures their own syntax to express in a succinct way a well behaved tree or graph.

possibly:
Tree Graph

more thoughts and syntax refinement are needed

Allow ... in de-structuring for crouch and pounce

examples
[1 2 3 4] [head... last] [head last] crouch --> [1 2 3] 4
[1 2 3 4] [first tail...] [first tail] crouch --> 1 [2 3 4]
[1 2 3 4] [head middle... last] [head middle last] crouch --> 1 [2 3] 4
[1 2 3 4] [first second rest...] [first second rest] crouch --> 1 2 [3 4]
[1 2 3 4] [head... next2last last] [head next2last last] crouch --> [1 2] 3 4

new word decompose or decomp

If
[2 *] [twice] compose
and you wanted to change this word
[twice] decomp >>> [2 *]
built in words may decompose to some other words
or may just decompose the identity [+] decomp >>> [+]

rule out nested recite-with calls

compose (aka apply-with, invoke, induce, call, conjure, leap or pounce)
is powerful, but if nested it would probably be hard to predict (hilarity ensues).
So for now it should detect a nested case and warn or halt.

pattern naming for crouch and pounce

instead of having to stack shuffle like this

[1 0] # accumulator is a pair [acc index] the index is used to either multiply or add 
[swap uncons uncons drop [acc i] [acc [i 2 % 0 ==] [*] [+] ifte 1 i +] pounce [] cons cons] 
reduce```

if `crouch` and `pounce` could name elements in lists patterns and dis-assemble them, then less stack shuffling would be needed, like this
```[6 3 8 4 5 7 2 9 1] 
[1 0] # accumulator is a pair [acc index] the index is used to either multiply or add 
[[ele [acc i]] [ele acc [i 2 % 0 ==] [*] [+] ifte 1 i +] pounce cons-2 ] 
reduce```

``` [ [] cons cons ] [cons-2] compose ```

figure out how to store state in pounce

although state is stored on the stack, it is not really always the best place for all state storage concerns. possibly it is not the purest concatenative programming thought, to consider the storing a specific domains concern in a word. This is a thought experiment/branch that will propose and experiment with setting state (state machine and others) in various ways

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.