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

(Undo revision 334887 by Petelomax (talk))
Line 5:
: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? --[[User:Petelomax|Pete Lomax]] ([[User talk:Petelomax|talk]]) 20:23, 6 June 2021 (UTC)
::: It offers a comparison of how language design issues interact with language implementation issues, amongst other things. --[[User:Tigerofdarkness|Tigerofdarkness]] ([[User talk:Tigerofdarkness|talk]]) 21:42, 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 "#" ). --[[User:Tigerofdarkness|Tigerofdarkness]] ([[User talk:Tigerofdarkness|talk]]) 18:25, 6 June 2021 (UTC)
Line 12 ⟶ 13:
::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.)
:::The task is about how the builtin mechanism can be provided - the Phix compiler (as I understand it) is written in Phix and so presumably the facilities are provided by code in Phix? --[[User:Tigerofdarkness|Tigerofdarkness]] ([[User talk:Tigerofdarkness|talk]]) 21:42, 6 June 2021 (UTC)
::It would without question still require some form of lexical analysis anyway, eg
<pre>
Line 29 ⟶ 31:
::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'm not sure why you mention "issues caused by using/declaring the same identifiers in multiple files" - my mention of "Many programming languages allow file inclusion, so that for example, standard declarations or code-snippets can be stored in a separate source file and be included into the programs that require them" was meant to indicate why pre-proessors were used.
 
:::Some lexical analysis is required to parse #include lines, but not as much as in e.g. PL/1 where you could see: <code>main: procedure; %include "someCode.incl.pl1"; end main;</code>.
:::I still argue that the task as written is a task that compares languages. In particular it compares the pre-processing facilities of languages.
 
:::The [[Self-hosting compiler]] task is a much harder, language specific task - it doesn't for example, say write a C compiler in your language. The [[Compiler/lexical_analyzer]] and related tasks are about writing a compiler for a simple C like language. The Algol 68 pre-processor in Algol 68 is similar in size to one of those tasks, so I think this task is not too large for an RC task.
:::Also, I doubt that a C pre-processor written in anything but C would get much use for anything other than bootstrapping... --[[User:Tigerofdarkness|Tigerofdarkness]] ([[User talk:Tigerofdarkness|talk]]) 21:42, 6 June 2021 (UTC)
3,021

edits