microc: microc compiler

[ bsd3, compiler, library, program ] [ Propose Tags ] [ Report a vulnerability ]

convert microc code to asm code


[Skip to Readme]

Modules

[Index]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 1.0.0.0, 1.0.0.1
Dependencies base (>=4.7 && <5), microc, parsec [details]
License BSD-3-Clause
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 repo head: git clone https://github.com/hurou927/microc-haskell
Uploaded by hurou927 at 2017-11-06T07:26:24Z
Distributions NixOS:1.0.0.1
Executables microc-exe
Downloads 2198 total (8 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2017-11-06 [all 1 reports]

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