View previous topic :: View next topic |
Author |
Message |
keinfarbton
Joined: 03 Dec 2005 Posts: 224 Location: Stuttgart - Germany
|
Posted: Wed Apr 26, 2006 4:03 pm Post subject: reference manual? |
|
|
I am looking for the reference manual.
The site guide.html refers to a "reference manual" in many places. But I cannot find a page or pdf which is explicitely named like this. Can someone please give a link? |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
mpah
Joined: 18 Jul 2005 Posts: 29 Location: UK
|
Posted: Sun Apr 30, 2006 2:04 am Post subject: |
|
|
Many apologies for false hopes raised - result of early optimism. There should be a reference manual, but it isn't there yet. In the meantime you have to paraphrase the epitaph for Sir Christopher Wren - 'if you want a reference manual, look about you' (the original is 'si monumentum requiris ... ' and it it's in the middle of St Paul's Cathedral).
In particular there are sections linked from the documentation pages that go fairly unchanged into a manual - see 'details'. But there is plenty to do, and it's a matter of how I focus my effort.
If you have some specific questions, please ask them here on the forum. At least that helps me to see what is and what is not understood, and the result is an increase in shared understanding - sometimes. _________________ The Language Machine - a toolkit for language and grammar |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
keinfarbton
Joined: 03 Dec 2005 Posts: 224 Location: Stuttgart - Germany
|
Posted: Wed May 03, 2006 5:43 pm Post subject: |
|
|
What do you think:
Would it be possible to build gdc with lm? performance?
I tried to understand the mediawiki example.
Code: | '===' var Text; h2 '===' <- unit h2 :Text eom; |
what does this var Text mean? Is it the same Text as in the right side?
Code: | - (Text) <- lkx - ; |
Is it the same Text here?
In extendedcalc I found this line:
Code: | [0-9] ? { repeat .[0-9] ? } { option '.' ? repeat [0-9] ? } toNum :N <- opnd :N; |
Other character classes have a leading dot. Here the first dot is missing. Is this a typo or a special something?
What I miss in the documentation, are relative links. I want to read the pages offline. |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
mpah
Joined: 18 Jul 2005 Posts: 29 Location: UK
|
Posted: Thu May 04, 2006 4:28 am Post subject: |
|
|
use of lm for gdc
Although lm is pretty fast, it is not fast enough for use as a production compiler. The d2d frontend does not at present deal with variables and types in detail - that can be done, but I haven't done it.
I think an interface to the gcc (or possibly llvm) code generators could be useful (I did make a start as can be seen on the web pages), but none of these are things you plunge into unless you really need to do it - there is always a mountain of detail to discover, and as we have seen with gdc, the goalposts at both ends are running all over the pitch.
output buffers
In the mediawiki example, the variable "Text" is being used as an output buffer.
In this rule
Code: | '===' var Text; h2 '===' <- unit h2 :Text eom;
|
a variable "Text" is created so that it is visible to rules for "h2" - it is used as an output buffer. When the rules for "h2" finish (by supplying the goal symbol "h2"), the resulting value (the contents of the buffer) is provided as a variable binding on the right-side.
Output buffer variables are just variables that are being used in that way - the scope rules for referring to them are the same as for any other variable, so "Text" on the right-side here refers to the variable created on the left-side.
The value of an output buffer is treated as a single symbol, unless converted back to individual characters by the builtin function "toChars()".
The notation for appending to an output buffer is a variable reference enclosed in brackets. The effect is to consume one symbol, and append its textual representation to the value of the variable - the variable is treated as a textual output buffer. So just as
means 'match one symbol and send its textual representation to the output stream'
Code: | - (Text) <- lkx - ;
|
means 'match one symbol and append its textual representation to the variable "Text", treating "Text" as an output buffer'.
Note that a variable can only be used as a textual output buffer if it is explicitly created in a "var" declaration and is either not initialised or has been established as a textual otuput buffer variable. So the variable "Text" could be used as an output buffer variable after being declared by 'var Text;' or after being declared and initialised by 'var Text = ();' or if it has been already been declared as a variable, by being reinitialised as an empty textual output buffer by 'Text = ();'.
lexical classes
Initially the notation for lexical classes did not include the '.' - but I aim to move to a notation where the '.' is required, so as to avoid potential confusion between notations for array subscription and for lexical classes. At present either form is accepted - you can see this if you look at the metalanguage rules under 'lexical detail', where the two forms are given identical treatment:
Code: | "[" { repeat ex .[^\]] ? } ']' toSym:X <- lexsym :X ;
".[" { repeat ex .[^\]] ? } ']' toSym:X <- lexsym :X ;
|
the web pages
Most of the web page links are relative - the ones that are coded in the mediawiki '[[ ... ]]' notation. Also, you can build the website locally:
Code: | cd [path-to-where-you-unpacked-and-built-the-tarball]/src/web
make |
I hope that helps - feedback is a good thing (TM) - thank you.
Peri _________________ The Language Machine - a toolkit for language and grammar |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
tbolsh
Joined: 26 Jul 2006 Posts: 7
|
Posted: Tue Aug 01, 2006 3:54 pm Post subject: |
|
|
Hello!
My goal is to translate part of our Java 1.5 project into D Programming Language and see how it will work there. But reading your documenation I become interested how The Language Machine works. So far I found only some errors (?) eiter in documentation or in the code.
So, first of all if you try copy and paste "the forward Polish calculator in full" example from
guide.html into text editor and provide suggested
Code: | make fpcalc.lmr
lm -r fpCalc.lmr
|
You will see that it would not work. At least it was not working in my situation. It starts to work when I shift all the rules (put some spaces before them). So, when there are no spaces before rules it produces .lmr file with zero length and did not complain about any errors.
Second. If grammar identifier are without the leading spaces (and rules are shifted!) program behaves even stranger - you can see for yourself.
So, it is my 2 cents into debugging of The Language Machine. I am extremly interested in its j2d part with 1.5 complience (templates, enums, etc). I am also very interested in Java Libraries for this kind of conversion - gnu classpath or something else.
Tim. |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
mpah
Joined: 18 Jul 2005 Posts: 29 Location: UK
|
Posted: Wed Aug 02, 2006 1:35 am Post subject: |
|
|
Hi - very good to know of your interest. What you describe isn't a bug - it's a kind of literate programming. Lines that start with at least one space are treated as source text to be compiled as rules and directives. Other lines are treated as annotation with a subset of wikimedia markup conventions. I have found this very useful, and it is documented, but I see that it can be confusing.
I hope that helps.
Peri _________________ The Language Machine - a toolkit for language and grammar |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
tbolsh
Joined: 26 Jul 2006 Posts: 7
|
Posted: Wed Aug 02, 2006 9:24 am Post subject: |
|
|
mpah wrote: |
I hope that helps.
Peri |
Sure it does, thank you. But that bring up a question about Refernce Manual - where everyhting will be in one place.
Tim. |
|
Back to top |
|
![](templates/subSilver/images/spacer.gif) |
|