haskeme: Compiler from I- to S-Expressions for the Scheme Programming Language

[ bsd3, language, library, program ] [ Propose Tags ]

This compiler translates Scheme source code written with I-Expressions (indented expressions) into S-Expressions (symbolic expressions).


[Skip to Readme]
Versions [faq] 0.1.0.0, 0.1.0.1, 0.1.0.2, 0.1.0.3, 0.1.0.4
Change log CHANGELOG.md
Dependencies base (==4.12.*), haskeme [details]
License BSD-3-Clause
Author Felix Springer
Maintainer felixspringer149@gmail.com
Category Language
Home page https://github.com/jumper149/haskeme
Uploaded by jumper149 at Thu Jul 18 23:01:26 UTC 2019
Distributions NixOS:0.1.0.4
Executables haskeme
Downloads 1177 total (191 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2019-07-18 [all 1 reports]

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees


Readme for haskeme-0.1.0.4

[back to package description]

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:

    define f
      lambda
        x
        let
            y
              * x x
          if
            > x 0
            + y 1
            : #f
    
  • S-Expressions:

    (define f
      (lambda (x)
        (let ((y (* x x)))
          (if (> x 0)
              (+ y 1)
              #f))))
    
  • mixed I- and S-Expressions:

    define f
      lambda (x)
        let
            y (* x x)
          if (> x 0)
             + y 1
             : #f
    

Install

  • install from Hackage with cabal:

    cabal install haskeme
    
  • clone from GitHub 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 as a template)

  • install from AUR (only ArchLinux-Users)

Dependencies

  • ghc (make)
  • cabal (opt. make)