Skip to content

Commit e48e668

Browse files
committed
release(v1.0): Kroha
2 parents ec4a7c2 + 1fc2963 commit e48e668

File tree

22 files changed

+656
-870
lines changed

22 files changed

+656
-870
lines changed

HLasm.cabal renamed to Kroha.cabal

Lines changed: 13 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ cabal-version: 1.12
44
--
55
-- see: https://github.com/sol/hpack
66

7-
name: HLasm
8-
version: 0.4.0.0
7+
name: Kroha
8+
version: 1.0.0.0
99
description: Please see the README on GitHub at <https://github.com/vorotynsky/HLasm#readme>
1010
homepage: https://github.com/vorotynsky/HLasm#readme
1111
bug-reports: https://github.com/vorotynsky/HLasm/issues
@@ -22,18 +22,18 @@ source-repository head
2222
type: git
2323
location: https://github.com/vorotynsky/HLasm
2424

25-
library
26-
exposed-modules:
27-
HLasm.Ast
28-
HLasm.Backend.Nasm
29-
HLasm.Error
30-
HLasm.Frame
31-
HLasm.Instructions
32-
HLasm.Parser
33-
HLasm.Scope
34-
HLasm.Types
25+
executable Kroha
26+
main-is: Main.hs
3527
other-modules:
36-
Paths_HLasm
28+
Kroha
29+
Kroha.Ast
30+
Kroha.Backends.Nasm
31+
Kroha.Instructions
32+
Kroha.Parser
33+
Kroha.Scope
34+
Kroha.Stack
35+
Kroha.Types
36+
Paths_Kroha
3737
hs-source-dirs:
3838
src
3939
build-depends:
@@ -42,19 +42,3 @@ library
4242
, extra >=1.0 && <1.8
4343
, parsec >=3.1.0 && <=3.1.14.0
4444
default-language: Haskell2010
45-
46-
executable HLasm-exe
47-
main-is: Main.hs
48-
other-modules:
49-
Funcs
50-
Paths_HLasm
51-
hs-source-dirs:
52-
app
53-
ghc-options: -threaded -rtsopts -with-rtsopts=-N
54-
build-depends:
55-
HLasm
56-
, base >=4.7 && <5
57-
, containers >=0.6 && <0.7
58-
, extra >=1.0 && <1.8
59-
, parsec >=3.1.0 && <=3.1.14.0
60-
default-language: Haskell2010

README.md

Lines changed: 69 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# HLasm
1+
# Kroha
22

3-
Improve your assembly experience with HLasm!
3+
Improve your assembly experience with Kroha!
44
This language is more comfortable than a pure assembly.
55

66
## Example
@@ -11,62 +11,59 @@ Instead of documentation
1111

1212
```asm
1313
program {
14-
fake frame <act>
14+
manual frame act {
15+
mov ax, [bp-4]
16+
inc ax
17+
leave
18+
ret
19+
}
1520
16-
frame (main) {
21+
frame main {
1722
reg a : ax
1823
a = 5
1924
call <act> (a)
2025
}
21-
22-
frame (act) {
23-
!mov ax, [bp-4];
24-
!inc ax;
25-
}
2626
}
2727
```
2828

2929
Compiled
3030

3131
```asm
3232
section .text
33+
act:
34+
mov ax, [bp-4]
35+
inc ax
36+
leave
37+
ret
3338
39+
section .text
3440
main:
35-
push bp
36-
mov bp, sp
37-
sub sp, 0
38-
39-
mov ax, 5
40-
push ax
41-
call act
42-
43-
add sp, 0
41+
mov ax, 5
42+
push ax
43+
call act
44+
add sp, 2
4445
leave
4546
ret
4647
47-
act:
48-
push bp
49-
mov bp, sp
50-
sub sp, 0
51-
mov ax, [bp-4]
52-
inc ax
53-
leave
54-
ret
5548
```
5649

5750
### Variables
5851

