Conditional compilation, size_t, ssize_t, sizeof and so forth #119

Closed
opened 2023-04-24 07:46:55 +01:00 by deavmi · 2 comments
Owner

What it this?

Add support for things such as conditional compilation, types dependent on the system and so forth.


It would make sense to support all of this within the MetaProcessor, therefore let's first get the ball rolling with #116.


Types

We should support the following types:

Type name Actual type
size_t The biggest unsigned type on your machine
ssize_t The biggest signed type on your machine

sizeof(<identifier>)

We need to add support for sizeof(<identifier>):

  • Support in the Parser
    • We may want to work on #120 first because it would be within that same entry point
  • Support in the MetaProcessor
    • To update the literal's value based on the type-identifier held within
## What it this? Add support for things such as conditional compilation, types dependent on the system and so forth. --- It would make sense to support all of this within the `MetaProcessor`, therefore let's first get the ball rolling with #116. --- ## Types We should support the following types: | Type name | Actual type | |-----------|-------------| | `size_t` | The biggest unsigned type on your machine | | `ssize_t` | The biggest signed type on your machine | ## `sizeof(<identifier>)` We need to add support for `sizeof(<identifier>)`: - [x] Support in the `Parser` * We may want to work on #120 first because it would be within that same entry point - [x] Support in the `MetaProcessor` * To update the literal's value based on the type-identifier held within
deavmi added the
meta
label 2023-04-24 07:47:34 +01:00
deavmi self-assigned this 2023-04-24 07:47:37 +01:00
deavmi added this to the Dependency tree, type-checking and codegen project 2023-04-24 07:47:44 +01:00
deavmi added this to the Basics milestone 2023-04-24 07:47:52 +01:00
deavmi added reference feature/meta_programming 2023-04-24 07:47:56 +01:00
deavmi added a new dependency 2023-04-24 07:48:05 +01:00
deavmi changed title from Conditional compilation, size_t, ssize_t and so forth to Conditional compilation, size_t, ssize_t, sizeof and so forth 2023-04-24 10:54:04 +01:00
deavmi started working 2023-05-29 15:22:11 +01:00
deavmi added the
parser
label 2023-05-29 15:23:21 +01:00
Author
Owner

What it this?

Add support for things such as conditional compilation, types dependent on the system and so forth.


It would make sense to support all of this within the MetaProcessor, therefore let's first get the ball rolling with #116.


Types

We should support the following types:

Type name Actual type
size_t The biggest unsigned type on your machine
ssize_t The biggest signed type on your machine

sizeof(<identifier>)

We need to add support for sizeof(<identifier>):

  • Support in the Parser
    • We may want to work on #120 first because it would be within that same entry point
  • Support in the MetaProcessor
    • To update the literal's value based on the type-identifier held within

We went about the sizeof() differently and in a better manner than a kind-of literal. It is a FunctionCall which means the parser never had to change and we could replace it easily with an IntegerLiteral. Previous approach never replaced anything but updated a kind-of IntegerLiteral (dubbed sizeofLiteral) - this was a bad approach and is now fixed.

It was "bad" because it treated as something it is not, replacement was what we were looking for and not something that acts like an IntegerLiteral.

> ## What it this? > > Add support for things such as conditional compilation, types dependent on the system and so forth. > > --- > > It would make sense to support all of this within the `MetaProcessor`, therefore let's first get the ball rolling with #116. > > --- > > ## Types > > We should support the following types: > > | Type name | Actual type | > |-----------|-------------| > | `size_t` | The biggest unsigned type on your machine | > | `ssize_t` | The biggest signed type on your machine | > > ## `sizeof(<identifier>)` > > We need to add support for `sizeof(<identifier>)`: > > - [ ] Support in the `Parser` > * We may want to work on #120 first because it would be within that same entry point > - [ ] Support in the `MetaProcessor` > * To update the literal's value based on the type-identifier held within We went about the `sizeof()` differently and in a better manner than a kind-of literal. It is a `FunctionCall` which means the parser never had to change and we could replace it easily with an `IntegerLiteral`. Previous approach never replaced anything but updated a kind-of `IntegerLiteral` (dubbed _sizeofLiteral_) - this was a bad approach and is now fixed. It was _"bad"_ because it treated as something it is not, replacement was what we were looking for and **not** something that acts like an `IntegerLiteral`.
deavmi removed the
parser
label 2023-05-29 15:25:34 +01:00
Author
Owner

Well, this is completed

Well, this is completed ✅
deavmi stopped working 2023-05-29 15:25:41 +01:00
3 minutes 30 seconds
deavmi removed a dependency 2023-05-29 15:25:54 +01:00
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Total Time Spent: 3 minutes 30 seconds
deavmi
3 minutes 30 seconds
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: tlang/tlang#119
No description provided.