[antlr-interest] Bug in 64bit C backend

Jason Nielsen jdn at math.carleton.ca
Wed Jul 30 20:26:36 PDT 2008


> IN fact my development version did have a bug because I was in the 
> middle of fixing something else. I just completed that fix and now i 
> get:
>
> ./a.out
> Nodes: (VAR_DEF char c) (VAR_DEF int x) (FUNC_DECL (FUNC_HDR void bar
> (ARG_DEF int x))) (FUNC_DEF (FUNC_HDR int foo (ARG_DEF int y) (ARG_DEF
> char d)) (BLOCK (VAR_DEF int i) (for (= i 0) (< i 3) (= i (+ i 1))
> (BLOCK (= x 3) (= y 5)))))
> Nodes: (VAR_DEF char c) (VAR_DEF int x) (FUNC_DECL (FUNC_HDR void bar
> (ARG_DEF int x))) (FUNC_DEF (FUNC_HDR int foo (ARG_DEF int y) (ARG_DEF
> char d)) (BLOCK (VAR_DEF int i) (for (= i 0) (< i 3) (= i (+ i 1))
> (BLOCK (= x 3) (= y 5)))))
> Nodes: (VAR_DEF char c) (VAR_DEF int x) (FUNC_DECL (FUNC_HDR void bar
> (ARG_DEF int x))) (FUNC_DEF (FUNC_HDR int foo (ARG_DEF int y) (ARG_DEF
> char d)) (BLOCK (VAR_DEF int i) (for (= i 0) (< i 3) (= i (+ i 1))
> (BLOCK (= x 3) (= y 5)))))
> Nodes: (VAR_DEF char c) (VAR_DEF int x) (FUNC_DECL (FUNC_HDR void bar
> (ARG_DEF int x))) (FUNC_DEF (FUNC_HDR int foo (ARG_DEF int y) (ARG_DEF
> char d)) (BLOCK (VAR_DEF int i) (for (= i 0) (< i 3) (= i (+ i 1))
> (BLOCK (= x 3) (= y 5)))))
> Nodes: (VAR_DEF char c) (VAR_DEF int x) (FUNC_DECL (FUNC_HDR void bar
> (ARG_DEF int x))) (FUNC_DEF (FUNC_HDR int foo (ARG_DEF int y) (ARG_DEF
> char d)) (BLOCK (VAR_DEF int i) (for (= i 0) (< i 3) (= i (+ i 1))
> (BLOCK (= x 3) (= y 5)))))
> Nodes: (VAR_DEF char c) (VAR_DEF int x) (FUNC_DECL (FUNC_HDR void bar
> (ARG_DEF int x))) (FUNC_DEF (FUNC_HDR int foo (ARG_DEF int y) (ARG_DEF
> char d)) (BLOCK (VAR_DEF int i) (for (= i 0) (< i 3) (= i (+ i 1))
> (BLOCK (= x 3) (= y 5)))))
> Nodes: (VAR_DEF char c) (VAR_DEF int x) (FUNC_DECL (FUNC_HDR void bar
> (ARG_DEF int x))) (FUNC_DEF (FUNC_HDR int foo (ARG_DEF int y) (ARG_DEF
> char d)) (BLOCK (VAR_DEF int i) (for (= i 0) (< i 3) (= i (+ i 1))
> (BLOCK (= x 3) (= y 5)))))
> Nodes: (VAR_DEF char c) (VAR_DEF int x) (FUNC_DECL (FUNC_HDR void bar
> (ARG_DEF int x))) (FUNC_DEF (FUNC_HDR int foo (ARG_DEF int y) (ARG_DEF
> char d)) (BLOCK (VAR_DEF int i) (for (= i 0) (< i 3) (= i (+ i 1))
> (BLOCK (= x 3) (= y 5)))))
> Nodes: (VAR_DEF char c) (VAR_DEF int x) (FUNC_DECL (FUNC_HDR void bar
> (ARG_DEF int x))) (FUNC_DEF (FUNC_HDR int foo (ARG_DEF int y) (ARG_DEF
> char d)) (BLOCK (VAR_DEF int i) (for (= i 0) (< i 3) (= i (+ i 1))
> (BLOCK (= x 3) (= y 5)))))
> Nodes: (VAR_DEF char c) (VAR_DEF int x) (FUNC_DECL (FUNC_HDR void bar
> (ARG_DEF int x))) (FUNC_DEF (FUNC_HDR int foo (ARG_DEF int y) (ARG_DEF
> char d)) (BLOCK (VAR_DEF int i) (for (= i 0) (< i 3) (= i (+ i 1))
> (BLOCK (= x 3) (= y 5)))))
>
>
> Once I fixed your translate() function and using the b3 runtime tar.
>

Thank you.  Can you point out to me the problem with my translate() 
function?  My C programming skills are surely lacking.  My previous ANTLR 
experience is via the java interface but now I need to link my translator 
into lisp and hence the need for C seeing as there is a nice C ffi for 
sbcl... java however not so much.

Thanks again,
Jason


More information about the antlr-interest mailing list