5952
```asm
6053
program {
61-
var a : int(16) = 32
62-
var b : int(8) = 1
63-
const c : int(16) = 32
64-
const d : int(8) = 1
54+
var a : int16 = 32
55+
var b : int8 = 1
56+
const c : int16 = 32
57+
const d : int8 = 1
6558
66-
frame (main) {
59+
manual var arr : &int8 {
60+
times 64 db 0
61+
}
62+
63+
frame main {
6764
reg ra : ax
6865
reg ptr : bx
69-
var sb : int(16)
66+
var sb : int16
7067
ra = 5
7168
sb = 6
7269
ptr = b
@@ -77,41 +74,48 @@ program {
7774
Compiled
7875

7976
```asm
80-
section .text
81-
82-
main:
83-
push bp
84-
mov bp, sp
85-
86-
sub sp, 2
87-
mov ax, 5
88-
mov WORD [bp-2], 6
89-
mov bx, b
90-
leave
91-
ret
77+
section .data
78+
a: dw 32
9279
9380
section .data
94-
a: DW 32
95-
b: DB 1
81+
b: db 1
9682
9783
section .rodata
98-
c: DW 32
99-
d: DB 1
84+
c: dw 32
85+
86+
section .rodata
87+
d: db 1
88+
89+
section .data
90+
arr:
91+
times 64 db 0
92+
93+
94+
section .text
95+
main:
96+
mov ax, 5
97+
mov [bp - 2], 6
98+
mov bx, [b]
99+
leave
100+
ret
100101
```
101102

102103
### Conditions and loops
103104

104105
```asm
105106
program {
106-
frame (main) {
107+
frame main {
107108
reg val : ax
108109
val = 0
109110
110-
while (LOOP) {
111+
loop (LOOP) {
111112
if (val > 5, CMP) {
112113
break (LOOP)
113114
}
114-
!inc ax;
115+
else {
116+
!dec bx
117+
}
118+
!inc ax
115119
}
116120
}
117121
}
@@ -121,30 +125,23 @@ Compiled
121125

122126
```asm
123127
section .text
124-
125128
main:
126-
push bp
127-
mov bp, sp
128-
sub sp, 0
129-
mov ax, 0
130-
LOOPbegin:
131-
cmp ax, 5
132-
jg CMP1
133-
jmp CMPend
134-
CMP1:
135-
jmp LOOPend
136-
jmp CMPend
137-
CMPend:
138-
139-
inc ax
140-
jmp LOOPbegin
141-
LOOPend:
129+
mov ax, 0
130+
LOOP_begin:
131+
cmp ax, 5
132+
jg CMP_begin
133+
dec bx
134+
jmp CMP_end
135+
CMP_begin:
136+
jmp LOOP_end
137+
CMP_end:
138+
inc ax
139+
jmp LOOP_begin
140+
LOOP_end:
142141
leave
143142
ret
144143
```
145144

146-
> Generated code in these examples was manually formatted.
147-
148145
## Build and install
149146

150147
Build using [stack](https://docs.haskellstack.org).
@@ -159,10 +156,10 @@ Install using [stack](https://docs.haskellstack.org).
159156
stack install
160157
```
161158

162-
## Run HLasm
159+
## Run Kroha
163160

164161
It compiles each file individually and prints nasm to the terminal.
165162

166163
```sh
167-
HLasm ./file1 ./file2 ./file3
164+
Kroha ./file1 ./file2 ./file3
168165
```

app/Funcs.hs

Lines changed: 0 additions & 19 deletions
This file was deleted.

app/Main.hs

Lines changed: 0 additions & 32 deletions
This file was deleted.

package.yaml

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
name: HLasm
2-
version: 0.4.0.0
1+
name: Kroha
2+
version: 1.0.0.0
33
github: "vorotynsky/HLasm"
44
license: GPL-3
55
author: "Vorotynsky Maxim"
@@ -21,19 +21,10 @@ description: Please see the README on GitHub at <https://github.com/voro
2121
dependencies:
2222
- base >= 4.7 && < 5
2323
- containers >= 0.6 && < 0.7
24-
- extra >= 1.0 && < 1.8
2524
- parsec >= 3.1.0 && <= 3.1.14.0
26-
27-
library:
28-
source-dirs: src
25+
- extra >= 1.0 && < 1.8
2926

3027
executables:
31-
HLasm-exe:
32-
main: Main.hs
33-
source-dirs: app
34-
ghc-options:
35-
- -threaded
36-
- -rtsopts
37-
- -with-rtsopts=-N
38-
dependencies:
39-
- HLasm
28+
Kroha:
29+
source-dirs: src
30+
main: Main.hs

0 commit comments

Comments
 (0)