Hello Ken, You need to turn on Upper case keywords. This is done by using the -I option on the command line or / $I / within the body of the program. When I was in college the University had a Xerox Sigma 6. I worked on the XPL complier that ran on that system. In fact that is how I got interested in compiler writing. If you send me the compiler source I will get it running for you. Please send it to shoefoot@gmail.com I suspect the dot(.) is a translation error. It probably should be an underscore(_)....
I got in a wad before looking at the options. So, I deleted my foolish post. Thanks for providing this. Its going to help me a lot.
I have an XPL XCOM compiler for the Sigma 7 / GORDO OS from 1968 -74 I'd like to get this this to run. I have your XPL C package and I intend to compile my XCOM with it to obtain Sigma code. The first statement is DECLARE #.TERMINALS LITERALLY '44', Which gives the error XPL to C language translator -- version 1.2 1 | DECLARE #.TERMINALS LITERALLY '44', | | *** Error, Illegal symbol pair: <identifier> <identifier> (detected at line 6448 in xcom). *** Partial parse to this point is: <statement list="">...
This is not a source file.
Change version to 1.2
Add xread() and xwrite().
Revision 1.2
Add xread() and xwrite(). Fix some spelling errors.
Document the changes in version 1.1
Bump the version number.
Add an option to handle conditional compile with the MODCOMP compiler.
Fix an error reported by the GNU C compiler.
Changes in version 1.0
Fix a concatenate bug where it would fail if both strings ended at FREEPOINT.
Fix a concatenate bug where it would fail if both strings ended at FREEPOINT.
The built-in-function EXIT will abort the program when used without an argument.
Add an error message for multiple definitions of parameters.
Add xtags to the makefiles.
A new program to generate a VI tags file for XPL programs.
Correctly flush I/O before rewind.
Add up arraw to the list of valid characters.
Add xtags to the makefile clean target.
Minor changes to document.
Format change.
Changes in version 0.7
FIX a bug when a RETURN statement is used in an IF statement and is the
:-) When I get comfortable enough to make the XPL language page on Rosetta, your routine will be put to use for case conversion, not the first day student copy listed above. I was about to pester about learning the ins and outs of references vs copies. REBOL programming seems a little similar in that area. When to leverage the efficiencies of references and when new copies need to be made. Thanks for the hint. Getting over the first few hurldes, will add base handling to the sum-digits task sample....
The lack of a BREAK statement in XPL is a problem. There are a few ways to work around this problem. Here are some suggestions: looping = 1; do while looping; if some_end_condition then looping = 0; /* do more stuff */ end; /* In XPL the upper limit is not recalculated */ /* This will not work */ x = 100; do i = 0 to x; if some_end_condition then x = 0; /* ... */ end; /* But you can change the index variable */ x = 100; do i = 0 to x; if some_end_condition then i = 256; /* ... */ end; /* You can...
The line: total = total + digit - byte('0'); Should read: total = total * base + digit - byte('0'); This should work for any base from 2 to 10. In my example the function UNIQUE makes a copy of the string so that the uppercase function does not corrupt other strings. For Example: base_data = 'abcdef'; new_stuff = uppercase(substr(base_data, 1, 3)); /* Should not corrupt the value of the string "base_data " */ It's easy to get a unique copy of a string. You move it to the top of the free string area....
The line: ~~~total = total + digit - byte('0'); ~~~Should read: ~~~total = total * base + digit - byte('0'); ~~~This should work for any base from 2 to 10. In my example the function UNIQUE makes a copy of the string so that the uppercase function does not corrupt other strings. For Example: ~~~stuff = 'abcdef'; new_stuff = uppercase(substr(stuff, 1, 3)); / Should not corrupt the value of the string "stuff "/ ~~~It's easy to get a unique copy of a string. You move it to the top of the free string...
The line: total = total + digit - byte('0'); Should read: total = total * base + digit - byte('0'); This should work for any base from 2 to 10. In my example the function UNIQUE makes a copy of the string so that the uppercase function does not corrupt other strings. For Example: stuff = 'abcdef'; new_stuff = uppercase(substr(stuff, 1, 3)); / Should not corrupt the value of the string "stuff "/ It's easy to get a unique copy of a string. You move it to the top of the free string area. Example: new_string...
The line: total = total + digit - byte('0'); Should read: total = total * base + digit - byte('0'); This should work for any base from 2 to 10. In my example the function UNIQUE makes a copy of the string so that the uppercase function does not corrupt other strings. For Example: stuff = 'abcdef'; new_stuff = uppercase(substr(stuff, 1, 3)); / Should not corrupt the value of the string "stuff "/ It's easy to get a unique copy of a string. You move it to the top of the free string area. Example: new_string...
The line: total = total + digit - byte('0'); Should read: total = total * base + digit - byte('0'); This should work for any base from 2 to 10. In my example the function UNIQUE makes a copy of the string so that the uppercase function does not corrupt other strings. For Example: stuff = 'abcdef'; new_stuff = uppercase(substr(stuff, 1, 3)); / Should not corrupt the value of the string "stuff "/ It's easy to get a unique copy of a string. You move it to the top of the free string area. Example: new_string...
The lack of a BREAK statement in XPL is a problem. There are a few ways to work around this problem. Here are some suggestions: looping = 1; do while looping; if some_end_condition then looping = 0; /* do more stuff */ end; /* In XPL the upper limit is not recalculated */ /* This will not work */ x = 100; do i = 0 to x; if some_end_condition then x = 0; /* ... */ end; /* But you can change the index variable */ x = 100; do i = 0 to x; if some_end_condition then i = 256; /* ... */ end; /* You can...
/* lower to UPPER case conversion */ declare map(255) bit(8); declare shift character initial ( 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'); initialization: procedure; declare (i, j) fixed; do i = 0 to 255; map(i) = i; end; do i = 0 to 25; j = byte(shift, i + 26); map(byte(shift, i)) = j; end; end initialization; uppercase: procedure(s) character; declare s character, i fixed; s = unique(s); do i = 0 to length(s) - 1; byte(s, i) = map(byte(s, i)); end; return s; end uppercase; main: procedure;...
Thanks again. I spent about a year back in the early 80's under a mentor who was the "structured programming, or no programming" type. Thinking back, he may have been from Denmark and loyal to the likes of Dijkstra. <joking></joking> It was good training in goto-less at all costs programming. :-) I'll post more starter questions if/when I put up the Rosetta Code XPL page and some of the simple tasks. Edit: adding a listing Didn't have time last night to dig up the first day coding attempt, just so...
Thanks again. I spent about a year back in the early 80's under a mentor who was the "structured programming, or no programming" type. Thinking back, he may have been from Denmark and loyal to the likes of Dijkstra. <joking></joking> It was good training in goto-less at all costs programming. :-) I'll post more starter questions if/when I put up the Rosetta Code XPL page and some of the simple tasks. Edit: adding a listing Didn't have time last night to dig up the first day coding attempt, just so...
Thanks again. I spent about a year back in the early 80's under a mentor who was the "structured programming, or no programming" type. Thinking back, he may have been from Denmark and loyal to the likes of Dijkstra. <joking></joking> It was good training in goto-less at all costs programming. :-) I'll post more starter questions if/when I put up the Rosetta Code XPL page and some of the simple tasks. Edit: adding a listing Didn't have time last night to dig up the first day coding attempt, just so...
Thanks again. I spent about a year back in the early 80's under a mentor who was the "structured programming, or no programming" type. Thinking back, he may have been from Denmark and loyal to the likes of Dijkstra. <joking></joking> It was good training in goto-less at all costs programming. :-) I'll post more starter questions if/when I put up the Rosetta Code XPL page and some of the simple tasks. Cheers, Blue
Nice. Thanks, Daniel. Works the charm. Did have to fix the /* */ comments in the first line. SourceForge markup ate the asterisks for italics. Not a biggy, and on par for SourceForge markdown expectations. :-) Have good, make well, Blue
The lack of a BREAK statement in XPL is a problem. There are a few ways to work around this problem. Here are some suggestions: looping = 1; do while looping; if some_end_condition then looping = 0; / do more stuff / end; / In XPL the upper limit is not recalculated / / This will not work / x = 100; do i = 0 to x; if some_end_condition then x = 0; / ... / end; / But you can change the index variable / x = 100; do i = 0 to x; if some_end_condition then i = 256; / ... / end; / You can also use the...
/ lower to UPPER case conversion / declare map(255) bit(8); declare shift character initial ( 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'); initialization: procedure; declare (i, j) fixed; do i = 0 to 255; map(i) = i; end; do i = 0 to 25; j = byte(shift, i + 26); map(byte(shift, i)) = j; end; end initialization; uppercase: procedure(s) character; declare s character, i fixed; s = unique(s); do i = 0 to length(s) - 1; byte(s, i) = map(byte(s, i)); end; return s; end uppercase; main: procedure;...
Not meaning to pester, Daniel, but also keen and at the bottom of the XPL learning curve. Are you up for a few beginner questions here in your discussion forum? As a for instance, how would an XPL guru go about defining uppercase(str) and lowercase(str) procedures, given that the code should be EBCDIC and ASCII agnostic, changing the str in place. I've tried a few things like byte(str, pos) = byte(map, j) on the left hand side of an assignment, but all I seem to get, is more confused. :-) Another;...
:-) Yes and no. As I was about to try and write up a minimal. I can't quite get the incantations that left the descriptors unset. All works as advertised. I was early exploring, and using sed to rename function entries generated, and when trying to reproduce, it all just works, Daniel, no traceback. prompt$ make tryargs xpl -I -m args.xpl XPL to C language translator -- version 0.6 12 cards containing 9 statements were compiled. No errors were detected. args XPL command line arguments 0 date: 120186...
:-) Yes and no. As I was about to try and write up a minimal. I can't quite get the incantations that left the descriptors unset. All works as advertised. I was early exploring, and using sed to rename function entries generated, and when trying to reproduce, it all just works, Daniel, no traceback. prompt$ make tryargs xpl -I -m args.xpl XPL to C language translator -- version 0.6 12 cards containing 9 statements were compiled. No errors were detected. args XPL command line arguments 0 date: 120186...
factor out a function for argc, argc with xpl -m
Add comment start, and line length options.
Bump revision. Fix typo.
Removed some unused variables.
Split date and time out to a separate .c file.
Add the program xformat to for XPL source programs.
Add the builtin variable input_record_limit to limit INPUT() string length.
Update the documentation.
Hex constants at the end of a C compatible string are ignored
Fixed in 0.5
Fixed in 0.5
Do loop iteration variable set too early
Formatting change to prevent text from running off the right side of the page.
Update the section on Name Space polution. Pluse other edits.
Rename many of the runtime functions to reduce namespace polution.
Add new functions: xfdopen, xio_get_flags, xio_set_flags.
Makefile cleanup
Remove teace() and untrace() from the runtime. Avoid namespace polution.
Fix short formats without arguments for xprintf, xfprintf and xsprintf.
Fix ticket #6. The compiler will now assign the iteration variable after evaluating the other expressions.
Fix short formats without arguments for xprintf, xfprintf and xsprintf.
Do loop iteration variable set too early
Add XPL_EOF as an EOF indicator used by xerrno.
Fix Ticket #5. Hex constants at the end of a C compatable string.
Hex constants at the end of a C compatible string are ignored
64-bit COREWORD()
Fixed in 0.4. Added the function CORELONGWORD().
Inconsistent arguments/parameters with forward declarations
Fixed in 0.4. Use the EXTERNAL keyword to define a function prototype.
Compiler error: forceaccumulator type 14 error
Comments on XPL documentation
Add the keywords: External and transparent
Fixed: call xprintf("(c)hex of 5 is %s:\n", hex (5));
Add a description of the new keywords EXTERNAL and TRANSPARENT
Add the keywords: External nad Transparent
Change errno to xerrno.
Add CORELONGWORD()
Implement the inline() function used within INITIAL() declarations.
Change gcc to $(CC) to improve portability.