Giter Club home page Giter Club logo

baremetalisp-pine64's Introduction

baremetalisp

Serial Console

  • baud rate: 115200
  • no parity
  • 1 stop bit

Semantics of Typed Lisp

Literal

  • $LITERAL := $DECIMAL | $BOOL
  • $DECIMAL
    • decimal number
    • examples: 0, 100, 224, -130, 4457
  • $BOOL := true | false

Identifier

  • $ID
    • a string whose first character is not captal (not 'A' to 'Z')
    • excludes "true" and "false"

Type Identifier

  • $TID
    • a string whose first character is captal ('A' to 'Z')

Primitive Type

  • $PRIM := Int | Bool | $PRIM_LIST | $PRIM_TUPLE
  • $PRIM_LIST := '( $PRIM )
  • $PRIM_TUPLE := [ $PRIM+ ]

Type

  • $TYPE := Int | Bool | $TYPE_LIST | $TYPE_TUPLE | $TYPE_FUN | $TYPE_DATA
  • $TYPE_LIST := '( $TYPE )
  • $TYPE_TUPLE := [ $TYPE+ ]
  • $TYPE_DATA := $TID | ( $TID $PRIM* )
  • $TYPE_FUN := ( $EFFECT ( -> $TYPES $TYPE ) )
  • $EFFECT := Pure | IO
  • $TYPES := $TYPE | ( $TYPE* )

examples:

'(Int)
[Int Bool]
(Pure (-> (Int INT) Bool))
'('(Int Bool))
[Int Int '([Int Bool])]

Data Type

  • $DATA := ( data $DATA_NAME $MEMBER* )
  • $DATA_NAME := $TID | ( $TID $ID* )
  • $MEMBER := $TID | ( $TID $PRIM* )

examples:

(data Dim2
  (X Int)
  (Y Int))

(data (Maybe t)
    (Just t)
    Nothing)

Function Definition

  • $DEFUN := ( $HEAD_DEFUN $ID ( $ID* ) $TYPE_FUN $EXPR )
  • $HEAD_DEFUN := export | defun

Expression

  • $EXPR := $LITERAL | $ID | $LET | $IF | $MATCH | $LIST | $TUPLE | $APPLY

Let Expression

  • $LET := ( let ( $DEFVAR+ ) $EXPR )
  • $DEFVAR := ( $LETPAT $EXPR )
  • $LETPAT := $ID | [ $LETPAT ]

If Expression

  • $IF := ( if $EXPR $EXPR $EXPR )

List Expression

  • $LIST := '( $EXPR* )

Tuple Expression

  • $TUPLE := [ $EXPR+ ]

Match Expression

  • $MATCH := ( match $EXPR $MBODY+ )
  • $MBODY := ( $PATTERN $EXPR )
  • $PATTERN := _ | $LITERAL | $ID | [ $PATTERN+ ] | ( $TID $PATTERN+ )

Built-in Functions

  • cons: (-> (T '(T) '(T))
  • car: (-> '(T) (Maybe T))
  • cdr: (-> '(T) (Maybe '(T)))
  • nth: (-> (Int [T]) (Maybe T))
  • nth: (-> (Int '(T)) (Maybe T))

baremetalisp-pine64's People

Contributors

ytakano avatar

Watchers

 avatar

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.