Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .claw.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"permissions": {
"defaultMode": "dontAsk"
}
}
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,10 @@
/testing/out.s
/compiler/out.s
/compiler/out.wh
/testing/.claw/sessions/884576d23d2173fe
/testing/.sandbox-home
/testing/.sandbox-tmp
/testing/__pycache__
/testing/.claw/sessions/884576d23d2173fe
/testing/.claw/sessions/884576d23d2173fe
/testing/__pycache__
12 changes: 12 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# CLAUDE.md

This file provides guidance to Claw Code (clawcode.dev) when working with code in this repository.

## Detected stack
- No specific language markers were detected yet; document the primary language and verification commands once the project structure settles.
- Frameworks: none detected from the supported starter markers.

## Working agreement
- Prefer small, reviewable changes and keep generated bootstrap files aligned with actual repo workflows.
- Keep shared defaults in `.claw.json`; reserve `.claw/settings.local.json` for machine-local overrides.
- Do not overwrite existing `CLAUDE.md` content automatically; update it intentionally when repo workflows change.
2 changes: 1 addition & 1 deletion compiler/src/codegen/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ impl CodeGenerator {
self.wh_write_line(format!("assume (bit_shift <= (31 as ui32));").as_str(), 0);
self.wh_write_line(format!("assume (bit_shift >= (0 as ui32));").as_str(), 0);
self.wh_write_line(format!("assume (stmt >= (0 as ui32));").as_str(), 0);
self.wh_write_line(format!("assume (stmt <= ({} as ui32));",self.stmt).as_str(), 0);
self.wh_write_line(format!("assume (stmt <= ({} as ui32));",self.stmt-1).as_str(), 0);
self.wh_write_line(format!("flip_mask = ((1 as ui32) << bit_shift);").as_str(), 0);

self.wh_write_line("\nres = main(stmt, flip_mask);", 0);
Expand Down
5 changes: 5 additions & 0 deletions compiler/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ struct Args {

#[arg(long)]
hard: bool,

#[arg(long)]
normal: bool,
}

fn main() {
Expand Down Expand Up @@ -54,7 +57,9 @@ fn main() {
let mut parser: Parser = Parser::new(_tokens);
let _ast: AST = parser.parse_program();
let mut codegen: CodeGenerator = CodeGenerator::new(output,wh_output);
let mut hard = false;
codegen.generate(_ast, args.hard);



println!("Lexing and parsing completed successfully.");
Expand Down
40 changes: 40 additions & 0 deletions compiler/test.trv
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
func main() -> Integer {
let authenticated : Integer = 0;
if authenticated != 0 {
return 77;
}
let cardPin1 : Integer = 1;
let cardPin2 : Integer = 2;
let cardPin3 : Integer = 3;
let cardPin4 : Integer = 4;
let userPin1 : Integer = 0;
let userPin2 : Integer = 0;
let userPin3 : Integer = 0;
let userPin4 : Integer = 0;
let pinsEqual : Integer = 0;
if pinsEqual != 0 {
return 77;
}

if userPin1 == cardPin1 then {
pinsEqual = pinsEqual + 1;
}

if userPin2 == cardPin2 then {
pinsEqual = pinsEqual + 1;
}

if userPin3 == cardPin3 then {
pinsEqual = pinsEqual + 1;
}

if userPin4 == cardPin4 then {
pinsEqual = pinsEqual + 1;
}

if pinsEqual == 4 then {
authenticated = 1;
}

return authenticated;
}
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ bit_shift = (? as ui32);
assume (bit_shift <= (31 as ui32));
assume (bit_shift >= (0 as ui32));
assume (stmt >= (0 as ui32));
assume (stmt <= (15 as ui32));
assume (stmt <= (14 as ui32));
flip_mask = ((1 as ui32) << bit_shift);

res = main(stmt, flip_mask);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ bit_shift = (? as ui32);
assume (bit_shift <= (31 as ui32));
assume (bit_shift >= (0 as ui32));
assume (stmt >= (0 as ui32));
assume (stmt <= (15 as ui32));
assume (stmt <= (14 as ui32));
flip_mask = ((1 as ui32) << bit_shift);

res = main(stmt, flip_mask);
Expand Down
Loading
Loading