Hi Matt,

> I'm just trying to give some feedback, Keep up the good work.
Thanks for taking an interest!

> William, I don't see why you have to edit the .c file. I guess this
> will be fixed later on.
There should not be a reason to edit the .c file eventually and AFAIK
there is no reason with the current (svn) version. But undoubtedly at
some point bugs will surface that can be fixed by edition the
output...

> Thanks guys, I didn't get a chance to test this again till now. It
> outputs files files now, but I don't know what to do after that. Are
> included files in the output file?
Yes. All the include files specified are parsed and the result is put
into the one C source file.

If you got lots of comment in the output without command line
parameters, you probably used an old version. There have been major
improvements in the last two weeks, amongst others on output
formatting, but also op procedure calling. The currrent version writes
it output to a file with '.c' extension and without comment, and
should output source as clean as:

> int main(int argc, int **argv) {
>   pin_A0_direction  = output
>   for (;;) {
>      led  = on
>      led  = off
>   }
> }

> Some documentation is needed for a
> complete conversion to .hex, of course I have never used SDCC.
You are right about documentation, there is hardly any. Of course I
could say 'read the compiler docs', but an example of the whole
process with a given compiler is required. The process for an
ATmega168 using the arduino IDE files:

Use of the translator is pretty straight-forward:

jalparser test.jal

creates a file test.c which is the translated version of test.jal
Command line options:
 -v                 adds comment on the output. This is (quite a lot)
of comment that shows how (why) each statement was generated. But if
you want more, use -v -v -v
 -s                Not yet fully implented, but like JAL: search paths of
-noinclude     disables the include statement, so only parse the file
at the command line, no others.

When done, you should have a C file that can be compiled by a C
compiler for your target. I never used SDCC, so I can't tell you how
this works. I did run a test on an arduino board with make.bat in the
avrdemo directory (and will now update it to use the arduino
software). It takes 4 steps:

One: convert JAL to C
jalparser blink_avr.jal

Two: Compile C  to ELF
avr-gcc -g -Wall -Os -mmcu=atmega168p  -IAVRlib -I. -I./libs -o
blink_avr.elf blink_avr.c

Three: convert ELF to HEX
avr-objcopy -j .text -j .data -O ihex blink_avr.elf blink_avr.hex

Four: Upload HEX to target device.
avrdude -F -V  -p m168 -c stk500v1 -Pcom11 -b19200 -D -U blink_avr.hex

Paths are removed in het example above, in svn,
\grammar\avrdemo\make.bat is the actually used file.
Other compilers work in a similar way, but might not require the
elf-to-hex conversion.

> Will SDCC be included in the exe file?
The aim is to provide a translator to C, so you can write JAL for any
device that has a C compiler. This will take some JAL files to bridge
to the specific target compiler. When someone creates these, he could
include a compiler distribution too, but I suspect for most platforms
it would be better to refer to an official distribution rather then
duplicating it.

> Also, comments in the .jal file do not get transferred into the .c file
Sadly, that's true. I can write a long explanation why, but it boils
down to that the comment is there but 'hidden' and as such not used in
code generation.So it might be possible to access, but it won't be
easy to re-insert it in the output at the right place...

Joep

-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en.

Reply via email to