Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/larsbrinkhoff/forth-compiler
Native inlining constant folding register allocating Forth compiler
https://github.com/larsbrinkhoff/forth-compiler
code-generation compiler forth optimization optimizer register-allocation
Last synced: 26 days ago
JSON representation
Native inlining constant folding register allocating Forth compiler
- Host: GitHub
- URL: https://github.com/larsbrinkhoff/forth-compiler
- Owner: larsbrinkhoff
- License: gpl-3.0
- Created: 2016-01-15T20:08:45.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-01-19T11:16:48.000Z (almost 9 years ago)
- Last Synced: 2023-03-25T20:50:01.170Z (over 1 year ago)
- Topics: code-generation, compiler, forth, optimization, optimizer, register-allocation
- Language: Forth
- Size: 20.5 KB
- Stars: 14
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Simple native code Forth compiler.
- Inlining
- Register allocation
- Constant foldingSample output:
Compile: t: rot >r swap r> swap ;
LD r0 0(SP)
LD r1 4(SP)
LD r2 8(SP)
ST r2 0(SP)
ST r0 4(SP)
ST r1 8(SP)
RETCompile: t: -rot rot rot ;
LD r0 0(SP)
LD r1 4(SP)
LD r2 8(SP)
ST r1 0(SP)
ST r2 4(SP)
ST r0 8(SP)
RETCompile: t: +! tuck @ + swap ! ;
LD r0 0(SP)
LD r1 4(SP)
LD r2 (r0)
ADD r1 r2
ST r1 (r0)
ADD SP #8
RETCompile: t: test4 2 + 3 ;
LD r0 0(SP)
ADD r0 #2
ADD SP #-4
ST #3 0(SP)
ST r0 4(SP)
RETCompile: t: test5 2 test4 * ;
ADD SP #-4
ST #12 0(SP)
RET