intfiction.org

The Interactive Fiction Community Forum
It is currently Thu Jul 19, 2018 1:03 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: Sun Nov 05, 2017 12:19 pm 
Offline

Joined: Mon Dec 07, 2009 9:14 am
Posts: 186
Location: Chicago, IL
This may matter to very few people, but there is a file called "gram.t" to show some aspects of grammar production. If you try to compile that as is, you get:

Quote:
error: symbol "cmdTerminator" is already defined - can't redefine as object

If you correct that, it still doesn't compile because you have to add:

Quote:
#include "tok.h"

Once you add that, it works. But now try this:

Quote:
>take ball
[match 1: token count =
Runtime error: invalid index operation - this type of value cannot be indexed

So the program doesn't work regardless.

Why even bother with this? Well, this was basically done while trying to make sense of the material on this page:

http://tads.org/t3doc/doc/sysman/gramprod.htm

The example provided on that page is distributed and doesn't make a lot of sense. So I was hoping gram.t would fill in the gaps. And it largely does, conceptually. But I was trying to build up gram.t on the fly, as it were, so I could better understand the structural aspects of TADS 3. I was getting the above error (about indexing) in my own code and couldn't figure out what I was missing. So I finally just tried gram.t as provided and the above is the experience.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Sun Nov 05, 2017 1:28 pm 
Online

Joined: Sat Jul 16, 2011 3:48 pm
Posts: 285
gram.t? Where did you got that file? I don't have it in frobtads distribution. I'm not by any means an expert on TADS parser and don't know what you want, but setting libGlobal.parserDebugMode = true; could help you to look under the hood of parser and here is a little map I made several years back: http://tads.cz/en/parser-enpdf/file


Top
 Profile Send private message  
Reply with quote  
PostPosted: Sun Nov 05, 2017 2:07 pm 
Offline

Joined: Mon Dec 07, 2009 9:14 am
Posts: 186
Location: Chicago, IL
tomasb wrote:
gram.t? Where did you got that file? I don't have it in frobtads distribution.

Ah, interesting. The Windows distribution comes with a samples directory that includes files like anonobj.j, bantest.t, calc.t, gram.t, and so on. So I was looking at those because they sync up with the System Manual documentation.

tomasb wrote:
I'm not by any means an expert on TADS parser and don't know what you want, ...

Here I'm just trying to make some of the System Manual material a little more actionable by providing (or refining existing) examples that prove out some of the behavior that is discussed. Also, since that gram.t file is included in the distribution -- well, the Windows one at least -- I want to make sure TADS is distributed with a version that actually works. With the error I'm seeing, I can't tell if the issue is because the script is just bad or because something had changed with TADS but was not reflected in the scripts or documentation provided.

To be sure, none of this would in any way stop someone from starting up work with a game. But I'm introducing TADS as part of a wider context of introducing programming, so I'm micro-focusing on a few spots that might not have received as much attention.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Sun Nov 05, 2017 3:05 pm 
Online

Joined: Sat Jul 16, 2011 3:48 pm
Posts: 285
I've downloaded TADS System Source Code (porting kit) and it seems this file is not part of samples, but rather part of test suite. And given there is also gram2.t which is little different (apart from other changes it has tok.h included) and has counterpart in log directory (gram.t does not), maybe gram.t is old deprecated version. Try the gram2.t.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Sun Nov 05, 2017 4:35 pm 
Offline

Joined: Mon Dec 07, 2009 9:14 am
Posts: 186
Location: Chicago, IL
Sweeeeeet!

I wasn't even aware of all that stuff. Thanks for bringing that to my attention. I'll play around with those files.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Sun Nov 05, 2017 6:25 pm 
Offline

Joined: Mon Dec 07, 2009 9:14 am
Posts: 186
Location: Chicago, IL
Initially, gram2.t is even worse. Just a basic compile leads to:

Quote:
error: symbol "_main" (type: function) redefined in object file "gram.t3o"
error: symbol "dataTypeXlat" (type: function) redefined in object file "gram.t3o"
error: symbol "RuntimeError" (type: object) redefined in object file "gram.t3o"
error: symbol "Exception" (type: object) redefined in object file "gram.t3o"

This might be due to some need to specify a particular command line switch. I see a comment in the file about "copied from _main.t, which we don't include in this test." So I thought maybe I needed to do -nodef as part of the command line switches but that doesn't work either.

I haven't tried playing around with all files in that test folder yet but so far I have found a few that don't seem to work (sometimes compile errors, sometimes runtime errors) or don't match the output in the associated .log files. Still investigating.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Sun Nov 05, 2017 9:21 pm 
Offline
User avatar

Joined: Tue Apr 20, 2010 2:48 pm
Posts: 995
Location: Greece
These files are not supposed to be compiled as-is. They are part of the test suite and built in "special" ways.

You can read their code though and copy relevant parts to a normal project for experimenting there.

_________________
@realnc


Top
 Profile Send private message  
Reply with quote  
PostPosted: Mon Nov 06, 2017 5:37 am 
Offline

Joined: Mon Dec 07, 2009 9:14 am
Posts: 186
Location: Chicago, IL
Yeah, that's what I'm finding with the test files as part of the porting kit; these seem to have been built with a test harness approach. Gram.t, which is included as a standalone with the official distribution, however, seems to be in a different category. It just seems to have a bug in it. Actually, perhaps a few. And its implementation doesn't entirely match the System Manual page I referenced.

Again, I say all this totally realizing that 99% of people using TADS may never even see that file or care about it even if they do.


Top
 Profile Send private message  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group