Displaying 3 results from an estimated 3 matches for "string_ast".
2013 Oct 14
0
[LLVMdev] Runtime Array-Length
The toy language I've been playing around with represents all strings as a
struct in llvm;
struct string{
char *ptr;
int str_len;
int buffer_len;
}
And my AST has an interface like;
String_AST{
int measure();
void copy(char *dest);
struct string get_value();
}
A constant string can be measured at compile time, for a string variable
measure() just extracts str_len. Strings passed in from other external
sources are measured immediately, but llvm optimisations will eliminate the
call...
2013 Oct 12
2
[LLVMdev] Runtime Array-Length
All,
I am building my own language with llvm as the base.
I was working on string concatenation (where a string is just an array of
characters cast to a pointer to a character (i8*) ). Given two strings, it
is possible to determine the length of new string by summing the number of
characters until the null terminator and adding one.
Unfortunately, I have no idea how to use the c-api to store
2013 Oct 14
1
[LLVMdev] Runtime Array-Length
...eman <Jeremy.Lakeman at gmail.com>wrote:
> The toy language I've been playing around with represents all strings as a
> struct in llvm;
>
> struct string{
> char *ptr;
> int str_len;
> int buffer_len;
> }
>
> And my AST has an interface like;
>
> String_AST{
> int measure();
> void copy(char *dest);
> struct string get_value();
> }
>
> A constant string can be measured at compile time, for a string variable
> measure() just extracts str_len. Strings passed in from other external
> sources are measured immediately, but llv...