haskeme
所属分类:数值算法/人工智能
开发工具:Haskell
文件大小:0KB
下载次数:0
上传日期:2019-07-18 23:00:23
上 传 者:
sh-1993
说明: 方案编程语言的I到S表达式编译器
(Compiler from I- to S-Expressions for the Scheme Programming Language)
文件列表:
exe/
src/
.ghci
CHANGELOG.md
LICENSE
Setup.hs
haskeme.cabal
# haskeme
This compiler translates Scheme source code written with I-Expressions (indented expressions) into S-Expressions (symbolic expressions).
## Usage
Haskeme can read and write files:
haskeme --input "program.hss" --output "program.ss"
Haskeme can also use `StdIn` and `StdOut`:
cat "program.hss" | haskeme > "program.ss"
### Options
- `-i` or `--input` to specify input file
- `-o` or `--output` to specify output file
## I-Expressions
I-Expressions are indented expressions and are translated by few simple rules:
- a new line translates to a new S-Expression
- same indentation as the expression above translates to a new S-Expression following the prior one
- more indentation as the expression above translates to a new S-Expression as an argument to the prior one
- less indentation as the expression above, but still more indentation as another expression above translates to a new S-Expression, while the prior and further indented block gets wrapped in extra parentheses (look at the `let`-example)
- S-Expression can be mixed in while staying in a single line (look at the example for mixed expressions)
- full line comments starting with `;` are ignored
- a new line can be prevented from being turned into an S-Expression by prepending it with `:` after the indent (look at the example for prevented expressions)
### Example
- I-Expressions:
```racket
define f
lambda
x
let
y
* x x
if
> x 0
+ y 1
: #f
```
- S-Expressions:
```racket
(define f
(lambda (x)
(let ((y (* x x)))
(if (> x 0)
(+ y 1)
#f))))
```
- mixed I- and S-Expressions:
```racket
define f
lambda (x)
let
y (* x x)
if (> x 0)
+ y 1
: #f
```
## Install
- install from [Hackage](https://hackage.haskell.org/package/haskeme) with `cabal`:
```
cabal install haskeme
```
- clone from [GitHub](https://github.com/jumper149/haskeme) and compile with `cabal`:
```
git clone https://github.com/jumper149/haskeme.git
cd haskeme
cabal build
```
- clone from GitHub and compile with `ghc` (not recommended, use this [PKGBUILD](https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=haskeme) as a template)
- install from [AUR](https://aur.archlinux.org/packages/haskeme/) (only ArchLinux-Users)
### Dependencies
- `ghc` (make)
- `cabal` (opt. make)
近期下载者:
相关文件:
收藏者: