GithubHelp home page GithubHelp logo

interpreter's Introduction

mdeq Interpreter

$ make
$ ledit ./mdeq.exe
$ ledit ./mdeq.exe -load programs/hogefuga.mdeq
  • /programs directory contains sample programs, but some of them are not up-to-date and will not work.
Usage: ./mdeq.exe [-test] [-load <filename>] [-debug]
  -load load   program before starting REPL
  -debug debug (output parse tree)
  -help        Display this list of options

Syntax

t ::= [terms]
	| x 		['a'-'z'] ['a'-'z' '0'-'9' '_' '\'']*
	| n
	| true | false
	| t op t
	| \x:T.t
	| t1 t2
	| {t1, t2 :: T}
	| t.fst
	| t.snd
	| id{t}
	| idpeel{t, (x) t}
	| t A
	| /\_a. t
	| >_a t
	| <_a t
	| %_a t
	| if t1 then t2 else t3
	| # [meta_options]
T ::= [types]
	| X			['A'-'Z'] ['A'-'Z' 'a'-'z' '0'-'9' '_' '\'']*
	| int
	| bool
	| eq{T}
	| T t
	| sum x:T1.T2
	| prod x:T1.T2
	| \-/ a T
	| |>_a T
A ::= [Stages]
	| @stage

stage ::= [list of classifiers]
	| 				( empty stage )
	| stage_a		( list of classifiers )
meta_options ::=
	| print_tyenv
	| t has type T
	| T has kind K

Examples

  • let a = 3 in a + 4;;
  • (/\_x. >_x 4) @;;
  • (/\_x. >_x 4) @_a_b;;
  • >_a (\x:int. >_a %_a x);;
  • (\x: int. x + 4) 42;;
  • id{3};;
  • idpeel{3, (x) x + 3};;
  • idpeel{id{3}, (x) \m: (eq{int} x 3). m};;
  • idpeel{id{3}, (x) \m: (eq{int} x 3). m} id{1+2};;
  • # id{4 < 56} has type eq{bool} true true;;

Notes

  • The parser currently has some flaws. Please consider putting extra parenthesis if a parser error occurs.
  • Any bug report would be appreciated.

interpreter's People

Contributors

aigarashi avatar katshun0307 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

interpreter's Issues

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.