Re: euc code generation errors
- Posted by jimcbrown (admin) Dec 20, 2010
- 1407 views
Using linux, that program compiles fine for me, and produces this output when run.
Euphoria to C Translator v4.0.0 development Linux, Using System Memory Revision Date: 2010-12-20 21:39:26, Id: 4305:eb8995c7252e
I think this RC2 bug has already been fixed.
{1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7,7.5,8,8.5,9,9.5,10}
euphoria version : Euphoria Interpreter 4.0.0 development (rexported) for Linux
installed from : http://sourceforge.net/projects/rapideuphoria/files/Rapid%20Euphoria/4.0.0.RC2/Linux/euphoria- 4.0.0.RC2.tar.gz/download
when run through the 'C' program generator (euc) under linux the following code generates errors
function seq(atom mn, atom mx, atom inc=1) sequence v = {} if (inc = 0) then inc = 1 end if for n = mn to mx by inc do --// A -- v &= n --// B v = append(v, n) end for return v end function ? seq(1,10,.5)
code generation command : $ eui -con -keep test.ex
build directory: build-678272/
Translating code, pass: 1 2 3 generating
Compiling with GCC
Compiling 14% init-.c
Compiling 57% test.c
test.c: In function '_1seq':
test.c:41: error: expected ')' before '{' token
test.c:43: error: expected expression before '}' token
test.c:45: error: 'else' without a previous 'if'
test.c:47: error: '_n_149' undeclared (first use in this function)
test.c:47: error: (Each undeclared identifier is reported only once
test.c:47: error: for each function it appears in.)
test.c: At top level:
test.c:81: error: expected identifier or '(' before 'if'
test.c:82: error: expected identifier or '(' before 'return'
test.c:84: error: expected identifier or '(' before '}' token
Couldn't compile file 'test.c'
Status: 256 Command: gcc -fomit-frame-pointer -c -w -fsigned-char -O2 -m32 -I/home/euphoria/v4/ -ffast-math test.c
else if (IS_ATOM_INT(_9)) { if (binary_op_a(LESS, _n_149, _10){) // ERROR on this line with '{' goto L3; // [28] 48 }
tested under windows vista with Euphoria RC1 (r3951M)
with no problems