Compare commits

...

2 Commits

Author SHA1 Message Date
Abner Coimbre 88b4ddf682 main: Fix build comments 2026-03-15 11:07:41 -07:00
Abner Coimbre 790a5c0152 Update README with instructions 2026-03-15 11:07:22 -07:00
2 changed files with 38 additions and 2 deletions

View File

@ -1,3 +1,39 @@
# tc-calc
Our built-in calculator. This is the REPL loop used by Terminal Click.
Our built-in calculator. This is the REPL loop used by Terminal Click.
## Build Instructions
`cc main.c -o calc -lm`
Where `cc` is our C compiler e.g. `gcc`, `clang`, `zig cc`.
## How to Use
Run the executable `calc` to be greeted with the following prompt:
`calc>`
Now we type any valid arithmetic expression as we would in a Python REPL:
```
calc> (2+2)*(2+2)
16
calc>
```
Notice how we print the output with a bit of spacing followed by a new prompt.
**Switching Formats**
We can switch between decimal, hexadecimal and binary formats. Use the `:dec`, `:hex`, or `:bin` tags:
```
calc> :hex
format: hex
calc> 0xA - 0x9
0x1
calc>
```
The default tag is `:dec`.

2
main.c
View File

@ -1,6 +1,6 @@
/*
* Simple REPL for the calc evaluator.
* Build: calc main.c -o calc -lm
* Build: clang main.c -o calc -lm
* @author Abner Coimbre <abner@terminal.click>
*/