Can’t load this website, what is it?
Can’t load this website, what is it?
Thanks for your help my good man.
This is so nice… Thanks.
Thanks. I actually have a parse-related question which I will post somewhere soon (as in 2-3 minute).
I will download it all and mirror it on my server and Github pages. Hate to see it go. What happened to this dude? Was he old or young?
That’s what they are doing with Fandom (formerly Wikia). Right?
Uh apologies. I did not realize that.
I don’t understand. Am I doing something against the rules of this instance? I have posted stuff like this before?
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.
Alright sorry. I’m just trolling people. If you go to my profile I have a lot of Rust projects. @hascat @FizzyOrange
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.
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 )
No problem my good man. Have fun.
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?
(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: https://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!
The advice offered by Steele in this video no longer applies. It’s still a bit more up-to-date than Kernighan’s talk of a similar title. The fun of this video is in how he twists the English language. He’s truly an erudite man.
The reason this advice no longer applies is, that I, as a person trying to enter the world of langdev, at least personally, see no reason on defining a new language. I think we should find new ways to describe languages we already have i.e. implement them.
I am currently making a C compiler in OCaml, besides some other languages. I just began work on the AST tags. I somehow decided to use SSA versioning here.
But descring a new compiler for C, it’s blaze. I only do it because C is easy, at least non-intrinsicaly. For example, there’s no automatic GC. There are no first-class functions, or function literals (aka ‘lambas’, although this term is massively ‘disused’ — function literals are one thing, lambda literals are one thing, lambda expressions are one thing, function expressions are another thing and so on and so forth – and I don’t have classical education, I just managed to understand that imperative languages abuse the term ‘lambda’ to a dangerous degree. They have named their literals after the concept which it derives from ,it’s like calling binary computers, not the concept, the literal thing, 'Neumann machines, right? Like, go to Best Buy and say ‘Give me this Neumnan machine to play games on’! Maybe that’s because I am too uneducated that I think that, anyways).
Besides that, there are:
1- Too many old languages that could use a new veneer, like a SML compiler that uses MLIR or LLVM. 2- There are too many interpreted languages that could use being jitted. Like Ruby. Not sure if there’s jitted Ruby, but I just discoevered how sweet it is and I like a faster version 3- We could dig a mass grave and bury every Python user alive, after torturing them (I’m kidding! lol)
So I’m not very educated, I brute-force. I rely on ChatGPT models to spit facts at me, or give me validation on my work because I kinda need a ‘college simulator’. Like, I figure, I don’t have nay peers so let’s make this bot my peer.
In the realm of DSLs, let’s look at a successful example of ‘re-description’: Fish.
Fish is truly a marvel. Ever since I switched to it, you can’t beleive how faster I work. I don’t know if there were interactive-friendly shells before Fish, but Fish is ‘Friendly’ you know?
I am implementing my own shell too.
I dunno man. I’m just rambling.
Thanks.
Thanks! You know last night I fed a model several books and asked it a lot of stuff. This did not come up.
What i do is I glance at the book, then ask the model to explain it to me. I call the model ‘Urkel the Wiz Kid’.
I fed both CS books and CE books. Like Sipsers, A Quantative Approach, Automata of Aho, Harris and Harris, etc.
Thanks a lot my good man. Is this Monte? https://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.
data UnaryOp
= Prefix PrefixOp
| Postfix PostfixOp
deriving (Show)
data PrefixOp
= PrefixIncr
| PrefixDecr
| Plus
| Minus
| Not
deriving (Show)
data PostfixOp
= PostfixIncr
| PostfixDecr
deriving (Show)
data BinaryOp
= Add
| Sub
| Mul
| Div
| Mod
| Eq
| Ne
| Gt
| Ge
| Le
| Lt
| And
| Or
deriving (Show)
data Lvalue
= Unfixed String
| Fixed String String
deriving (Show)
data Factor
= Constant Constant
| Lvalue Lvalue
deriving (Show)
data Constant
= String String
| Integer Int
| Float Float
| Regex String
deriving (Show)
data Expr
= Unary UnaryOp Factor
| Binary Factor BinaryOp Factor
| Ternary Expr Expr Expr
| StrCat [Expr]
| Delete Expr
| Call String [Expr]
| Assign Lvalue Expr
deriving (Show)
data Stmt
= Express Expr
| For Expr Expr Expr Stmt
| ForIn Lvalue Lvalue Stmt
| DoWhile Stmt Expr
| While Expr Stmt
| If Expr Stmt [(Expr, Stmt)] (Maybe (Expr, Stmt))
| Return (Maybe Expr)
| Break
| Continue
| Compound [Stmt]
deriving (Show)
data Pattern
= Begin
| End
| Expr Expr
| ExprPair Expr Expr
data PatternAction
= WithPattern Pattern [Stmt]
| JustAction [Stmt]
data FunctionDefn = FunctionDefn
{ name :: String,
params :: [String],
body :: [Stmt]
}
data Element
= PattAct PatternAction
| FnDef FunctionDefn
newtype Program = Program [Element
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:
type const_expr
type type_decl
type unary_op
type binary_op
type expr
type stmt
type literal =
ConstLiteral of const_lit | CompoundLiteral of compound_lit
and const_lit =
| IntConst of int * int_suffix option
| FloatCOnst of float * float_suffix option
| CharConst of char * charset_prefix option
| StrConst of string * charset_prefix option
| IdentConst of string * const_expr
and int_suffix =
Long | LongLong | Unsigned | UnsignedLong | UnsignedLongLOng
and float_suffix =
Double | LongDouble
and charset_prefix =
Local | U8 | U16 | U32
and compound_lit =
| ArrayCompound of init_type * init_item list
| StructCompound of init_type * init_item list
| UnionCompound of init_type * init_item list
and init_item =
| RegularInit of expr
| DesignatedInit of designated_init * expr
and designated_init =
| ConstExpr of const_expr
| ConstExprPair of const_expr * const_expr
| Ident of string
and init_type = type_decl
type const_expr =
| UnaryConstExpr of { factor: literal; op: unary_op; }
| BinaryConstExpr of { left_factor: literal; right_factor: literal; op: binary_op; }
type primary_factor =
Identifier of string | NestedExpr of expr | Literal of literal
and expr =
| Primary of primary_factor
| Unary of { factor: primary_factor; op: unary_op; }
| Subscript of { factor: primary_factor; op: subscript_op; }
| Binary of { left_factor: expr; right_factor: expr; op: binary_op; }
| Ternary of { cond: expr; if_true: expr; if_false: expr; }
| Assignment of { lvalue: expr; rvalue: expr; op: assign_op; }
and prefix_unary_op =
| Negate
| LogicalNegate
| BitwiseNot
| AddressOf
| Dereference
| PreIncrement
| PreDecrement
and postfix_unary_op =
| PostIncrement
| PostDecrement
and unary_op =
| PrefixOp of prefix_unary_op
| PostfixOp of postfix_unary_op
and subscript_op =
| Index of expr
| DotMember of expr
| ArrowMember of expr
| FunctionCall of expr list
and binary_op =
| Add
| Subtract
| Multiply
| Divide
| Modulo
| BitwiseAnd
| BitwiseOr
| BitwiseXor
| ShiftLeft
| ShiftRight
| LogicalAnd
| LogicalOr
| Equal
| NotEqual
| LessThan
| LessThanOrEqual
| GreaterThan
| GreaterThanOrEqual
and assign_op =
| Assignment
| AddAssign
| SubtractAssign
| MultiplyAssign
| DivideAssign
| ModuloAssign
| AndAssign
| OrAssign
| XorAssign
| ShiftLeftAssign
| ShiftRightAssign
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:
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.
Removed by mod