Skip to content

Commit

Permalink
Merge pull request #1197 from andrew-johnson-4/more-lm-to-lsts-faefwm
Browse files Browse the repository at this point in the history
More lm to lsts faefwm
  • Loading branch information
andrew-johnson-4 authored Jan 29, 2025
2 parents 2879858 + 7b0090c commit e27d35e
Show file tree
Hide file tree
Showing 11 changed files with 22,462 additions and 22,238 deletions.
44,644 changes: 22,426 additions & 22,218 deletions BOOTSTRAP/cli.c

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "lambda_mountain"
version = "1.20.53"
version = "1.20.54"
authors = ["Andrew <[email protected]>"]
license = "MIT"
description = "Typed Macro Assembler (backed by Coq proofs-of-correctness)"
Expand Down
1 change: 1 addition & 0 deletions PLUGINS/BACKEND/BLOB/index-index.lm
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@

import PLUGINS/BACKEND/BLOB/compile-blob.lm;
import PLUGINS/BACKEND/BLOB/register-hook.lsts;
2 changes: 2 additions & 0 deletions PLUGINS/BACKEND/BLOB/register-hook.lsts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

register-backend(c"--blob", &plugins-backend-blob-compile);
1 change: 1 addition & 0 deletions PLUGINS/BACKEND/C/index-index.lm
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ import PLUGINS/BACKEND/C/fragment::chain.lm;
import PLUGINS/BACKEND/C/fragment::local-variable.lm;
import PLUGINS/BACKEND/C/fragment::label.lm;
import PLUGINS/BACKEND/C/is-const-array.lm;
import PLUGINS/BACKEND/C/register-hook.lsts;
8 changes: 7 additions & 1 deletion PLUGINS/BACKEND/C/mangle-c-type.lm
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,13 @@ mangle-c-type-internal := λ(: tt Type). (: (
( (TGround( 'IO::File_s _ )) (set r (SAtom 'FILE*_s)) )
( (TGround( 'PID_s _ )) (set r (SAtom 'pid_t_s)) )
( (TGround( 'Regex_s _ )) (set r (SAtom 'regex_t_s)) )
( (TGround( 'Array_s (LCons( _ (LCons( array-base _ )) )) )) (set r (+( (mangle-c-type array-base) (SAtom '*_s) ))) )
( (TGround( 'Array_s (LCons( _ (LCons( array-base _ )) )) )) (
(if (.is-arrow array-base) (
(set r (mangle-c-type array-base))
) (
(set r (+( (mangle-c-type array-base) (SAtom '*_s) )))
))
))
( (TGround( 'Arrow_s _ )) (
(let pre-post (mangle-c-declaration-internal tt))
(let td-id (uuid()))
Expand Down
2 changes: 2 additions & 0 deletions PLUGINS/BACKEND/C/register-hook.lsts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

register-backend(c"--c", &plugins-backend-c-compile);
4 changes: 0 additions & 4 deletions SRC/index-plugins.lm
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
# TODO: replace frotends this will file-extension based plugin management
# * SRC/unit-drivers.lst

plugin-null-backend := λ. (: (
(fail 'Cannot\sCompile:\sNo\sBackend\sWas\sSpecified_s)
) Nil);

plugin-current-backend := (: (& plugins-backend-c-compile) Arrow<Nil,Nil>[]);

import PLUGINS/BACKEND/C/index-index.lm;
Expand Down
22 changes: 8 additions & 14 deletions SRC/main.lm
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,6 @@ main := λ(: argc C_int)(: argv String[]). (: (
(while (<( argi (as argc U64) )) (
(match ([]( argv (as argi U64) )) (
()
('--c_s (
(set config-platform-prefix 'PLATFORM/C/_s)
(if (==( config-target '_s )) (set config-target 'tmp.c_s) ())
(set plugin-current-backend (& plugins-backend-c-compile))
))
('--blob_s (
(set config-platform-prefix 'PLATFORM/BLOB/_s)
(if (==( config-target '_s )) (set config-target 'tmp.txt_s) ())
(set plugin-current-backend (& plugins-backend-blob-compile))
))
('--dev_s (set config-devmode 1_u64))
('--typecheck_s (set config-mode ModeTypecheck))
('--compile_s (set config-mode ModeCompile))
Expand All @@ -28,10 +18,14 @@ main := λ(: argc C_int)(: argv String[]). (: (
(set config-target ([]( argv argi )))
))
(fp (
(set input (SCons(
(close input)
(close (SAtom( fp )))
)))
(if (.has( plugins-backends-index fp )) (
(set plugin-current-backend (.lookup( plugins-backends-index fp (& plugin-null-backend) )))
) (
(set input (SCons(
(close input)
(close (SAtom( fp )))
)))
))
))
))
(set argi (+( argi 1_u64 )))
Expand Down
13 changes: 13 additions & 0 deletions SRC/plugins-backends.lsts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

let plugins-backends-index = {} :: HashtableEq<CString,Arrow<Nil,Nil>[]>;

let plugin-null-backend(): Nil = (
print("Cannot Compile: No Backend Was Specified\n");
exit(1);
);

let register-backend(flag: CString, hook: Arrow<Nil,Nil>[]): Nil = (
plugins-backends-index = plugins-backends-index.bind(flag, hook);
);

register-backend(c"--c", &plugins-backend-c-compile);
1 change: 1 addition & 0 deletions SRC/unit-drivers.lsts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@

import SRC/plugins-frontends.lsts;
import SRC/plugins-backends.lsts;

0 comments on commit e27d35e

Please sign in to comment.