Skip to content

Syscalls: write file + initial support for .data segment#142

Merged
pointbazaar merged 9 commits intomasterfrom
syscalls-read-file
Mar 13, 2025
Merged

Syscalls: write file + initial support for .data segment#142
pointbazaar merged 9 commits intomasterfrom
syscalls-read-file

Conversation

@pointbazaar
Copy link
Owner

No description provided.

- Add tables/data to represent our .data segment
- Add compiler/main/analyzer/data to extract string literals
- Emit .data section with symbols and data for the strings
- Adjust examples/assert_examples.sh to not check for newline
  at the end of file. Since struct StringConst does not support this
  right now.
@netlify
Copy link

netlify bot commented Mar 9, 2025

Deploy Preview for espl1000 ready!

Name Link
🔨 Latest commit 9c45764
🔍 Latest deploy log https://app.netlify.com/sites/espl1000/deploys/67cddefa6944850008cd8a84
😎 Deploy Preview https://deploy-preview-142--espl1000.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Previously, 2 distinct strings could be mapped to the same symbol.

This should hopefully not happen now.
Instead of hardcoding (just done for PoC), define a function
'data_string_offset' to return the offset in DataTable for a string.
oopsie, must have accidentally copied that.

Unused file, builds without that.
This is so that they can be passed into functions expecting C strings
which are NULL-terminated.

- fix tac/tac_str.c to print width of load/store.
- fix examples/syscalls/read_file/read_file.dg
  to read from it's own source file and print the first few chars.
  Also add a .stdout file there so it gets picked up by the test suite.
Propagate the escaped chars into the assembly.
NASM supports these when the string appears in backticks [1].

References:
[1] https://www.cs.ubbcluj.ro/~vancea/asc/practic/nasm_html/nasmdoc3.html
@pointbazaar pointbazaar merged commit ed94374 into master Mar 13, 2025
13 checks passed
@pointbazaar pointbazaar deleted the syscalls-read-file branch March 13, 2025 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant