Skip to content

Conversation

gradha
Copy link
Contributor

@gradha gradha commented Jan 3, 2014

The following changes work fine in doc commands except for the lack of types when a parameter is found with a default parameter but without a specified type. When I try to run in doc2 mode I don't seem to make sense of the sym structure and the proc to convert the typ to a string sigsevs without a call stack, so I don't know where what is failing.

@gradha
Copy link
Contributor Author

gradha commented Jan 3, 2014

Ah, it was an assert crashing, doc2 gives nkSym nodes instead of nkIdent

@gradha
Copy link
Contributor Author

gradha commented Jan 3, 2014

There you go. Fixed and working with koch web. The easiest way to check the difference is to look at the one and only index.

@zah
Copy link
Member

zah commented Jan 4, 2014

Wouldn't the links be even nicer if they look like this:

==
   system.nim : proc `==`(x, y: string): bool

@gradha
Copy link
Contributor Author

gradha commented Jan 4, 2014

And even nicer if they sorted alphabetically for each term rather than the current mess. The changes so far were to make hrefs unique and the index look is just a side-effect of it not using anything more elaborate than the href to display to the user, since the .idx files only contain the filename and href.

I think http://dl.dropboxusercontent.com/u/145894/t/ndocs/rstgen.html#setIndexTerm could accept an additional default parameter with the wanted look for the index hyperlink. Do you know if it is safe for the index files to grow a third column to store it? Is there any other program reading index files?

@zah
Copy link
Member

zah commented Jan 4, 2014

I don't think the index file is meant for anything besides humans at the moment, but @Araq may know better.

@gradha
Copy link
Contributor Author

gradha commented Jan 5, 2014

Bumped with better index.

@gradha gradha mentioned this pull request Jan 28, 2014
@gradha
Copy link
Contributor Author

gradha commented Jan 28, 2014

Replaced by #850.

@gradha gradha closed this Jan 28, 2014
@gradha gradha deleted the pr_better_html_links2 branch April 8, 2014 09:58
Clyybber pushed a commit to Clyybber/Nim that referenced this pull request Sep 16, 2023
## Summary

Move the routines and types that make up the DSL to the `mirconstr`
module and use the DSL in both the `injectdestructors` and `mirbridge`
module.

Apart from making the MIR code generation in both modules less complex,
manual, and error-prone, this is also significant progress towards the
MIR code coming out of the `injectdestructors` pass having proper type
information, which is a requirement for having MIR passes that run after
`injectdestructors`.

## Details

* move the `EValue` and `ChainEnd` types to `mirconstr`
* move the atomic DSL operands to `mirconstr`. The `notOp`, `modify`,
  `outOp`, and `tupleAccess` operands stay in `mirgen`
* add wrapper templates for DSL operands that `mirgen` still calls with
  a `TCtx` instance instead of a `MirNodeSeq`

As part of moving them, some operand routines that had a 'gen' prefix
are changed to not have it, making the routine names more consistent.

In addition, some cleanup in `mirconstr` is performed, and the DSL
extended a bit:
* `|=>`, `=>|`, and `previous` are removed. They were unused and didn't
  fit in with the overall design
* the `emit`, `symbol`, and `opParam` operands are added, all of which
  are only useful outside of `mirgen`

Another addition is the `predicate` meta operand, which makes it
possible to write chains where an operand is conditionally excluded:

```nim
chain(...): a() => predicate(cond) => b() => c()
```

Here, `b()` is only evaluated if `cond` evaluates to 'true'. Using two
chains plus an in-between 'if' statement was previously necessary to
achieve the same.

Finally, documentation about the DSL is added, and the
`injectdestructors` and `mirbridge` modules are changed to use the DSL
for generating MIR code. The logic from the `genInjectedSink` procedure
was previously duplicated into `genSinkFromTemporary`, but this is now
fixed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants