Code Monkey home page Code Monkey logo

Comments (10)

Lelio-Brun avatar Lelio-Brun commented on May 28, 2024 1

Ok, that is a good idea, I will work on it.

from obelisk.

Lelio-Brun avatar Lelio-Brun commented on May 28, 2024

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:

  1. the grammar part itself to be included
  2. a .sty file gathering extra \RequirePackage and \newcommand statements as a package to be required

What about this solution ?

from obelisk.

grayswandyr avatar grayswandyr commented on May 28, 2024

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.

Lelio-Brun avatar Lelio-Brun commented on May 28, 2024

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.

grayswandyr avatar grayswandyr commented on May 28, 2024

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 \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... OOps this is used in the other file.

from obelisk.

Lelio-Brun avatar Lelio-Brun commented on May 28, 2024

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.

Lelio-Brun avatar Lelio-Brun commented on May 28, 2024

Should be OK now (let's hope 😅).
You can give it another try in the master branch.

from obelisk.

Lelio-Brun avatar Lelio-Brun commented on May 28, 2024

Actually I forgot to commit one file, so it didn't build.
Now it is OK.

from obelisk.

grayswandyr avatar grayswandyr commented on May 28, 2024

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 of tabu, 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.

Lelio-Brun avatar Lelio-Brun commented on May 28, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.