Talk:Compiler/Simple file inclusion pre processor: Difference between revisions

From Rosetta Code
Content added Content deleted
(filter??)
(Undo revision 334887 by Petelomax (talk))
Line 29: Line 29:
::I would specifically state the task need not attempt to resolve any issues caused by using/declaring the same identifiers in multiple files.
::I would specifically state the task need not attempt to resolve any issues caused by using/declaring the same identifiers in multiple files.
::I (still) think the task should require toy C to be targetted, with any host-language-specific code parked on sub-pages. --[[User:Petelomax|Pete Lomax]] ([[User talk:Petelomax|talk]]) 20:17, 6 June 2021 (UTC)
::I (still) think the task should require toy C to be targetted, with any host-language-specific code parked on sub-pages. --[[User:Petelomax|Pete Lomax]] ([[User talk:Petelomax|talk]]) 20:17, 6 June 2021 (UTC)

===filter??===
If you implement this as a "filter", with input from stdin, how is `#include hello_world.t` or for that matter `PR include "somefile.incl.a68" PR` expected to work, exactly?? --[[User:Petelomax|Pete Lomax]] ([[User talk:Petelomax|talk]]) 20:31, 6 June 2021 (UTC)

Revision as of 20:33, 6 June 2021

wrong language

This task would probably be more useful and help compare different languages better (the point of this site) if it handled the same syntax used by Compiler/Sample_programs, rather than ALGOL 68 processes ALGOL 68, C processes C, PL/1 processes PL/1, Phix processes Phix, etc. --Pete Lomax (talk) 17:35, 6 June 2021 (UTC)

You have a point, but by processing the actual language, it compares the language's pre-processor facilities and also how hard pre-processing the source is.
I strongly suspect that the syntax of Algol 68, PL/1 and COBOL (for example) makes the implementation harder than a C pre-processor would be, which was part of my motivation.
Why? --Pete Lomax (talk) 20:23, 6 June 2021 (UTC)
To pre-process Algol 68, PL/1 and COBOL for this task requires some level of lexical analysis, whilst a C pre-processor need only find lines that start with "#include" ( possibly with spaces before and after the "#" ). --Tigerofdarkness (talk) 18:25, 6 June 2021 (UTC)
Thanks for considering and attempting the task, BTW. --Tigerofdarkness (talk) 18:36, 6 June 2021 (UTC)
As per the abortive Phix entry each submission c/should explain some of the issues that might arise were it applied to the specific language itself instead of the toy C.
(And at least in the Phix case extol the virtues of any existing builtin mechanisms that provide similar functionality.)
It would without question still require some form of lexical analysis anyway, eg
/*
#include tests
*/
#include hello_world.t
#include phoenix_number.t
print("#include tests completed\n")
with expected output of
Hello, World!
142857
#include tests completed
I would specifically state the task need not attempt to resolve any issues caused by using/declaring the same identifiers in multiple files.
I (still) think the task should require toy C to be targetted, with any host-language-specific code parked on sub-pages. --Pete Lomax (talk) 20:17, 6 June 2021 (UTC)