Comments (10)
Ok, that is a good idea, I will work on it.
from obelisk.
Well indeed I thought about it, but the problem is that additional packages and command definitions are needed.
I may add an option to produce 2 files:
- the grammar part itself to be included
- a .sty file gathering extra
\RequirePackage
and\newcommand
statements as a package to be required
What about this solution ?
from obelisk.
I think it's OK. However, to avoid name clashes with other commands and even with many Obelisk grammars inserted at the same time, I think it would be good to prefix every command name with a (configurable?) string (and the style file should itself come with a configurable name).
from obelisk.
Let me now if you think it's ok, the new version is available on the master branch.
You can easily build Obelisk manually from there and do some tests, then I will publish an updated release on OPAM if everything is fine.
from obelisk.
Thanks. There is a problem if I include two grammars in the same file as both sty
files define the grammar
environment (as well as a bunch of commands that are not prefixed either). Is it the expected behavior? If not, I think the best solution is to prefix these names too.
EDIT: besides, the generated commands for terminals do not call OOps this is used in the other file.\gramterm
by default, this is too bad because it would allow to change the typography for all terminals in one stroke. I guess the same can be said for other classes of symbols...
from obelisk.
Thanks for the feedback!
My bad, I thought that the overwriting would be silent and not harmful since it would be strange to use different submodes (tabular, syntaxes, backnaur) in a same document.
Errors yield because I use \newcommand
and not \let
.
I will add the prefix to structural commands too.
from obelisk.
Should be OK now (let's hope 😅).
You can give it another try in the master branch.
from obelisk.
Actually I forgot to commit one file, so it didn't build.
Now it is OK.
from obelisk.
I think it's OK. Thanks.
Three more questions though (I'll let you see whether you'd like to make new issues out of them):
- Why don't you generate macros for non-terminals too, along those for terminals?
- When you define such macros, why don't you define them using the macros for terminals and non-terminals, e.g.
\newcommand\eleAND{\elegramterm{AND}}
(instead of\newcommand\eleAND{AND}
and then\elegramterm{\eleAND{}}
at call site, as is currently done)? It seems to me it gives more control to the user. - It would be nice to use the
longtabu
environment instead oftabu
, to allow nice page breaks. The documentation says it doesn't mix well with math, but it seems to be OK with a basic Menhir grammar at least (even when showing some terminals as LaTeX mathematical symbols).
from obelisk.
Nice !
A v0.2.0 release should be available in OPAM soon.
Why don't you generate macros for non-terminals too, along those for terminals?
Actually I just didn't think about it but it seems like a good idea.
When you define such macros, why don't you define them using the macros for terminals and non-terminals
Yes indeed. Actually I was considering macros as a way to redefine merely the names of the tokens, but you are right about the control.
It would be nice to use the longtabu environment instead of tabu, to allow nice page breaks.
I will investigate on this.
Thanks again for the feedback !
from obelisk.
Related Issues (13)
- Bars
- nonempty_list isn't recognized ? HOT 2
- nonempty_list latex output is incomplete HOT 2
- html output handling of < and > prevents copy and paste HOT 2
- Output EBNF for railroad diagram HOT 1
- [LaTeX] Incorrect or dubious printing HOT 2
- [LaTeX] generate macros for non-terminals
- [LaTeX] Use the generic macros at definitions rather than at call sites
- [LaTeX] use longtabu instead of tabu
- Productions starting with "end" generate wrong Latex HOT 4
- Display of pairs seems erroneous HOT 2
- support the new syntax ? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from obelisk.