319: # 552 "./lpsrc/flx_types.ipk"
320: and param_kind_t = [`PVal | `PVar | `PFun | `PRef ]
321: and simple_parameter_t = id_t * typecode_t
322: and parameter_t = param_kind_t * id_t * typecode_t
323: and macro_parameter_type_t =
324: | Ident
325: | Expr
326: | Stmt
327: and macro_parameter_t = id_t * macro_parameter_type_t
328: and lvalue_t = [
329: | `Val of range_srcref * string
330: | `Var of range_srcref * string
331: | `Name of range_srcref * string
332: | `Skip of range_srcref
333: | `List of tlvalue_t list
334: | `Expr of range_srcref * expr_t
335: ]
336: and tlvalue_t = lvalue_t * typecode_t option
337:
338: and funkind_t = [
339: | `Object
340: | `Function
341: | `CFunction
342: | `InlineFunction
343: | `NoInlineFunction
344: | `Virtual
345: | `Ctor
346: | `Generator
347: ]
348:
349: and property_t = [
350: | `Recursive
351: | `Inline
352: | `NoInline
353: | `Inlining_started
354: | `Inlining_complete
355: | `Generated of string
356: | `Heap_closure (* a heaped closure is formed *)
357: | `Explicit_closure (* explicit closure expression *)
358: | `Stackable (* closure can be created on stack *)
359: | `Stack_closure (* a stacked closure is formed *)
360: | `Unstackable (* closure cannot be created on stack *)
361: | `Pure (* closure not required by self *)
362: | `Uses_global_var (* a global variable is explicitly used *)
363: | `Ctor (* Class constructor procedure *)
364: | `Generator (* Generator: fun with internal state *)
365: | `Yields (* Yielding generator *)
366: | `Cfun (* C function *)
367:
368: (* one of the below must be set before code generation *)
369: | `Requires_ptf (* a pointer to thread frame is needed *)
370: | `Not_requires_ptf (* no pointer to thread frame is needed *)
371:
372: | `Uses_gc (* requires gc locally *)
373: | `Virtual (* interface in a typeclass *)
374: ]
375:
376: and type_qual_t = [
377: | base_type_qual_t
378: | `Raw_needs_shape of typecode_t
379: ]
380:
381: and requirement_t = [
382: | `Body_req of c_t
383: | `Header_req of c_t
384: | `Named_req of qualified_name_t
385: | `Property_req of string
386: | `Package_req of c_t
387: ]
388:
389: and ikind_t = [
390: | `Header
391: | `Body
392: | `Package
393: ]
394:
395: and raw_req_expr_t =
396: [
397: | `RREQ_atom of requirement_t
398: | `RREQ_or of raw_req_expr_t * raw_req_expr_t
399: | `RREQ_and of raw_req_expr_t * raw_req_expr_t
400: | `RREQ_true
401: | `RREQ_false
402: ]
403:
404: and named_req_expr_t =
405: [
406: | `NREQ_atom of qualified_name_t
407: | `NREQ_or of named_req_expr_t * named_req_expr_t
408: | `NREQ_and of named_req_expr_t * named_req_expr_t
409: | `NREQ_true
410: | `NREQ_false
411: ]
412:
413: and prec_t = string
414: and glr_term_t =
415: [
416: | `GLR_name of qualified_name_t
417: | `GLR_opt of glr_term_t
418: | `GLR_ast of glr_term_t
419: | `GLR_plus of glr_term_t
420: | `GLR_alt of glr_term_t list
421: | `GLR_seq of glr_term_t list
422: ]
423:
424: and glr_entry_t = string option * glr_term_t
425: and production_t = glr_entry_t list
426:
427: and reduced_glr_entry_t = string option * qualified_name_t
428: and reduced_production_t = reduced_glr_entry_t list
429: and params_t = parameter_t list * expr_t option (* second arg is a constraint *)
430: and class_member_t = [
431: | `MemberVal of id_t * typecode_t * c_t option
432: | `MemberVar of id_t * typecode_t * c_t option
433: | `MemberFun of id_t * int option * vs_list_t * typecode_t * c_t option
434: | `MemberProc of id_t * int option * vs_list_t * typecode_t * c_t option
435: | `MemberCtor of id_t * int option * typecode_t * c_t option
436: ]
437:
438: and ast_term_t =
439: [
440: | `Expression_term of expr_t
441: | `Statement_term of statement_t
442: | `Statements_term of statement_t list
443: | `Identifier_term of string
444: | `Keyword_term of string
445: | `Apply_term of ast_term_t * ast_term_t list
446: ]
447:
448: and statement_t =
449: [
450: | `AST_cparse of range_srcref * string
451: | `AST_include of range_srcref * string
452: | `AST_open of range_srcref * vs_list_t * qualified_name_t
453: | `AST_inject_module of range_srcref * qualified_name_t
454: | `AST_use of range_srcref * id_t * qualified_name_t
455: | `AST_comment of string (* for documenting generated code *)
456: (*
457: | `AST_public of range_srcref * string * statement_t
458: *)
459: | `AST_private of range_srcref * statement_t
460:
461: (* definitions *)
462: | `AST_reduce of range_srcref * id_t * vs_list_t * simple_parameter_t list * expr_t * expr_t
463: | `AST_axiom of range_srcref * id_t * vs_list_t * params_t * axiom_method_t
464: | `AST_lemma of range_srcref * id_t * vs_list_t * params_t * axiom_method_t
465: | `AST_function of range_srcref * id_t * vs_list_t * params_t * (typecode_t * expr_t option) * property_t list * statement_t list
466: | `AST_curry of range_srcref * id_t * vs_list_t * params_t list * (typecode_t * expr_t option) * funkind_t * statement_t list
467: | `AST_object of range_srcref * id_t * vs_list_t * params_t * statement_t list
468: | `AST_regdef of range_srcref * string * regexp_t
469: | `AST_glr of range_srcref * string * typecode_t * (range_srcref * production_t * expr_t) list
470:
471: (* macros *)
472: | `AST_macro_name of range_srcref * id_t * id_t
473: | `AST_macro_names of range_srcref * id_t * id_t list
474: | `AST_expr_macro of range_srcref * id_t * macro_parameter_t list * expr_t
475: | `AST_stmt_macro of range_srcref * id_t * macro_parameter_t list * statement_t list
476: | `AST_macro_block of range_srcref * statement_t list
477: | `AST_macro_val of range_srcref * id_t list * expr_t
478: | `AST_macro_vals of range_srcref * id_t * expr_t list
479: | `AST_macro_var of range_srcref * id_t list * expr_t
480: | `AST_macro_assign of range_srcref * id_t list * expr_t
481: | `AST_macro_forget of range_srcref * id_t list
482: | `AST_macro_label of range_srcref * id_t
483: | `AST_macro_goto of range_srcref * id_t
484: | `AST_macro_ifgoto of range_srcref * expr_t * id_t
485: | `AST_macro_proc_return of range_srcref
486:
487: (* type macros *)
488: | `AST_macro_ifor of range_srcref * id_t * id_t list * statement_t list
489: | `AST_macro_vfor of range_srcref * id_t list * expr_t * statement_t list
490:
491: (* composition of statements: note NOT A BLOCK *)
492: | `AST_seq of range_srcref * statement_t list
493:
494: (* types *)
495: | `AST_union of range_srcref * id_t * vs_list_t * (id_t * int option * vs_list_t * typecode_t) list
496: | `AST_struct of range_srcref * id_t * vs_list_t * (id_t * typecode_t) list
497: | `AST_cstruct of range_srcref * id_t * vs_list_t * (id_t * typecode_t) list
498: | `AST_cclass of range_srcref * id_t * vs_list_t * class_member_t list
499: | `AST_class of range_srcref * id_t * vs_list_t * statement_t list
500: | `AST_type_alias of range_srcref * id_t * vs_list_t * typecode_t
501: | `AST_inherit of range_srcref * id_t * vs_list_t * qualified_name_t
502: | `AST_inherit_fun of range_srcref * id_t * vs_list_t * qualified_name_t
503:
504: (* variables *)
505: | `AST_val_decl of range_srcref * id_t * vs_list_t * typecode_t option * expr_t option
506: | `AST_lazy_decl of range_srcref * id_t * vs_list_t * typecode_t option * expr_t option
507: | `AST_var_decl of range_srcref * id_t * vs_list_t * typecode_t option * expr_t option
508: | `AST_ref_decl of range_srcref * id_t * vs_list_t * typecode_t option * expr_t option
509:
510: (* module system *)
511: | `AST_untyped_module of range_srcref * id_t * vs_list_t * statement_t list
512: | `AST_namespace of range_srcref * id_t * vs_list_t * statement_t list
513: | `AST_typeclass of range_srcref * id_t * vs_list_t * statement_t list
514: | `AST_instance of range_srcref * vs_list_t * qualified_name_t * statement_t list
515:
516: (* control structures: primitives *)
517: | `AST_label of range_srcref * id_t
518: (*
519: | `AST_whilst of range_srcref * expr_t * statement_t list
520: | `AST_until of range_srcref * expr_t * statement_t list
521: *)
522: | `AST_goto of range_srcref * id_t
523: | `AST_ifgoto of range_srcref * expr_t *id_t
524: | `AST_ifreturn of range_srcref * expr_t
525: | `AST_ifdo of range_srcref * expr_t * statement_t list * statement_t list
526: | `AST_ifnotgoto of range_srcref * expr_t * id_t
527: | `AST_call of range_srcref * expr_t * expr_t
528: | `AST_assign of range_srcref * string * tlvalue_t * expr_t
529: | `AST_cassign of range_srcref * expr_t * expr_t
530: | `AST_jump of range_srcref * expr_t * expr_t
531: | `AST_loop of range_srcref * id_t * expr_t
532: | `AST_svc of range_srcref * id_t
533: | `AST_fun_return of range_srcref * expr_t
534: | `AST_yield of range_srcref * expr_t
535: | `AST_proc_return of range_srcref
536: | `AST_halt of range_srcref * string
537: | `AST_nop of range_srcref * string
538: | `AST_assert of range_srcref * expr_t
539: | `AST_apply_ctor of range_srcref * id_t * expr_t * expr_t
540: | `AST_init of range_srcref * id_t * expr_t
541:
542: | `AST_newtype of range_srcref * id_t * vs_list_t * typecode_t
543:
544: (* binding structures [prolog] *)
545: | `AST_abs_decl of range_srcref * id_t * vs_list_t * type_qual_t list * c_t * raw_req_expr_t
546: | `AST_ctypes of range_srcref * (srcref * id_t) list * type_qual_t list * raw_req_expr_t
547: | `AST_const_decl of range_srcref * id_t * vs_list_t * typecode_t * c_t * raw_req_expr_t
548: | `AST_fun_decl of range_srcref * id_t * vs_list_t * typecode_t list * typecode_t * c_t * raw_req_expr_t * prec_t
549: | `AST_callback_decl of range_srcref * id_t * typecode_t list * typecode_t * raw_req_expr_t
550: (* embedding *)
551: | `AST_insert of range_srcref * id_t * vs_list_t * c_t * ikind_t * raw_req_expr_t
552: | `AST_code of range_srcref * c_t
553: | `AST_noreturn_code of range_srcref * c_t
554:
555: | `AST_export_fun of range_srcref * suffixed_name_t * string
556: | `AST_export_type of range_srcref * typecode_t * string
557:
558: | `AST_user_statement of range_srcref * string * ast_term_t
559: ]
560:
561:
562: and exe_t =
563: [
564: | `EXE_code of c_t (* for inline C++ code *)
565: | `EXE_noreturn_code of c_t (* for inline C++ code *)
566: | `EXE_comment of string (* for documenting generated code *)
567: | `EXE_label of string (* for internal use only *)
568: | `EXE_goto of string (* for internal use only *)
569: | `EXE_ifgoto of expr_t * string (* for internal use only *)
570: | `EXE_ifnotgoto of expr_t * string (* for internal use only *)
571: | `EXE_call of expr_t * expr_t
572: | `EXE_jump of expr_t * expr_t
573: | `EXE_loop of id_t * expr_t
574: | `EXE_svc of id_t
575: | `EXE_fun_return of expr_t
576: | `EXE_yield of expr_t
577: | `EXE_proc_return
578: | `EXE_halt of string
579: | `EXE_nop of string
580: | `EXE_init of id_t * expr_t
581: | `EXE_iinit of (id_t * int) * expr_t
582: | `EXE_assign of expr_t * expr_t
583: | `EXE_assert of expr_t
584: | `EXE_apply_ctor of id_t * expr_t * expr_t
585: ]
586:
587: type sexe_t = range_srcref * exe_t
588:
The whole of a compilation unit, this is the data structure
returned by parsing a whole file.