Possible bug in Expl compiler

65 views
Skip to first unread message

Athul P

unread,
Dec 10, 2020, 12:53:58 PM12/10/20
to XOS Users
A string containing colon symbol is not correctly parsed by the compiler.

tmp = exposcall("Write", -2, "Login:");  \\colon is present in the string
The assembly code generated by the compiler for the above statement is:
MOV R0,"Write"
PUSH R0
MOV R0,-2
PUSH R0
MOV R0,"" PUSH R0
PUSH R0
PUSH R0
CALL 0

The highlighted code causes INSTR_ERROR and the string is also empty.

ishan ghosh

unread,
Dec 10, 2020, 1:15:28 PM12/10/20
to XOS Users
Yes, this is a bug in the compiler or more like a special case that was not implemented.

myexpos/expl/ltranslate.l has something like
        [a-zA-Z0-9]+[:] {...}

This regex is used for label translation and it determines "Login:" as a label, it removes the occurrence of "Login:" from the string and checks if there are any instances of "Login" present to replace that with the address of the assumed label "Login:".
To fix the bug, add this code before the code above. Should be after "%%" in line 13 in ltranslate.l :
     \"(\\.|[^\\"])*\" {
     if(t)

     {

         fprintf(intermediate, "%s", yytext);

      }
}
"make" the compiler again. What the above code does is ignores all the strings that are in quotes "" during label translation.

Word of caution: this has not been tested.
Best case scenario: just don't use colons":" in strings.

Murali Krishnan

unread,
Dec 10, 2020, 1:30:56 PM12/10/20
to xos-...@googlegroups.com
I think the bug is with the XSM simulator rather than the compiler.  However since alphanumeric strings are permitted, we can ignore this issue.
We will try to fix it later.
Murali

--
You received this message because you are subscribed to the Google Groups "XOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xos-users+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/xos-users/5eaba03c-1f04-4c57-bf0c-abbf1816e7den%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages