The microc package

[ Tags: bsd3, compiler, library, program ] [ Propose Tags ]

convert microc code to asm code


[Skip to Readme]

Properties

Versions 0.1.0.0, 1.0.0.0, 1.0.0.1
Dependencies base (>=4.7 && <5), microc, parsec [details]
License BSD3
Copyright 2017 hurou927
Author hurou927 <god.be.with.ye.fs@gmail.com>
Maintainer hurou927 <god.be.with.ye.fs@gmail.com>
Category Compiler
Home page https://github.com/hurou927/microc-haskell#readme
Source repository head: git clone https://github.com/hurou927/microc-haskell
Uploaded Mon Nov 6 07:26:24 UTC 2017 by hurou927
Distributions NixOS:1.0.0.1
Executables microc-exe
Downloads 163 total (84 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2017-11-06 [all 1 reports]
Hackage Matrix CI

Modules

[Index]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees


Readme for microc-1.0.0.1

[back to package description]

MICROC compiler

microcCompilerLine :: String -> String

Convert a line of microc code to asm

microcCompilerStr :: String -> String

Convert microc code to asm

microcCompiler::IO()

Input:Stdin / Output:Stdout

main::IO()
main = microcCompiler

./microc < count.c > count.asm

count.c

n=in;
L1:
    out(n);
    unless(n) goto L2;
    n=n-1;
    goto L1;
L2:
    halt;
    int n;

↓↓↓

count.asm

        IN
        POP n
L1:
        PUSH n
        OUT
        PUSH n
        JZ L2
        PUSH n
        PUSHI 1
        SUB
        POP n
        JMP L1
L2:
        HALT
n: 0

Hiroshima Univ. / Embedded Software

https://momiji.hiroshima-u.ac.jp/syllabusHtml/2017_58_U4090201.html