Skip to content

ainsleymcgrath/myhy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

10 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

MyHy

Create novel Scheme-like DSL(isp)s using Python.

It has nothing to do with the MyPy or Hy projects.

Hello, World!

A Python file is the "source code" for your DSL.

Define functions in your language

The Lisp class is the entry point for creating DSLs. It provides an API for creating Lisp-y constructs.

# my_lisp.py
from myhy import Lisp

dsl = Lisp()  # an instance of Lisp() contains your entire 'language'


@dsl.function  # decorated Python functions become part of the DSL
def hello():
    return "Hello, MyHy!"

Execute expressions in your language

Use the myhy executable to use the language.

Use the CLI to execute text from stdin

Provide the path to your DSL (my_lisp:dsl) and some code:

myhy my_lisp:dsl -c "(hello)"

Functions registered in myhy can take arguments.

@dsl.function
def hello(addressee):
    return f"Hello, {addressee}!"
myhy my_lisp:dsl -c "(hello you)"

Use the CLI to execute text from a file

Write Lisp code to a file.

echo "(hello everyone)" > lisp.txt

Run it with the -f flag.

myhy my_lisp:dsl -f lisp.txt`

Use myhy-server

About

Create your own lisp πŸ‘… by writing Python functions 🐍

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages