Project

K

Kleidemos

I've a project.
This is a general idea:

[]
From

#declare
i as 9
c as 'c'
#declare_end

#main_program
init;
print(i)
print(c)
#main_program_end

; name, arg
#function print var
stampa('Valore == ', var, '\n')
#function_end


We have, ready to compile(and internal compiled):

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
int i = 9;
char c = 'c';
printf("Valore == %s", &c);
printf("Valore == %i", i);
return 0;
}

The compiling of program is simple.
We convert the script into the C corrispondent and we compile(not
visible for user) the program.
Then we get to user the result.
For the program we use ANSI/ISO C.

[]

Is it possible???

P.S: If I'm OT here, please, we'll let me know.
--
Tnk

Luca "Kleidemos" Francesca

Un computer a un altro quando si incontrano:
"Ciao, come ti boota oggi???"
 
D

Dan Pop

In said:
I've a project.
This is a general idea:

[]
From

#declare
i as 9
c as 'c'
#declare_end

#main_program
init;
print(i)
print(c)
#main_program_end

; name, arg
#function print var
stampa('Valore == ', var, '\n')
#function_end


We have, ready to compile(and internal compiled):

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
int i = 9;
char c = 'c';
printf("Valore == %s", &c);
printf("Valore == %i", i);
return 0;
}

You may want to consider learning C before continuing to work at this
project. Your C program is severely broken, even if it compiles.

Dan
 
D

Default User

Kleidemos said:
I've a project.
This is a general idea:

[]
From

#declare
i as 9
c as 'c'
#declare_end

#main_program
init;
print(i)
print(c)
#main_program_end

; name, arg
#function print var
stampa('Valore == ', var, '\n')
#function_end


We have, ready to compile(and internal compiled):

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
int i = 9;
char c = 'c';
printf("Valore == %s", &c);

The above line is incorrect. %s expects a null-terminated string, not a
pointer to a single character. You invoke undefined behavior.

The correct version:

printf("Valore == %c", c);
printf("Valore == %i", i);


Also, you dont' have any newline characters output, so the two
variables will be on the same line. That doesn't meet with your problem
description.



Brian Rodenborn
 
A

Arthur J. O'Dwyer

I've a project.
This is a general idea:

What you are thinking of is a "translator." Also known as a
"compiler [to C]." Google "compiler" for more information.

Other posters have already pointed out that since you don't know
the C language yet, it will be extremely difficult for you to write
a translator in it. It will also be difficult for you to make sure
that your translator is correct, since you won't be able to tell
whether the code it's producing is right or wrong unless you have
at least a working knowledge of C.

We convert the script into the [corresponding C program] and we compile
(not visible for user) the program.
Then we get to user the result.

This part is platform-specific and thus off-topic in this newsgroup;
try comp.programming. But essentially you're looking for something like
a "shell script" or "makefile" (depending on your target audience and
geek factor).

-Arthur
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Book 5
[LONG]Simple RTTI 6
Array of structs function pointer 10
Help for my code 6
is a good C? 3
URGENT 1
doubly linked list 0
C program: memory leak/ segmentation fault/ memory limit exceeded 0

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top