gist.github.com

brunofin, to linux in wayland, not even once

Boycott you instead, dinosaur.

Isn’t Linux about freedom? Fucking pick a distro that uses X11 you like and keep X11, or build your own or some crap like that.

safefel556,

Don’t worry the red hat moderators will boycott me by issuing a ban

mintycactus,
@mintycactus@lemmy.world avatar

deleted_by_author

  • Loading...
  • safefel556,

    Still not a reason to ban anyone. They openly censor opposing opinions and you are literally advocating this.

    hunger,
    @hunger@programming.dev avatar

    Removing dump stuff to keep a community relevant, on topic and with a good signal to noise ratio is not censorship. Claiming so is just dumb.

    safefel556,

    What I post is relevant and on-topic and you have outed yourself as an actual paid shill. I’ll give you a tip, don’t advocate for censorship so openly. Even if you do, there are discreet ways to do so.

    breadsmasher,
    @breadsmasher@lemmy.world avatar

    Ah you got him! The Elders of Wayland are paying this dude to shill wayland on a tiny lemmy community /s

    You should get offline and go touch grass. you are losing touch with reality

    safefel556,

    Wherever you say, shill

    breadsmasher,
    @breadsmasher@lemmy.world avatar

    I don’t believe you even know what a “shill” is

    hunger,
    @hunger@programming.dev avatar

    Censorship is about you being limited in the actions you can take to express yourself. It is not about cushioning you from the consequences of those actions from the people around you.

    You obviously were allowed to take action: The contents was apparent upon on a forum and here as well. People reacted to your actions: Admins removed your contents and blocked you and I am telling you that your understanding of wayland as well as politics is limited.

    Deal with it.

    brunofin,

    Did you really wake up so early this morning and chose violence?

    Dude it’s Friday. Leave us alone and go be happy.

    madnificent, to programming in Hand-rolling a parser in Scheme for EBNF (already made the tokenizer!)

    github.com/mu-semtech/sparql-parser contains an EBNF parser for SPARQL, an LL(1) language. You might be able to borrow code, not sure how well it translates to scheme. GitHub asked me to log in to see the gist so I’d have to have a peek later.

    sparql-ast folder contains the relevant bits regarding the parsing.

    cerement, to programming in Hand-rolling a parser in Scheme for EBNF (already made the tokenizer!)
    @cerement@slrpnk.net avatar
    tsonfeir, to programming in First draft grammar of Xeph, a non-pure functional language, a superset of ASDL. Input is needed. (+ guide on reading EBNF)
    @tsonfeir@lemm.ee avatar

    rulese?

    ChubakPDP11,

    I don’t understand. Am I doing something against the rules of this instance? I have posted stuff like this before?

    dsemy,

    I think he means this typo:

    [ and ] mark optional rulese, for example, [ ‘a’ ] could mean a or an empty language (sigma).

    ChubakPDP11,

    Uh apologies. I did not realize that.

    Corbin, to programming in First draft grammar of Xeph, a non-pure functional language, a superset of ASDL. Input is needed. (+ guide on reading EBNF)

    It looks alright. You’ll have to use it for a few months before knowing whether it’s comfortable.

    To be honest, I’m not a fan of variables; I’m in the tacit/concatenative camp. But I think it’s good to try new things and learn for yourself why they are good or bad.

    ChubakPDP11,

    You showed up! So, about this, you see how ‘let’ binding does not allow you to add parameters right? (the val binding does) I think this is a good place to use tacitness. I will basically add Perl-like, POSX-shell-like features. To further add concatativenss, I shall add OCaml-style shell (|>). I will take a page from F#'s book and add a ‘<|’ too. I was originally planning to have these two operators be defined orthogonal-like via the operator binders (infix, infixr etc) but I think it’s necessary to bake them in.

    So any other cool stuff? I plan on having intrinsics like ‘add’ and ‘or’ etc. Since it is translated down to C, I will add a two-way FFI, similar to the language I am writing it in, Cyclone Scheme.

    THANKS.

    bluey, to programming in AllocPPx.pl -> A Perl script that preprocesses C with garbage collection!
    bitcrafter,

    Because it looks like that functionality uses special compiler functionality only available on GCC and clang?

    hardkorebob, to programming in AllocPPx.pl -> A Perl script that preprocesses C with garbage collection!

    Man I C this Perl is so awesome! Thanks for this cool tool!

    ChubakPDP11,

    No problem my good man. Have fun.

    hardkorebob,

    Check out my DSL I made for Python in Shell. github.com/dislux-hapfyl/shimkyI checked out all your projects on GitHub. You are a Super Programmer for sure.

    ChubakPDP11,

    Cool. I can’t see the implementation though? Thanks a lot man. Really means a lot. @Corbin knows a lot more though. (since I called Rust a ‘shitlang’ I realize you may be ironic — Since Rust is more of a ‘fandom’ than a ‘compiler’, but I’m not going to offend you by assuming so. If you are truly giving me props, it’s really appreciated! :D )

    hardkorebob,

    I am a n00b so I really dont have fandom. I just learning and sharing. No offense taken.

    solrize, to programming in AllocPPx.pl -> A Perl script that preprocesses C with garbage collection!

    It’s cool that someone is still using perl. It’s sad that anyone is still using C. (Yes I still use it myself, but…).

    ChubakPDP11,

    Why ‘exactly’ is it bad that people are still using C, a language with 4 decades of toolchain and library build-up, instead of a shitlang like Rust that is mainly used to create garbage webapps?

    Cyberflunk,

    Rust is a “shitlang”?

    Ok.

    FizzyOrange,

    Wow, I would love to understand what leads to such insane views. Like, did Rust kill your father or something?

    I’m actually serious, why do you have such love for a bad (by modern standards) language like C and such hatred for a great language like Rust?

    lolcatnip, (edited )

    Ooooh, luddism is so edgy!

    And no, Rust is not primarily used to generate web apps, shitty or otherwise. You’re thinking of JavaScript.

    ChubakPDP11,

    Cool, as I just said, Rust is more of a ‘fandom’ than a ‘compiler’ really, it’s also not much of a ‘language’. I use C because it’s standardized by ISO, not some basement-dwelling incels who keep RFCi’ing their ideas instead of implementing it their own.

    hascat,

    If C is so great, why do you have to hack in garbage collection?

    lolcatnip, (edited )

    I’d say you’re misinformed, but it requires some real idiocy to be that badly misinformed and that deliberately insulting to a whole programming language community.

    UlrikHD, (edited )
    @UlrikHD@programming.dev avatar

    Please refrain from using slurs and disparaging people for no good reason on our instance.

    ChubakPDP11,

    Alright sorry. I’m just trolling people. If you go to my profile I have a lot of Rust projects. @hascat @FizzyOrange

    Dirk, to linux in Run Flatpak apps by search filter or through fuzzy finder menu
    @Dirk@lemmy.ml avatar

    That’s simple bash completion but with extra steps :)

    thingsiplay,

    Not really, because the search term can match anywhere in the name. Also it searches in executable name (app id) and the app name, a descriptive text. So its more than a Bash completion would be.

    mwguy, to linux in Run Flatpak apps by search filter or through fuzzy finder menu

    Can we just have flatpak apps added to the system path by default? Like have a directory /usr/local/flatpak/bin and have links to all the executable show up there. Then users can choose to add that to their path if they wish.

    thingsiplay,

    We have that already: $ ls “/var/lib/flatpak/exports/bin/”

    mwguy,

    Well now I feel silly. Brb changing my default path.

    thingsiplay,

    No need to feel silly. If you didn’t ask, you wouldn’t learn about it. I learned about it yesterday in the post where I initially gave the first version of the script. It’s a documentation issue I would say, in some way. Such an important part should have been made clear for every user.

    I “insist” you feel not sorry, because I’m in the same boat as you. :D

    Dirk,
    @Dirk@lemmy.ml avatar

    … and this part is before /usr/local/bin making it impossible to override Flatpak bins or desktop files.

    thingsiplay, (edited )

    One can just move the path to another place in the $PATH. Not really impossible. Not an elegant solution, just proof of concept:

    
    <span style="font-weight:bold;color:#a71d5d;">export </span><span style="color:#323232;">PATH</span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#183691;">"$(</span><span style="color:#62a35c;">echo </span><span style="color:#183691;">"${</span><span style="color:#323232;">PATH</span><span style="color:#183691;">}" </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">sed </span><span style="color:#183691;">'s+:/var/lib/flatpak/exports/bin++'):/var/lib/flatpak/exports/bin"
    </span>
    

    Edit:

    Or if it makes you uncomfortable to change the placement of this folder in the $PATH, instead you can just add a new directory solely for this purpose. In example add “/home/yourname/.local/flatpak/bin” (or whatever else you like) and put it in front of the flatpak exports directory.

    barbara, to linux in Run Flatpak apps by search filter or through fuzzy finder menu

    those commands are gold! Thank you for sharing! Saved them. They work flawlessly so far.

    If flatpak search would work with fzf, it would be easier to use and faster than GNOME software

    edit:

    I added echo “${app}” to flatapp in order to print the app in terminal to have a visual response which app will run. (some apps take some seconds to open on my slow machine)

    thingsiplay, (edited )

    I thought about additional echo for confirmation too! I will add it too (give me 2 minutes), but it will output to stderr, so it’s not part of regular output.

    Edit: So I added

    
    <span style="color:#62a35c;">echo </span><span style="color:#183691;">"flatpak run" "${</span><span style="color:#323232;">app</span><span style="color:#183691;">}" "${</span><span style="color:#323232;">@</span><span style="color:#183691;">}" </span><span style="font-weight:bold;color:#a71d5d;">>&</span><span style="color:#323232;">amp</span><span style="font-weight:bold;color:#a71d5d;">;</span><span style="color:#323232;">2
    </span>
    

    , which as said will output to stderr instead. And I also decided to add flatpak run and the arguments too, but that’s just an “aesthetic” choice.

    thingsiplay,

    Hey, I just created a search with fzf menu for install or uninstall app. It’s not pretty, because its a bit unorganized looking and I could not find a good and easy way to solve this. But it seems to be working so far.

    flatsearch

    barbara,

    That is awesome as well. Incredible what you can do with just a few lines of code.

    Corbin, to programming in A guide on using the Zephyr ASDL language (my implementation, specifically) | The Abstract Syntax Description Language

    Congratulations on taking a step towards self-hosting and meta-circular compilation. ASDL is a great intermediate meta-language and it can be used to abstract any sort of Builder or Command workflow. This is sometimes called a “narrow waist”; ASDL replaces ad-hoc AST-builder objects with a unified protocol and interface.

    For example, I encoded Monte into ASDL while rewriting the compiler in Monte, as part of a self-hosting effort. I also wrote a module which parses ASDL and emits Monte modules, including AST-building tools at runtime. Monte supports E-style quasiliterals, including source-code literals. This let our compiler directly consume ASDL files and emit Monte source code. Going beyond the compiler, this allowed me to encode UI elements and widgets as ASTs and use the Command pattern to write widget-handling objects.

    ChubakPDP11,

    Thanks a lot my good man. Is this Monte? github.com/monte-language/monte I can’t find the source code?

    Can you tell me what you think of the code my implementation emits when you got the time? Is it good, bad, medicore etc?

    So when you’re building a language, should you always use a builder for the AST specifications? Becuase I figure, you don’t need that in a language like Haskell or OCaml right?

    I currently have 3 projects I ping-pong.

    1- Marsh, a POSIX shell in C; 2- Awk2X; a translator of AWK to several languages, like C, Python Rust etc. This one is in Haskell 3- Cephyr; a C compiler in OCaml

    For Marsh, I am stuck in the job control section. I just can’t seem to find a flow for redirecting input and output. I think I am striking a balance though. I revised the job control like 10 times, literally 10 times.

    But for Awk2X and Cephyr, I am kinda stuck at defining the AST. I learned Haskell just last night and I made this AST. I am not ‘stuck’ really, I will move on from it soon.

    
    <span style="font-weight:bold;color:#a71d5d;">data </span><span style="color:#0086b3;">UnaryOp
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">= </span><span style="color:#0086b3;">Prefix PrefixOp
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#0086b3;">Postfix PostfixOp
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">deriving</span><span style="color:#323232;"> (</span><span style="color:#0086b3;">Show</span><span style="color:#323232;">)
    </span><span style="color:#323232;">
    </span><span style="font-weight:bold;color:#a71d5d;">data </span><span style="color:#0086b3;">PrefixOp
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">= </span><span style="color:#0086b3;">PrefixIncr
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#0086b3;">PrefixDecr
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#0086b3;">Plus
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#0086b3;">Minus
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#0086b3;">Not
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">deriving</span><span style="color:#323232;"> (</span><span style="color:#0086b3;">Show</span><span style="color:#323232;">)
    </span><span style="color:#323232;">
    </span><span style="font-weight:bold;color:#a71d5d;">data </span><span style="color:#0086b3;">PostfixOp
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">= </span><span style="color:#0086b3;">PostfixIncr
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#0086b3;">PostfixDecr
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">deriving</span><span style="color:#323232;"> (</span><span style="color:#0086b3;">Show</span><span style="color:#323232;">)
    </span><span style="color:#323232;">
    </span><span style="font-weight:bold;color:#a71d5d;">data </span><span style="color:#0086b3;">BinaryOp
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">= </span><span style="color:#0086b3;">Add
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#0086b3;">Sub
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#0086b3;">Mul
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#0086b3;">Div
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#0086b3;">Mod
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#0086b3;">Eq
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#0086b3;">Ne
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#0086b3;">Gt
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#0086b3;">Ge
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#0086b3;">Le
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#0086b3;">Lt
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#0086b3;">And
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#0086b3;">Or
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">deriving</span><span style="color:#323232;"> (</span><span style="color:#0086b3;">Show</span><span style="color:#323232;">)
    </span><span style="color:#323232;">
    </span><span style="font-weight:bold;color:#a71d5d;">data </span><span style="color:#0086b3;">Lvalue
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">= </span><span style="color:#0086b3;">Unfixed String
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#0086b3;">Fixed String String
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">deriving</span><span style="color:#323232;"> (</span><span style="color:#0086b3;">Show</span><span style="color:#323232;">)
    </span><span style="color:#323232;">
    </span><span style="font-weight:bold;color:#a71d5d;">data </span><span style="color:#0086b3;">Factor
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">= </span><span style="color:#0086b3;">Constant Constant
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#0086b3;">Lvalue Lvalue
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">deriving</span><span style="color:#323232;"> (</span><span style="color:#0086b3;">Show</span><span style="color:#323232;">)
    </span><span style="color:#323232;">
    </span><span style="font-weight:bold;color:#a71d5d;">data </span><span style="color:#0086b3;">Constant
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">= </span><span style="color:#0086b3;">String String
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#0086b3;">Integer Int
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#0086b3;">Float Float
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#0086b3;">Regex String
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">deriving</span><span style="color:#323232;"> (</span><span style="color:#0086b3;">Show</span><span style="color:#323232;">)
    </span><span style="color:#323232;">
    </span><span style="font-weight:bold;color:#a71d5d;">data </span><span style="color:#0086b3;">Expr
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">= </span><span style="color:#0086b3;">Unary UnaryOp Factor
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#0086b3;">Binary Factor BinaryOp Factor
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#0086b3;">Ternary Expr Expr Expr
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#0086b3;">StrCat</span><span style="color:#323232;"> [</span><span style="color:#0086b3;">Expr</span><span style="color:#323232;">]
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#0086b3;">Delete Expr
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#0086b3;">Call String</span><span style="color:#323232;"> [</span><span style="color:#0086b3;">Expr</span><span style="color:#323232;">]
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#0086b3;">Assign Lvalue Expr
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">deriving</span><span style="color:#323232;"> (</span><span style="color:#0086b3;">Show</span><span style="color:#323232;">)
    </span><span style="color:#323232;">
    </span><span style="font-weight:bold;color:#a71d5d;">data </span><span style="color:#0086b3;">Stmt
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">= </span><span style="color:#0086b3;">Express Expr
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#0086b3;">For Expr Expr Expr Stmt
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#0086b3;">ForIn Lvalue Lvalue Stmt
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#0086b3;">DoWhile Stmt Expr
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#0086b3;">While Expr Stmt
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#0086b3;">If Expr Stmt</span><span style="color:#323232;"> (</span><span style="color:#0086b3;">Expr</span><span style="color:#323232;">, </span><span style="color:#0086b3;">Stmt</span><span style="color:#323232;">))
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#0086b3;">Return</span><span style="color:#323232;"> (</span><span style="color:#0086b3;">Maybe Expr</span><span style="color:#323232;">)
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#0086b3;">Break
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#0086b3;">Continue
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#0086b3;">Compound</span><span style="color:#323232;"> [</span><span style="color:#0086b3;">Stmt</span><span style="color:#323232;">]
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">deriving</span><span style="color:#323232;"> (</span><span style="color:#0086b3;">Show</span><span style="color:#323232;">)
    </span><span style="color:#323232;">
    </span><span style="font-weight:bold;color:#a71d5d;">data </span><span style="color:#0086b3;">Pattern
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">= </span><span style="color:#0086b3;">Begin
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#0086b3;">End
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#0086b3;">Expr Expr
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#0086b3;">ExprPair Expr Expr
    </span><span style="color:#323232;">
    </span><span style="font-weight:bold;color:#a71d5d;">data </span><span style="color:#0086b3;">PatternAction
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">= </span><span style="color:#0086b3;">WithPattern Pattern</span><span style="color:#323232;"> [</span><span style="color:#0086b3;">Stmt</span><span style="color:#323232;">]
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#0086b3;">JustAction</span><span style="color:#323232;"> [</span><span style="color:#0086b3;">Stmt</span><span style="color:#323232;">]
    </span><span style="color:#323232;">
    </span><span style="font-weight:bold;color:#a71d5d;">data </span><span style="color:#0086b3;">FunctionDefn </span><span style="font-weight:bold;color:#a71d5d;">= </span><span style="color:#0086b3;">FunctionDefn
    </span><span style="color:#323232;">  { name </span><span style="font-weight:bold;color:#a71d5d;">:: </span><span style="color:#0086b3;">String</span><span style="color:#323232;">,
    </span><span style="color:#323232;">    </span><span style="font-weight:bold;color:#795da3;">params </span><span style="font-weight:bold;color:#a71d5d;">::</span><span style="color:#323232;"> [</span><span style="font-weight:bold;color:#a71d5d;">String</span><span style="color:#323232;">],
    </span><span style="color:#323232;">    body :: [</span><span style="font-weight:bold;color:#a71d5d;">Stmt</span><span style="color:#323232;">]
    </span><span style="color:#323232;">  }
    </span><span style="color:#323232;">
    </span><span style="font-weight:bold;color:#a71d5d;">data </span><span style="color:#0086b3;">Element
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">= </span><span style="color:#0086b3;">PattAct PatternAction
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#0086b3;">FnDef FunctionDefn
    </span><span style="color:#323232;">
    </span><span style="font-weight:bold;color:#a71d5d;">newtype </span><span style="color:#0086b3;">Program </span><span style="font-weight:bold;color:#a71d5d;">= </span><span style="color:#0086b3;">Program</span><span style="color:#323232;"> </span><span style="color:#0086b3;">Element
    </span>
    

    Now for Cephyr, this one is a bit more complex. Before Cephyr I attempted to make a C compiler several times, and every time I got stuck at the AST.

    The problem is, I wanna use OCaml’s modules in the AST. But I don’t know how? I just said fuck it and used top-level types. I am here currently:

    
    <span style="font-weight:bold;color:#a71d5d;">type const_expr
    </span><span style="font-weight:bold;color:#a71d5d;">type type_decl
    </span><span style="font-weight:bold;color:#a71d5d;">type unary_op
    </span><span style="font-weight:bold;color:#a71d5d;">type binary_op
    </span><span style="font-weight:bold;color:#a71d5d;">type expr
    </span><span style="font-weight:bold;color:#a71d5d;">type stmt
    </span><span style="color:#323232;">
    </span><span style="font-weight:bold;color:#a71d5d;">type literal </span><span style="color:#323232;">=
    </span><span style="color:#323232;">    ConstLiteral </span><span style="font-weight:bold;color:#a71d5d;">of const_lit </span><span style="color:#323232;">| CompoundLiteral </span><span style="font-weight:bold;color:#a71d5d;">of compound_lit
    </span><span style="color:#323232;">
    </span><span style="font-weight:bold;color:#a71d5d;">and </span><span style="color:#0086b3;">const_lit </span><span style="font-weight:bold;color:#a71d5d;">=
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">IntConst of </span><span style="font-weight:bold;color:#a71d5d;">int *</span><span style="color:#323232;"> int_suffix </span><span style="font-weight:bold;color:#a71d5d;">option
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">FloatCOnst of </span><span style="font-weight:bold;color:#a71d5d;">float *</span><span style="color:#323232;"> float_suffix </span><span style="font-weight:bold;color:#a71d5d;">option
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">CharConst of </span><span style="font-weight:bold;color:#a71d5d;">char *</span><span style="color:#323232;"> charset_prefix </span><span style="font-weight:bold;color:#a71d5d;">option
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">StrConst of </span><span style="font-weight:bold;color:#a71d5d;">string *</span><span style="color:#323232;"> charset_prefix </span><span style="font-weight:bold;color:#a71d5d;">option
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">IdentConst of </span><span style="font-weight:bold;color:#a71d5d;">string *</span><span style="color:#323232;"> const_expr
    </span><span style="color:#323232;">
    </span><span style="font-weight:bold;color:#a71d5d;">and </span><span style="color:#0086b3;">int_suffix </span><span style="font-weight:bold;color:#a71d5d;">=
    </span><span style="color:#323232;">    Long </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">LongLong </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">Unsigned </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">UnsignedLong </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">UnsignedLongLOng
    </span><span style="color:#323232;">
    </span><span style="font-weight:bold;color:#a71d5d;">and </span><span style="color:#0086b3;">float_suffix </span><span style="font-weight:bold;color:#a71d5d;">=
    </span><span style="color:#323232;">    Double </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">LongDouble
    </span><span style="color:#323232;">
    </span><span style="font-weight:bold;color:#a71d5d;">and </span><span style="color:#0086b3;">charset_prefix </span><span style="font-weight:bold;color:#a71d5d;">=
    </span><span style="color:#323232;">    Local </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">U8 </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">U16 </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">U32
    </span><span style="color:#323232;">
    </span><span style="font-weight:bold;color:#a71d5d;">and </span><span style="color:#0086b3;">compound_lit </span><span style="font-weight:bold;color:#a71d5d;">=
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">ArrayCompound of init_type </span><span style="font-weight:bold;color:#a71d5d;">*</span><span style="color:#323232;"> init_item </span><span style="font-weight:bold;color:#a71d5d;">list
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">StructCompound of init_type </span><span style="font-weight:bold;color:#a71d5d;">*</span><span style="color:#323232;"> init_item </span><span style="font-weight:bold;color:#a71d5d;">list
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">UnionCompound of init_type </span><span style="font-weight:bold;color:#a71d5d;">*</span><span style="color:#323232;"> init_item </span><span style="font-weight:bold;color:#a71d5d;">list
    </span><span style="color:#323232;">
    </span><span style="font-weight:bold;color:#a71d5d;">and </span><span style="color:#0086b3;">init_item </span><span style="font-weight:bold;color:#a71d5d;">=
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">RegularInit of expr
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">DesignatedInit of designated_init </span><span style="font-weight:bold;color:#a71d5d;">*</span><span style="color:#323232;"> expr
    </span><span style="color:#323232;">
    </span><span style="font-weight:bold;color:#a71d5d;">and </span><span style="color:#0086b3;">designated_init </span><span style="font-weight:bold;color:#a71d5d;">=
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">ConstExpr of const_expr
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">ConstExprPair of const_expr </span><span style="font-weight:bold;color:#a71d5d;">*</span><span style="color:#323232;"> const_expr
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">Ident of </span><span style="font-weight:bold;color:#a71d5d;">string
    </span><span style="color:#323232;">
    </span><span style="font-weight:bold;color:#a71d5d;">and </span><span style="color:#0086b3;">init_type </span><span style="font-weight:bold;color:#a71d5d;">=</span><span style="color:#323232;"> type_decl
    </span><span style="color:#323232;">
    </span><span style="color:#323232;">
    </span><span style="font-weight:bold;color:#a71d5d;">type const_expr </span><span style="color:#323232;">=
    </span><span style="color:#323232;">  | UnaryConstExpr </span><span style="font-weight:bold;color:#a71d5d;">of </span><span style="color:#323232;">{ factor: </span><span style="font-weight:bold;color:#a71d5d;">literal; </span><span style="color:#323232;">op: </span><span style="font-weight:bold;color:#a71d5d;">unary_op; </span><span style="color:#323232;">}
    </span><span style="color:#323232;">  | BinaryConstExpr </span><span style="font-weight:bold;color:#a71d5d;">of </span><span style="color:#323232;">{ left_factor: </span><span style="font-weight:bold;color:#a71d5d;">literal; </span><span style="color:#323232;">right_factor: </span><span style="font-weight:bold;color:#a71d5d;">literal; </span><span style="color:#323232;">op: </span><span style="font-weight:bold;color:#a71d5d;">binary_op; </span><span style="color:#323232;">}
    </span><span style="color:#323232;">
    </span><span style="color:#323232;">
    </span><span style="font-weight:bold;color:#a71d5d;">type primary_factor </span><span style="color:#323232;">=
    </span><span style="color:#323232;">    Identifier </span><span style="font-weight:bold;color:#a71d5d;">of string </span><span style="color:#323232;">| NestedExpr </span><span style="font-weight:bold;color:#a71d5d;">of expr </span><span style="color:#323232;">| Literal </span><span style="font-weight:bold;color:#a71d5d;">of literal
    </span><span style="color:#323232;">
    </span><span style="font-weight:bold;color:#a71d5d;">and </span><span style="color:#0086b3;">expr </span><span style="font-weight:bold;color:#a71d5d;">=
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">Primary of primary_factor
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">Unary of { factor: </span><span style="font-weight:bold;color:#a71d5d;">primary_factor; </span><span style="color:#323232;">op: </span><span style="font-weight:bold;color:#a71d5d;">unary_op; </span><span style="color:#323232;">}
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">Subscript of { factor: </span><span style="font-weight:bold;color:#a71d5d;">primary_factor; </span><span style="color:#323232;">op: </span><span style="font-weight:bold;color:#a71d5d;">subscript_op; </span><span style="color:#323232;">}
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">Binary of { left_factor: </span><span style="font-weight:bold;color:#a71d5d;">expr; </span><span style="color:#323232;">right_factor: </span><span style="font-weight:bold;color:#a71d5d;">expr; </span><span style="color:#323232;">op: </span><span style="font-weight:bold;color:#a71d5d;">binary_op; </span><span style="color:#323232;">}
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">Ternary of { cond: </span><span style="font-weight:bold;color:#a71d5d;">expr; </span><span style="color:#323232;">if_true: </span><span style="font-weight:bold;color:#a71d5d;">expr; </span><span style="color:#323232;">if_false: </span><span style="font-weight:bold;color:#a71d5d;">expr; </span><span style="color:#323232;">}
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">Assignment of { lvalue: </span><span style="font-weight:bold;color:#a71d5d;">expr; </span><span style="color:#323232;">rvalue: </span><span style="font-weight:bold;color:#a71d5d;">expr; </span><span style="color:#323232;">op: </span><span style="font-weight:bold;color:#a71d5d;">assign_op; </span><span style="color:#323232;">}
    </span><span style="color:#323232;">
    </span><span style="font-weight:bold;color:#a71d5d;">and </span><span style="color:#0086b3;">prefix_unary_op </span><span style="font-weight:bold;color:#a71d5d;">=
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">Negate            
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">LogicalNegate     
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">BitwiseNot        
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">AddressOf         
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">Dereference       
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">PreIncrement      
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">PreDecrement      
    </span><span style="color:#323232;">
    </span><span style="font-weight:bold;color:#a71d5d;">and </span><span style="color:#0086b3;">postfix_unary_op </span><span style="font-weight:bold;color:#a71d5d;">=
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">PostIncrement     
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">PostDecrement
    </span><span style="color:#323232;">
    </span><span style="font-weight:bold;color:#a71d5d;">and </span><span style="color:#0086b3;">unary_op </span><span style="font-weight:bold;color:#a71d5d;">=
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">PrefixOp of prefix_unary_op
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">PostfixOp of postfix_unary_op
    </span><span style="color:#323232;">
    </span><span style="font-weight:bold;color:#a71d5d;">and </span><span style="color:#0086b3;">subscript_op </span><span style="font-weight:bold;color:#a71d5d;">=
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">Index of expr
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">DotMember of expr
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">ArrowMember of expr
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">FunctionCall of expr </span><span style="font-weight:bold;color:#a71d5d;">list
    </span><span style="color:#323232;">
    </span><span style="font-weight:bold;color:#a71d5d;">and </span><span style="color:#0086b3;">binary_op </span><span style="font-weight:bold;color:#a71d5d;">=
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">Add               
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">Subtract          
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">Multiply          
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">Divide            
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">Modulo            
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">BitwiseAnd        
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">BitwiseOr         
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">BitwiseXor        
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">ShiftLeft         
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">ShiftRight        
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">LogicalAnd        
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">LogicalOr         
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">Equal             
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">NotEqual          
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">LessThan          
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">LessThanOrEqual   
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">GreaterThan       
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">GreaterThanOrEqual 
    </span><span style="color:#323232;">
    </span><span style="font-weight:bold;color:#a71d5d;">and </span><span style="color:#0086b3;">assign_op </span><span style="font-weight:bold;color:#a71d5d;">=
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">Assignment        
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">AddAssign         
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">SubtractAssign    
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">MultiplyAssign    
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">DivideAssign      
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">ModuloAssign      
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">AndAssign         
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">OrAssign          
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">XorAssign         
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">ShiftLeftAssign   
    </span><span style="color:#323232;">  </span><span style="font-weight:bold;color:#a71d5d;">| </span><span style="color:#323232;">ShiftRightAssign
    </span>
    

    It’s still incomplete. I just found out I can use .mli files.

    I think Cephyr is the 5th reincaation of my OCaml C compiler. I just spend hours at the AST and get tired of it.

    I found lcc, by Fraiser et al:

    [github.com/drh/lcc

    And I have the book too. I like the book but it’s kinda useless for me because I wanna do SSA. These kinda tree-rewriting mumbo jumbo is too 80s for my taste.

    So any help is appreciated. Thanks.

    Corbin,

    Your code looked alright. Working in C is a risky chore. You’re early in your journey and I think it’s good to get a taste of many of the traditional techniques before turning towards newer fancier algorithms.

    “Haskell and OCaml”, hm? The two concepts you need to internalize are katamorphisms and paramorphisms. You may have heard of “recursion schemes”; these two schemes are the ones available on any tree. Fundamentally, most of a compiler is tree-to-tree transformations (nanopasses), and they are expressible as one of two forms:

    • Katamorphism: The leaves of each node are transformed before the branch (bottom-up)
    • Paramorphism: The leaves are transformed after/during the branch transformation (top-down)

    If you look again at my AST builder builder, you’ll see .run() and .walk() methods, implementing the recursion for any katamorphism or paramorphism respectively. In Haskell, these are called Traversable types. This is a pun in Monte, where .run() is also the default method; the syntax makes it easy to perform a katamorphism by passing a tree-traversing object directly to the AST.

    Your types are alright, but you’ll want to pass a generic parameter through them, turning them into a valid Functor in Haskell or a generic module in OCaml. This is a basic defense against the “AST Decoration Problem”, AKA the “AST Typing Problem”. As you add features to your compiler, you’ll realize why these are necessary.

    ChubakPDP11,

    (Sorry if this is a double post) I think what you call ‘decoration’ I call 'augmentation;. After many iterations ,I came up with this AST: pastebin.com/NA1DhZF2

    I like it, but I am still skeptical as of comitting to it. I really want to use Functors… But i’m nto sure how. These are new concepts to me!

    human6439, (edited ) to programming in EBNF Grammar for POSIX Shell

    there are typos in lines 118 (asyncp), 202 (substitue), 346 (bracketet; also see line 352) and 386 (asnyc), and in line 346 you did not update the names from brack to bracket, and in line 283 (and consequently also line 320) the word order should probably be redirect-output-append

    ChubakPDP11,

    Apologies. I will definitely fix them. Do you notice any more errors? I myself just realize that-- path expansion could be replaced with actual rules. Thanks again.

    human6439, (edited )

    I updated my comment again. Also, there is no need to apologize! It is virtually impossible to write a document of this size without typos.

    ChubakPDP11,

    Thanks my good human.

    Bitrot, to linux in xz-utils backdoor situation (CVE-2024-3094)

    Worth the read just for the ldd rabbit trail and bumping into Ulrich Drepper being an ass on Red Hat bugzilla. Unlocking fond memories.

    joyjoy,

    Just don’t read the comments. It’s mostly people attacking China and people attacking those people for attacking China.

    tiziodcaio, to aitech in Clonare la voce con coqui: un piccolo howto

    Questo devo probarlo, mi fa venire I brividi

    Suoko,
    @Suoko@feddit.it avatar

    A parte gli scherzi che uno può fare, non saprei a cosa possa servire realmente. Di sicuro creare un audiolibro in modo gratuito potrebbe fare gola a tanti. Mi viene in mente il “calibro”…

  • All
  • Subscribed
  • Moderated
  • Favorites
  • JUstTest
  • thenastyranch
  • osvaldo12
  • Durango
  • ngwrru68w68
  • khanakhh
  • DreamBathrooms
  • mdbf
  • magazineikmin
  • Youngstown
  • everett
  • InstantRegret
  • slotface
  • rosin
  • megavids
  • kavyap
  • GTA5RPClips
  • cisconetworking
  • cubers
  • modclub
  • tacticalgear
  • ethstaker
  • tester
  • normalnudes
  • provamag3
  • anitta
  • Leos
  • lostlight
  • All magazines